mirror of
https://github.com/monero-project/monero.git
synced 2024-12-23 03:59:33 +00:00
abstract_tcp_server2: fix binding to the wrong IP
This commit is contained in:
parent
8eab6147f4
commit
4469b0c41e
1 changed files with 4 additions and 4 deletions
|
@ -1109,12 +1109,12 @@ POP_WARNINGS
|
||||||
sock_.open(remote_endpoint.protocol());
|
sock_.open(remote_endpoint.protocol());
|
||||||
if(bind_ip != "0.0.0.0" && bind_ip != "0" && bind_ip != "" )
|
if(bind_ip != "0.0.0.0" && bind_ip != "0" && bind_ip != "" )
|
||||||
{
|
{
|
||||||
boost::asio::ip::tcp::endpoint local_endpoint(boost::asio::ip::address::from_string(adr.c_str()), 0);
|
boost::asio::ip::tcp::endpoint local_endpoint(boost::asio::ip::address::from_string(bind_ip.c_str()), 0);
|
||||||
boost::system::error_code ec;
|
boost::system::error_code ec;
|
||||||
sock_.bind(local_endpoint, ec);
|
sock_.bind(local_endpoint, ec);
|
||||||
if (ec)
|
if (ec)
|
||||||
{
|
{
|
||||||
MERROR("Error binding to " << adr << ": " << ec.message());
|
MERROR("Error binding to " << bind_ip << ": " << ec.message());
|
||||||
if (sock_.is_open())
|
if (sock_.is_open())
|
||||||
sock_.close();
|
sock_.close();
|
||||||
return false;
|
return false;
|
||||||
|
@ -1223,12 +1223,12 @@ POP_WARNINGS
|
||||||
sock_.open(remote_endpoint.protocol());
|
sock_.open(remote_endpoint.protocol());
|
||||||
if(bind_ip != "0.0.0.0" && bind_ip != "0" && bind_ip != "" )
|
if(bind_ip != "0.0.0.0" && bind_ip != "0" && bind_ip != "" )
|
||||||
{
|
{
|
||||||
boost::asio::ip::tcp::endpoint local_endpoint(boost::asio::ip::address::from_string(adr.c_str()), 0);
|
boost::asio::ip::tcp::endpoint local_endpoint(boost::asio::ip::address::from_string(bind_ip.c_str()), 0);
|
||||||
boost::system::error_code ec;
|
boost::system::error_code ec;
|
||||||
sock_.bind(local_endpoint, ec);
|
sock_.bind(local_endpoint, ec);
|
||||||
if (ec)
|
if (ec)
|
||||||
{
|
{
|
||||||
MERROR("Error binding to " << adr << ": " << ec.message());
|
MERROR("Error binding to " << bind_ip << ": " << ec.message());
|
||||||
if (sock_.is_open())
|
if (sock_.is_open())
|
||||||
sock_.close();
|
sock_.close();
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue