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
2a240421
Commit
2a240421
authored
Jun 09, 2015
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use extract_opts in broker unit test
parent
a8e9851f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
19 deletions
+21
-19
libcaf_io/test/broker.cpp
libcaf_io/test/broker.cpp
+21
-19
No files found.
libcaf_io/test/broker.cpp
View file @
2a240421
...
...
@@ -197,27 +197,29 @@ CAF_TEST(test_broker) {
auto
argv
=
caf
::
test
::
engine
::
argv
();
auto
argc
=
caf
::
test
::
engine
::
argc
();
if
(
argv
)
{
message_builder
{
argv
,
argv
+
argc
}.
apply
({
on
(
"-c"
,
arg_match
)
>>
[
&
](
const
std
::
string
&
portstr
)
{
auto
port
=
static_cast
<
uint16_t
>
(
std
::
stoi
(
portstr
));
auto
p
=
spawn
(
ping
,
10
);
CAF_MESSAGE
(
"spawn_io_client..."
);
auto
cl
=
spawn_io_client
(
peer_fun
,
"localhost"
,
port
,
p
);
CAF_MESSAGE
(
"spawn_io_client finished"
);
anon_send
(
p
,
kickoff_atom
::
value
,
cl
);
CAF_MESSAGE
(
"`kickoff_atom` has been send"
);
},
on
(
"-s"
)
>>
[
&
]
{
run_server
(
false
,
argv
[
0
]);
},
others
>>
[
&
]
{
cerr
<<
"usage: "
<<
argv
[
0
]
<<
" [-c PORT]"
<<
endl
;
}
uint16_t
port
=
0
;
auto
r
=
message_builder
(
argv
,
argv
+
argc
).
extract_opts
({
{
"client-port,c"
,
"set port for IO client"
,
port
},
{
"server,s"
,
"run in server mode"
}
});
if
(
!
r
.
error
.
empty
()
||
r
.
opts
.
count
(
"help"
)
>
0
||
!
r
.
remainder
.
empty
())
{
cout
<<
r
.
error
<<
endl
<<
endl
<<
r
.
helptext
<<
endl
;
return
;
}
if
(
r
.
opts
.
count
(
"client-port"
)
>
0
)
{
auto
p
=
spawn
(
ping
,
10
);
CAF_MESSAGE
(
"spawn_io_client..."
);
auto
cl
=
spawn_io_client
(
peer_fun
,
"localhost"
,
port
,
p
);
CAF_MESSAGE
(
"spawn_io_client finished"
);
anon_send
(
p
,
kickoff_atom
::
value
,
cl
);
CAF_MESSAGE
(
"`kickoff_atom` has been send"
);
return
;
}
// else: run in server mode
run_server
(
false
,
argv
[
0
]);
return
;
}
else
{
run_server
(
true
,
caf
::
test
::
engine
::
path
());
}
run_server
(
true
,
caf
::
test
::
engine
::
path
());
CAF_MESSAGE
(
"block on `await_all_actors_done`"
);
await_all_actors_done
();
CAF_MESSAGE
(
"`await_all_actors_done` has finished"
);
...
...
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