Browse Source

always use TCP/IP sockets for I2CP

pull/1742/head
orignal 3 years ago
parent
commit
48374d97df
  1. 8
      libi2pd_client/I2CP.cpp
  2. 10
      libi2pd_client/I2CP.h

8
libi2pd_client/I2CP.cpp

@ -274,7 +274,7 @@ namespace client @@ -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_MessageID (0), m_IsSendAccepted (true), m_IsSending (false)
{
@ -939,7 +939,7 @@ namespace client @@ -939,7 +939,7 @@ namespace client
I2CPServer::I2CPServer (const std::string& interface, int port, bool isSingleThread):
RunnableService ("I2CP"), m_IsSingleThread (isSingleThread),
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));
m_MessagesHandlers[I2CP_GET_DATE_MESSAGE] = &I2CPSession::GetDateMessageHandler;
@ -981,13 +981,13 @@ namespace client @@ -981,13 +981,13 @@ namespace client
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,
std::placeholders::_1, newSocket));
}
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)
{

10
libi2pd_client/I2CP.h

@ -142,9 +142,7 @@ namespace client @@ -142,9 +142,7 @@ namespace client
{
public:
typedef boost::asio::ip::tcp proto;
I2CPSession (I2CPServer& owner, std::shared_ptr<proto::socket> socket);
I2CPSession (I2CPServer& owner, std::shared_ptr<boost::asio::ip::tcp::socket> socket);
~I2CPSession ();
@ -192,7 +190,7 @@ namespace client @@ -192,7 +190,7 @@ namespace client
private:
I2CPServer& m_Owner;
std::shared_ptr<proto::socket> m_Socket;
std::shared_ptr<boost::asio::ip::tcp::socket> m_Socket;
uint8_t m_Header[I2CP_HEADER_SIZE], m_Payload[I2CP_MAX_MESSAGE_LENGTH];
size_t m_PayloadLen;
@ -230,7 +228,7 @@ namespace client @@ -230,7 +228,7 @@ namespace client
void Accept ();
void HandleAccept(const boost::system::error_code& ecode, std::shared_ptr<I2CPSession::proto::socket> socket);
void HandleAccept(const boost::system::error_code& ecode, std::shared_ptr<boost::asio::ip::tcp::socket> socket);
private:
@ -238,7 +236,7 @@ namespace client @@ -238,7 +236,7 @@ namespace client
I2CPMessageHandler m_MessagesHandlers[256];
std::map<uint16_t, std::shared_ptr<I2CPSession> > m_Sessions;
I2CPSession::proto::acceptor m_Acceptor;
boost::asio::ip::tcp::acceptor m_Acceptor;
public:

Loading…
Cancel
Save