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
216d1fae
Commit
216d1fae
authored
Sep 03, 2014
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reformat test_remote_actor
parent
b8b9faae
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
66 deletions
+62
-66
unit_testing/test_remote_actor.cpp
unit_testing/test_remote_actor.cpp
+62
-66
No files found.
unit_testing/test_remote_actor.cpp
View file @
216d1fae
...
...
@@ -32,20 +32,18 @@ void reflector(event_based_actor* self) {
}
void
spawn5_server_impl
(
event_based_actor
*
self
,
actor
client
,
group
grp
)
{
CAF_LOGF_TRACE
(
CAF_TARG
(
client
,
to_string
)
<<
", "
<<
CAF_TARG
(
grp
,
to_string
));
CAF_LOGF_TRACE
(
CAF_TARG
(
client
,
to_string
)
<<
", "
<<
CAF_TARG
(
grp
,
to_string
));
CAF_CHECK
(
grp
!=
invalid_group
);
self
->
spawn_in_group
(
grp
,
reflector
);
self
->
spawn_in_group
(
grp
,
reflector
);
CAF_PRINT
(
"send {'Spawn5'} and await {'ok', actor_vector}"
);
self
->
sync_send
(
client
,
atom
(
"Spawn5"
),
grp
)
.
then
(
on
(
atom
(
"ok"
),
arg_match
)
>>
[
=
](
const
actor_vector
&
vec
)
{
CAF_PRINT
(
"received vector with "
<<
vec
.
size
()
<<
" elements"
);
self
->
sync_send
(
client
,
atom
(
"Spawn5"
),
grp
).
then
(
on
(
atom
(
"ok"
),
arg_match
)
>>
[
=
](
const
actor_vector
&
vec
)
{
CAF_PRINT
(
"received vector with "
<<
vec
.
size
()
<<
" elements"
);
self
->
send
(
grp
,
"Hello reflectors!"
,
5.0
);
if
(
vec
.
size
()
!=
5
)
{
CAF_PRINTERR
(
"remote client did not spawn five reflectors!"
);
CAF_PRINTERR
(
"remote client did not spawn five reflectors!"
);
}
for
(
auto
&
a
:
vec
)
{
CAF_PRINT
(
"monitor actor: "
<<
to_string
(
a
));
...
...
@@ -54,13 +52,13 @@ void spawn5_server_impl(event_based_actor* self, actor client, group grp) {
},
others
()
>>
[
=
]
{
CAF_UNEXPECTED_MSG
(
self
);
self
->
quit
(
exit_reason
::
unhandled_exception
);
self
->
quit
(
exit_reason
::
user_defined
);
},
after
(
chrono
::
seconds
(
10
))
>>
[
=
]
{
CAF_UNEXPECTED_TOUT
();
self
->
quit
(
exit_reason
::
u
nhandled_exception
);
}
)
.
continue_with
([
=
]
{
self
->
quit
(
exit_reason
::
u
ser_defined
);
}
)
.
continue_with
([
=
]
{
CAF_PRINT
(
"wait for reflected messages"
);
// receive seven reply messages (2 local, 5 remote)
auto
replies
=
std
::
make_shared
<
int
>
(
0
);
...
...
@@ -72,9 +70,7 @@ void spawn5_server_impl(event_based_actor* self, actor client, group grp) {
self
->
become
(
[
=
](
const
down_msg
&
dm
)
{
if
(
dm
.
reason
!=
exit_reason
::
normal
)
{
CAF_PRINTERR
(
"reflector exited for non-normal exit "
"reason!"
);
CAF_PRINTERR
(
"reflector exited for non-normal exit reason!"
);
}
if
(
++*
downs
==
5
)
{
CAF_CHECKPOINT
();
...
...
@@ -84,23 +80,23 @@ void spawn5_server_impl(event_based_actor* self, actor client, group grp) {
},
others
()
>>
[
=
]
{
CAF_UNEXPECTED_MSG
(
self
);
// self->quit(exit_reason::unhandled_exception
);
self
->
quit
(
exit_reason
::
user_defined
);
},
after
(
chrono
::
seconds
(
2
))
>>
[
=
]
{
CAF_UNEXPECTED_TOUT
();
CAF_LOGF_ERROR
(
"did only receive "
<<
*
downs
<<
" down messages"
);
// self->quit(exit_reason::unhandled_exception);
}
);
CAF_LOGF_ERROR
(
"did only receive "
<<
*
downs
<<
" down messages"
);
self
->
quit
(
exit_reason
::
user_defined
);
}
);
}
},
after
(
std
::
chrono
::
seconds
(
2
))
>>
[
=
]
{
CAF_UNEXPECTED_TOUT
();
CAF_LOGF_ERROR
(
"did only receive "
<<
*
replies
CAF_LOGF_ERROR
(
"did only receive "
<<
*
replies
<<
" responses to 'Hello reflectors!'"
);
// self->quit(exit_reason::unhandled_exception);
});
self
->
quit
(
exit_reason
::
user_defined
);
}
);
});
}
...
...
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