From 08762870b4bf4f14ae887e00bd465cb9ad839c14 Mon Sep 17 00:00:00 2001 From: orignal Date: Thu, 4 Dec 2014 11:24:00 -0500 Subject: [PATCH] fixed crash on termination --- SAM.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/SAM.h b/SAM.h index 32cc80fe..b632028d 100644 --- a/SAM.h +++ b/SAM.h @@ -72,14 +72,15 @@ namespace client SAMSocket (SAMBridge& owner); ~SAMSocket (); - void CloseStream (); // TODO: implement it better - + void CloseStream (); // TODO: implement it better + boost::asio::ip::tcp::socket& GetSocket () { return m_Socket; }; void ReceiveHandshake (); + void SetSocketType (SAMSocketType socketType) { m_SocketType = socketType; }; private: - void Terminate (); + void Terminate (); 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 HandleMessage (const boost::system::error_code& ecode, std::size_t bytes_transferred); @@ -126,6 +127,12 @@ namespace client { ClientDestination * localDestination; std::list > sockets; + + ~SAMSession () + { + for (auto it: sockets) + it->SetSocketType (eSAMSocketTypeTerminated); + } }; class SAMBridge