Browse Source

fixed crash

pull/163/head
orignal 10 years ago
parent
commit
7949ffe41e
  1. 1
      SSU.cpp
  2. 2
      SSU.h
  3. 7
      SSUSession.cpp

1
SSU.cpp

@ -256,6 +256,7 @@ namespace transport
std::shared_ptr<SSUSession> SSUServer::FindSession (const boost::asio::ip::udp::endpoint& e) const std::shared_ptr<SSUSession> SSUServer::FindSession (const boost::asio::ip::udp::endpoint& e) const
{ {
std::unique_lock<std::mutex> l(m_SessionsMutex);
auto it = m_Sessions.find (e); auto it = m_Sessions.find (e);
if (it != m_Sessions.end ()) if (it != m_Sessions.end ())
return it->second; return it->second;

2
SSU.h

@ -96,7 +96,7 @@ namespace transport
boost::asio::ip::udp::socket m_Socket, m_SocketV6; boost::asio::ip::udp::socket m_Socket, m_SocketV6;
boost::asio::deadline_timer m_IntroducersUpdateTimer, m_PeerTestsCleanupTimer; boost::asio::deadline_timer m_IntroducersUpdateTimer, m_PeerTestsCleanupTimer;
std::list<boost::asio::ip::udp::endpoint> m_Introducers; // introducers we are connected to std::list<boost::asio::ip::udp::endpoint> m_Introducers; // introducers we are connected to
std::mutex m_SessionsMutex; mutable std::mutex m_SessionsMutex;
std::map<boost::asio::ip::udp::endpoint, std::shared_ptr<SSUSession> > m_Sessions; std::map<boost::asio::ip::udp::endpoint, std::shared_ptr<SSUSession> > m_Sessions;
std::map<uint32_t, boost::asio::ip::udp::endpoint> m_Relays; // we are introducer std::map<uint32_t, boost::asio::ip::udp::endpoint> m_Relays; // we are introducer
std::map<uint32_t, PeerTest> m_PeerTests; // nonce -> creation time in milliseconds std::map<uint32_t, PeerTest> m_PeerTests; // nonce -> creation time in milliseconds

7
SSUSession.cpp

@ -1076,7 +1076,14 @@ namespace transport
uint8_t buf[48 + 18]; uint8_t buf[48 + 18];
// encrypt message with session key // encrypt message with session key
FillHeaderAndEncrypt (PAYLOAD_TYPE_SESSION_DESTROYED, buf, 48); FillHeaderAndEncrypt (PAYLOAD_TYPE_SESSION_DESTROYED, buf, 48);
try
{
Send (buf, 48); Send (buf, 48);
}
catch (std::exception& ex)
{
LogPrint (eLogError, "SSU send session destoriyed exception ", ex.what ());
}
LogPrint (eLogDebug, "SSU session destroyed sent"); LogPrint (eLogDebug, "SSU session destroyed sent");
} }
} }

Loading…
Cancel
Save