Commit e0094767 authored by Dominik Charousset's avatar Dominik Charousset

test for remote_actor() to return same proxy

remote_actor() re-uses existing network connections whenever
possible, this patch adds a check to the unit test and removes
a verbose error message in default_protocol that has to go the
log file, but not to cout.
parent 582d8171
...@@ -116,8 +116,7 @@ void default_protocol::register_peer(const process_information& node, ...@@ -116,8 +116,7 @@ void default_protocol::register_peer(const process_information& node,
CPPA_LOG_TRACE("node = " << to_string(node) << ", ptr = " << ptr); CPPA_LOG_TRACE("node = " << to_string(node) << ", ptr = " << ptr);
auto& ptrref = m_peers[node]; auto& ptrref = m_peers[node];
if (ptrref) { if (ptrref) {
CPPA_LOG_ERROR("peer already defined"); CPPA_LOG_INFO("peer " << to_string(node) << " already defined");
cerr << "*** peer already defined!" << endl;
} }
else ptrref = ptr; else ptrref = ptr;
} }
......
...@@ -150,6 +150,12 @@ int client_part(const vector<string_pair>& args) { ...@@ -150,6 +150,12 @@ int client_part(const vector<string_pair>& args) {
} }
auto port = static_cast<uint16_t>(stoi(i->second)); auto port = static_cast<uint16_t>(stoi(i->second));
auto server = remote_actor("localhost", port); auto server = remote_actor("localhost", port);
// remote_actor is supposed to return the same server when connecting to
// the same host again
for (int i = 0; i < 5; ++i) {
auto server2 = remote_actor("localhost", port);
CPPA_CHECK(server == server2);
}
send(server, atom("SpawnPing")); send(server, atom("SpawnPing"));
receive ( receive (
on(atom("PingPtr"), arg_match) >> [](actor_ptr ping_actor) { on(atom("PingPtr"), arg_match) >> [](actor_ptr ping_actor) {
......
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