Make I2PClientTunnel use TCPIPAcceptor

This commit is contained in:
Francisco Blas (klondike) Izquierdo Riera 2015-01-08 03:49:35 +01:00
parent df3e8ce937
commit 56014962d4
4 changed files with 17 additions and 54 deletions

View file

@ -55,12 +55,18 @@ namespace client
bool m_IsQuiet; // don't send destination
};
class I2PClientTunnel: public I2PService
class I2PClientTunnel: public TCPIPAcceptor
{
protected:
// Implements TCPIPAcceptor
std::shared_ptr<I2PServiceHandler> CreateHandler(boost::asio::ip::tcp::socket * socket);
const char* GetName() { return "I2P Client Tunnel"; }
public:
I2PClientTunnel (const std::string& destination, int port, ClientDestination * localDestination = nullptr);
~I2PClientTunnel ();
~I2PClientTunnel () {}
void Start ();
void Stop ();
@ -68,13 +74,7 @@ namespace client
private:
const i2p::data::IdentHash * GetIdentHash ();
void Accept ();
void HandleAccept (const boost::system::error_code& ecode, boost::asio::ip::tcp::socket * socket);
private:
boost::asio::ip::tcp::acceptor m_Acceptor;
boost::asio::deadline_timer m_Timer;
std::string m_Destination;
const i2p::data::IdentHash * m_DestinationIdentHash;
};