Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
627cec59
Commit
627cec59
authored
Nov 10, 2011
by
neverlord
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed mailman implementation
parent
2583d715
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
301 additions
and
229 deletions
+301
-229
cppa.files
cppa.files
+0
-2
cppa/actor.hpp
cppa/actor.hpp
+2
-0
cppa/detail/actor_proxy_cache.hpp
cppa/detail/actor_proxy_cache.hpp
+2
-1
cppa/detail/post_office_msg.hpp
cppa/detail/post_office_msg.hpp
+31
-6
src/actor_proxy.cpp
src/actor_proxy.cpp
+16
-2
src/mailman.cpp
src/mailman.cpp
+1
-5
src/post_office.cpp
src/post_office.cpp
+220
-201
src/post_office_msg.cpp
src/post_office_msg.cpp
+26
-8
src/unicast_network.cpp
src/unicast_network.cpp
+1
-1
src/uniform_type_info.cpp
src/uniform_type_info.cpp
+1
-1
unit_testing/test__remote_actor.cpp
unit_testing/test__remote_actor.cpp
+1
-2
No files found.
cppa.files
View file @
627cec59
...
...
@@ -201,8 +201,6 @@ cppa/util/any_tuple_iterator.hpp
src/any_tuple_iterator.cpp
cppa/detail/boxed.hpp
cppa/detail/unboxed.hpp
cppa/detail/matcher_arguments.hpp
src/matcher_arguments.cpp
src/invoke_rules.cpp
src/abstract_tuple.cpp
cppa/util/duration.hpp
...
...
cppa/actor.hpp
View file @
627cec59
...
...
@@ -172,6 +172,8 @@ class actor : public channel
*/
static
intrusive_ptr
<
actor
>
by_id
(
std
::
uint32_t
actor_id
);
inline
bool
is_proxy
()
const
{
return
m_is_proxy
;
}
};
/**
...
...
cppa/detail/actor_proxy_cache.hpp
View file @
627cec59
...
...
@@ -32,8 +32,9 @@ class actor_proxy_cache
public:
// this callback is called if a new proxy instance is created
template
<
typename
F
>
void
set_callback
(
F
&&
cb
)
void
set_
new_proxy_
callback
(
F
&&
cb
)
{
m_new_cb
=
std
::
forward
<
F
>
(
cb
);
}
...
...
cppa/detail/post_office_msg.hpp
View file @
627cec59
...
...
@@ -17,6 +17,13 @@ class post_office_msg
public:
enum
msg_type
{
add_peer_type
,
add_server_socket_type
,
proxy_exited_type
};
struct
add_peer
{
...
...
@@ -42,6 +49,12 @@ class post_office_msg
};
struct
proxy_exited
{
actor_proxy_ptr
proxy_ptr
;
inline
proxy_exited
(
const
actor_proxy_ptr
&
who
)
:
proxy_ptr
(
who
)
{
}
};
post_office_msg
(
native_socket_t
arg0
,
const
process_information_ptr
&
arg1
,
const
actor_proxy_ptr
&
arg2
,
...
...
@@ -49,14 +62,21 @@ class post_office_msg
post_office_msg
(
native_socket_t
arg0
,
const
actor_ptr
&
arg1
);
post_office_msg
(
const
actor_proxy_ptr
&
proxy_ptr
);
inline
bool
is_add_peer_msg
()
const
{
return
m_
is_add_peer_msg
;
return
m_
type
==
add_peer_type
;
}
inline
bool
is_add_server_socket_msg
()
const
{
return
!
m_is_add_peer_msg
;
return
m_type
==
add_server_socket_type
;
}
inline
bool
is_proxy_exited_msg
()
const
{
return
m_type
==
proxy_exited_type
;
}
inline
add_peer
&
as_add_peer_msg
()
...
...
@@ -69,27 +89,32 @@ class post_office_msg
return
m_add_server_socket
;
}
inline
proxy_exited
&
as_proxy_exited_msg
()
{
return
m_proxy_exited
;
}
~
post_office_msg
();
private:
post_office_msg
*
next
;
bool
m_is_add_peer_msg
;
msg_type
m_type
;
union
{
add_peer
m_add_peer_msg
;
add_server_socket
m_add_server_socket
;
proxy_exited
m_proxy_exited
;
};
};
constexpr
std
::
uint32_t
rd_queue_event
=
0x00
;
constexpr
std
::
uint32_t
unpublish_actor_event
=
0x01
;
constexpr
std
::
uint32_t
dec_socket_ref_event
=
0x02
;
constexpr
std
::
uint32_t
close_socket_event
=
0x03
;
constexpr
std
::
uint32_t
shutdown_event
=
0x04
;
constexpr
std
::
uint32_t
close_socket_event
=
0x02
;
constexpr
std
::
uint32_t
shutdown_event
=
0x03
;
typedef
std
::
uint32_t
pipe_msg
[
2
];
constexpr
size_t
pipe_msg_size
=
2
*
sizeof
(
std
::
uint32_t
);
...
...
src/actor_proxy.cpp
View file @
627cec59
...
...
@@ -38,22 +38,27 @@ void actor_proxy::enqueue(actor* sender, any_tuple&& msg)
void
actor_proxy
::
enqueue
(
actor
*
sender
,
const
any_tuple
&
msg
)
{
/*
if (msg.size() > 0 && msg.utype_info_at(0) == typeid(atom_value))
{
if (msg.size() == 2 && msg.utype_info_at(1) == typeid(actor_ptr))
{
switch (to_int(msg.get_as<atom_value>(0)))
{
// received via post_office
case to_int(atom(":Link")):
{
auto s = msg.get_as<actor_ptr>(1);
link_to
(
s
);
(void) link_to_impl(s);
//link_to(s);
return;
}
// received via post_office
case to_int(atom(":Unlink")):
{
auto s = msg.get_as<actor_ptr>(1);
unlink_from
(
s
);
(void) unlink_from_impl(s);
//unlink_from(s);
return;
}
default: break;
...
...
@@ -67,6 +72,15 @@ void actor_proxy::enqueue(actor* sender, const any_tuple& msg)
return;
}
}
*/
if
(
msg
.
size
()
==
2
&&
msg
.
utype_info_at
(
0
)
==
typeid
(
atom_value
)
&&
msg
.
get_as
<
atom_value
>
(
0
)
==
atom
(
":KillProxy"
)
&&
msg
.
utype_info_at
(
1
)
==
typeid
(
std
::
uint32_t
))
{
cleanup
(
msg
.
get_as
<
std
::
uint32_t
>
(
1
));
return
;
}
forward_message
(
parent_process_ptr
(),
sender
,
msg
);
}
...
...
src/mailman.cpp
View file @
627cec59
...
...
@@ -56,11 +56,7 @@ mailman_job::~mailman_job()
/*
// implemented in post_office.cpp
util::single_reader_queue<mailman_job>& mailman_queue()
{
return *s_queue;
//return *(s_mailman_manager.m_queue);
}
util::single_reader_queue<mailman_job>& mailman_queue();
*/
// known issues: send() should be asynchronous and select() should be used
...
...
src/post_office.cpp
View file @
627cec59
This diff is collapsed.
Click to expand it.
src/post_office_msg.cpp
View file @
627cec59
...
...
@@ -25,27 +25,45 @@ post_office_msg::post_office_msg(native_socket_t arg0,
const
actor_proxy_ptr
&
arg2
,
std
::
unique_ptr
<
attachable
>&&
arg3
)
:
next
(
nullptr
)
,
m_
is_add_peer_msg
(
tru
e
)
,
m_
type
(
add_peer_typ
e
)
{
new
(
&
m_add_peer_msg
)
add_peer
(
arg0
,
arg1
,
arg2
,
std
::
move
(
arg3
));
}
post_office_msg
::
post_office_msg
(
native_socket_t
arg0
,
const
actor_ptr
&
arg1
)
:
next
(
nullptr
)
,
m_
is_add_peer_msg
(
fals
e
)
,
m_
type
(
add_server_socket_typ
e
)
{
new
(
&
m_add_server_socket
)
add_server_socket
(
arg0
,
arg1
);
}
post_office_msg
::
post_office_msg
(
const
actor_proxy_ptr
&
proxy_ptr
)
:
next
(
nullptr
)
,
m_type
(
proxy_exited_type
)
{
new
(
&
m_proxy_exited
)
proxy_exited
(
proxy_ptr
);
}
post_office_msg
::~
post_office_msg
()
{
if
(
m_is_add_peer_msg
)
{
m_add_peer_msg
.
~
add_peer
();
}
else
switch
(
m_type
)
{
m_add_server_socket
.
~
add_server_socket
();
case
add_peer_type
:
{
m_add_peer_msg
.
~
add_peer
();
break
;
}
case
add_server_socket_type
:
{
m_add_server_socket
.
~
add_server_socket
();
break
;
}
case
proxy_exited_type
:
{
m_proxy_exited
.
~
proxy_exited
();
break
;
}
default:
throw
std
::
logic_error
(
"invalid post_office_msg type"
);
}
}
...
...
src/unicast_network.cpp
View file @
627cec59
...
...
@@ -88,7 +88,7 @@ void publish(actor_ptr& whom, std::uint16_t port)
{
throw
network_exception
(
"could not create server socket"
);
}
// closes the socket if an exception occurs
//
sguard
closes the socket if an exception occurs
socket_guard
sguard
(
sockfd
);
memset
((
char
*
)
&
serv_addr
,
0
,
sizeof
(
serv_addr
));
serv_addr
.
sin_family
=
AF_INET
;
...
...
src/uniform_type_info.cpp
View file @
627cec59
...
...
@@ -649,7 +649,7 @@ class uniform_type_info_map_helper
insert
(
d
,
new
channel_ptr_tinfo
,
{
raw_name
<
channel_ptr
>
()
});
//insert(d, new message_tinfo, { raw_name<any_tuple>() });
insert
(
d
,
new
atom_value_tinfo
,
{
raw_name
<
atom_value
>
()
});
insert
(
d
,
new
addr_msg_tinfo
,
{
raw_name
<
addr_msg_tinfo
>
()
});
insert
(
d
,
new
addr_msg_tinfo
,
{
raw_name
<
detail
::
addressed_message
>
()
});
insert
<
float
>
(
d
);
insert
<
cppa
::
util
::
void_type
>
(
d
);
if
(
sizeof
(
double
)
==
sizeof
(
long
double
))
...
...
unit_testing/test__remote_actor.cpp
View file @
627cec59
...
...
@@ -42,7 +42,6 @@ void client_part(const std::map<std::string, std::string>& args)
size_t
test__remote_actor
(
const
char
*
app_path
,
bool
is_client
,
const
std
::
map
<
std
::
string
,
std
::
string
>&
args
)
{
return
0
;
if
(
is_client
)
{
client_part
(
args
);
...
...
@@ -70,7 +69,7 @@ size_t test__remote_actor(const char* app_path, bool is_client,
std
::
string
cmd
;
{
std
::
ostringstream
oss
;
oss
<<
app_path
<<
" run=remote_actor port="
<<
port
<<
" &>/dev/null"
;
oss
<<
app_path
<<
" run=remote_actor port="
<<
port
<<
" &>
remote.txt"
;
//" &>
/dev/null";
cmd
=
oss
.
str
();
}
// execute client_part() in a separate process,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment