Commit e211c2aa authored by Dominik Charousset's avatar Dominik Charousset

Fix formatting of test_typed_remote_actor

parent 0c1bb6bd
...@@ -75,7 +75,7 @@ uint16_t run_server() { ...@@ -75,7 +75,7 @@ uint16_t run_server() {
for (;;) { for (;;) {
try { try {
io::typed_publish(ref, port, "127.0.0.1"); io::typed_publish(ref, port, "127.0.0.1");
CAF_LOGF_DEBUG("running on port " << port); CAF_PRINT("running on port " << port);
return port; return port;
} }
catch (bind_failure&) { catch (bind_failure&) {
...@@ -88,28 +88,33 @@ uint16_t run_server() { ...@@ -88,28 +88,33 @@ uint16_t run_server() {
int main(int argc, char** argv) { int main(int argc, char** argv) {
announce<ping>(&ping::value); announce<ping>(&ping::value);
announce<pong>(&pong::value); announce<pong>(&pong::value);
message_builder { argv + 1, argv + argc } message_builder{argv + 1, argv + argc}.apply({
.apply({on("-c", spro<uint16_t>)>> [](uint16_t port) { on("-c", spro<uint16_t>)>> [](uint16_t port) {
run_client("localhost", port); CAF_PRINT("run in client mode");
}, run_client("localhost", port);
on("-s") >> [] { run_server(); }, on() >> [&] { },
auto port = run_server(); on("-s") >> [] {
CAF_CHECKPOINT(); run_server();
ostringstream oss; },
oss << argv[0] << " -c " << port << to_dev_null; on() >> [&] {
// execute client_part() in a separate process, auto port = run_server();
// connected via localhost socket CAF_CHECKPOINT();
auto child = thread([&oss]() { ostringstream oss;
CAF_LOGC_TRACE("NONE", "main$thread_launcher", ""); oss << argv[0] << " -c " << port << to_dev_null;
string cmdstr = oss.str(); // execute client_part() in a separate process,
if (system(cmdstr.c_str()) != 0) { // connected via localhost socket
CAF_PRINTERR("FATAL: command \"" << cmdstr << "\" failed!"); auto child = thread([&oss]() {
abort(); CAF_LOGC_TRACE("NONE", "main$thread_launcher", "");
} string cmdstr = oss.str();
}); if (system(cmdstr.c_str()) != 0) {
CAF_CHECKPOINT(); CAF_PRINTERR("FATAL: command \"" << cmdstr << "\" failed!");
child.join(); abort();
}}); }
});
CAF_CHECKPOINT();
child.join();
}
});
CAF_CHECKPOINT(); CAF_CHECKPOINT();
await_all_actors_done(); await_all_actors_done();
shutdown(); shutdown();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment