1
0
mirror of https://github.com/PurpleI2P/i2pd.git synced 2025-02-02 02:44:15 +00:00

fixed crash on termination

This commit is contained in:
orignal 2014-12-04 11:24:00 -05:00
parent 517a7ba3ab
commit 08762870b4

13
SAM.h
View File

@ -72,14 +72,15 @@ namespace client
SAMSocket (SAMBridge& owner); SAMSocket (SAMBridge& owner);
~SAMSocket (); ~SAMSocket ();
void CloseStream (); // TODO: implement it better void CloseStream (); // TODO: implement it better
boost::asio::ip::tcp::socket& GetSocket () { return m_Socket; }; boost::asio::ip::tcp::socket& GetSocket () { return m_Socket; };
void ReceiveHandshake (); void ReceiveHandshake ();
void SetSocketType (SAMSocketType socketType) { m_SocketType = socketType; };
private: private:
void Terminate (); void Terminate ();
void HandleHandshakeReceived (const boost::system::error_code& ecode, std::size_t bytes_transferred); void HandleHandshakeReceived (const boost::system::error_code& ecode, std::size_t bytes_transferred);
void HandleHandshakeReplySent (const boost::system::error_code& ecode, std::size_t bytes_transferred); void HandleHandshakeReplySent (const boost::system::error_code& ecode, std::size_t bytes_transferred);
void HandleMessage (const boost::system::error_code& ecode, std::size_t bytes_transferred); void HandleMessage (const boost::system::error_code& ecode, std::size_t bytes_transferred);
@ -126,6 +127,12 @@ namespace client
{ {
ClientDestination * localDestination; ClientDestination * localDestination;
std::list<std::shared_ptr<SAMSocket> > sockets; std::list<std::shared_ptr<SAMSocket> > sockets;
~SAMSession ()
{
for (auto it: sockets)
it->SetSocketType (eSAMSocketTypeTerminated);
}
}; };
class SAMBridge class SAMBridge