|
|
@ -274,7 +274,7 @@ namespace client |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
I2CPSession::I2CPSession (I2CPServer& owner, std::shared_ptr<proto::socket> socket): |
|
|
|
I2CPSession::I2CPSession (I2CPServer& owner, std::shared_ptr<boost::asio::ip::tcp::socket> socket): |
|
|
|
m_Owner (owner), m_Socket (socket), m_SessionID (0xFFFF), |
|
|
|
m_Owner (owner), m_Socket (socket), m_SessionID (0xFFFF), |
|
|
|
m_MessageID (0), m_IsSendAccepted (true), m_IsSending (false) |
|
|
|
m_MessageID (0), m_IsSendAccepted (true), m_IsSending (false) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -939,7 +939,7 @@ namespace client |
|
|
|
I2CPServer::I2CPServer (const std::string& interface, int port, bool isSingleThread): |
|
|
|
I2CPServer::I2CPServer (const std::string& interface, int port, bool isSingleThread): |
|
|
|
RunnableService ("I2CP"), m_IsSingleThread (isSingleThread), |
|
|
|
RunnableService ("I2CP"), m_IsSingleThread (isSingleThread), |
|
|
|
m_Acceptor (GetIOService (), |
|
|
|
m_Acceptor (GetIOService (), |
|
|
|
I2CPSession::proto::endpoint(boost::asio::ip::address::from_string(interface), port)) |
|
|
|
boost::asio::ip::tcp::endpoint(boost::asio::ip::address::from_string(interface), port)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
memset (m_MessagesHandlers, 0, sizeof (m_MessagesHandlers)); |
|
|
|
memset (m_MessagesHandlers, 0, sizeof (m_MessagesHandlers)); |
|
|
|
m_MessagesHandlers[I2CP_GET_DATE_MESSAGE] = &I2CPSession::GetDateMessageHandler; |
|
|
|
m_MessagesHandlers[I2CP_GET_DATE_MESSAGE] = &I2CPSession::GetDateMessageHandler; |
|
|
@ -981,13 +981,13 @@ namespace client |
|
|
|
|
|
|
|
|
|
|
|
void I2CPServer::Accept () |
|
|
|
void I2CPServer::Accept () |
|
|
|
{ |
|
|
|
{ |
|
|
|
auto newSocket = std::make_shared<I2CPSession::proto::socket> (GetIOService ()); |
|
|
|
auto newSocket = std::make_shared<boost::asio::ip::tcp::socket> (GetIOService ()); |
|
|
|
m_Acceptor.async_accept (*newSocket, std::bind (&I2CPServer::HandleAccept, this, |
|
|
|
m_Acceptor.async_accept (*newSocket, std::bind (&I2CPServer::HandleAccept, this, |
|
|
|
std::placeholders::_1, newSocket)); |
|
|
|
std::placeholders::_1, newSocket)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void I2CPServer::HandleAccept(const boost::system::error_code& ecode, |
|
|
|
void I2CPServer::HandleAccept(const boost::system::error_code& ecode, |
|
|
|
std::shared_ptr<I2CPSession::proto::socket> socket) |
|
|
|
std::shared_ptr<boost::asio::ip::tcp::socket> socket) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!ecode && socket) |
|
|
|
if (!ecode && socket) |
|
|
|
{ |
|
|
|
{ |
|
|
|