mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-21 23:54:14 +00:00
use boost::asio::address for address
This commit is contained in:
parent
224b423522
commit
2d428fd090
@ -517,10 +517,10 @@ namespace ntcp
|
||||
}
|
||||
|
||||
|
||||
NTCPClient::NTCPClient (boost::asio::io_service& service, const char * address,
|
||||
NTCPClient::NTCPClient (boost::asio::io_service& service, boost::asio::ip::address& address,
|
||||
int port, i2p::data::RouterInfo& in_RouterInfo):
|
||||
NTCPSession (service, in_RouterInfo),
|
||||
m_Endpoint (boost::asio::ip::address::from_string (address), port)
|
||||
m_Endpoint (address, port)
|
||||
{
|
||||
Connect ();
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ namespace ntcp
|
||||
{
|
||||
public:
|
||||
|
||||
NTCPClient (boost::asio::io_service& service, const char * address, int port, i2p::data::RouterInfo& in_RouterInfo);
|
||||
NTCPClient (boost::asio::io_service& service, boost::asio::ip::address& address, int port, i2p::data::RouterInfo& in_RouterInfo);
|
||||
|
||||
private:
|
||||
|
||||
|
@ -45,7 +45,7 @@ namespace i2p
|
||||
auto address = m_RouterInfo.GetNTCPAddress ();
|
||||
if (address)
|
||||
{
|
||||
address->host = host;
|
||||
address->host = boost::asio::ip::address::from_string (host);
|
||||
address->port = port;
|
||||
}
|
||||
|
||||
@ -80,4 +80,4 @@ namespace i2p
|
||||
std::ofstream fi (ROUTER_INFO);
|
||||
fi.write ((char *)m_RouterInfo.GetBuffer (), m_RouterInfo.GetBufferLen ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ namespace data
|
||||
r += ReadString (value, s);
|
||||
s.seekg (1, std::ios_base::cur); r++; // ;
|
||||
if (!strcmp (key, "host"))
|
||||
address.host = value;
|
||||
address.host = boost::asio::ip::address::from_string (value);
|
||||
else if (!strcmp (key, "port"))
|
||||
address.port = boost::lexical_cast<int>(value);
|
||||
}
|
||||
@ -166,7 +166,7 @@ namespace data
|
||||
std::stringstream properties;
|
||||
WriteString ("host", properties);
|
||||
properties << '=';
|
||||
WriteString (address.host, properties);
|
||||
WriteString (address.host.to_string (), properties);
|
||||
properties << ';';
|
||||
WriteString ("port", properties);
|
||||
properties << '=';
|
||||
@ -227,7 +227,7 @@ namespace data
|
||||
void RouterInfo::AddNTCPAddress (const char * host, int port)
|
||||
{
|
||||
Address addr;
|
||||
addr.host = host;
|
||||
addr.host = boost::asio::ip::address::from_string (host);
|
||||
addr.port = port;
|
||||
addr.transportStyle = eTransportNTCP;
|
||||
addr.cost = 2;
|
||||
|
@ -27,7 +27,7 @@ namespace data
|
||||
struct Address
|
||||
{
|
||||
TransportStyle transportStyle;
|
||||
std::string host;
|
||||
boost::asio::ip::address host;
|
||||
int port;
|
||||
uint64_t date;
|
||||
uint8_t cost;
|
||||
|
@ -139,7 +139,7 @@ namespace i2p
|
||||
auto address = r->GetNTCPAddress ();
|
||||
if (address)
|
||||
{
|
||||
session = new i2p::ntcp::NTCPClient (m_Service, address->host.c_str (), address->port, *r);
|
||||
session = new i2p::ntcp::NTCPClient (m_Service, address->host, address->port, *r);
|
||||
AddNTCPSession (session);
|
||||
}
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user