Skip to content

Commit

Permalink
Fix ipc_client::async_resolve when given invalid endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
fikumikudev authored and pwojcikdev committed Jan 29, 2022
1 parent f308f40 commit 04c88e4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions nano/core_test/ipc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,19 @@ TEST (ipc, permissions_default_user_order)
nano::ipc::access access;
ASSERT_TRUE (access.deserialize_toml (toml));
}

TEST (ipc, invalid_endpoint)
{
nano::system system (1);
system.nodes[0]->config.ipc_config.transport_tcp.enabled = true;
system.nodes[0]->config.ipc_config.transport_tcp.port = 24077;
nano::node_rpc_config node_rpc_config;
nano::ipc::ipc_client client (system.nodes[0]->io_ctx);

std::atomic<bool> call_completed{ false };
client.async_connect ("::-1", 24077, [&client, &call_completed] (nano::error err) {
ASSERT_IS_ERROR (static_cast<std::error_code> (err));
call_completed = true;
});
ASSERT_TIMELY (5s, call_completed);
}
2 changes: 1 addition & 1 deletion nano/lib/ipc_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class socket_client : public nano::ipc::socket_base, public channel, public std:
}
else
{
callback (ec, *end);
callback (ec, boost::asio::ip::tcp::endpoint ());
}
});
}
Expand Down

0 comments on commit 04c88e4

Please sign in to comment.