Commit cd16965f authored by Dominik Charousset's avatar Dominik Charousset

Publish server at random port in remote actor test

parent 6ae25bc3
...@@ -70,19 +70,9 @@ void run_client(const char* host, uint16_t port) { ...@@ -70,19 +70,9 @@ void run_client(const char* host, uint16_t port) {
} }
uint16_t run_server() { uint16_t run_server() {
auto ref = spawn_typed(server); auto port = io::typed_publish(spawn_typed(server), 0, "127.0.0.1");
uint16_t port = 4242; CAF_PRINT("running on port " << port);
for (;;) { return port;
try {
io::typed_publish(ref, port, "127.0.0.1");
CAF_PRINT("running on port " << port);
return port;
}
catch (bind_failure&) {
// try next port
++port;
}
}
} }
int main(int argc, char** argv) { int main(int argc, char** argv) {
......
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