Skip to content

Commit

Permalink
fixed crash
Browse files Browse the repository at this point in the history
  • Loading branch information
orignal committed Feb 27, 2015
1 parent bd9e68e commit 7949ffe
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions SSU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ namespace transport

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);
if (it != m_Sessions.end ())
return it->second;
Expand Down
2 changes: 1 addition & 1 deletion SSU.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ namespace transport
boost::asio::ip::udp::socket m_Socket, m_SocketV6;
boost::asio::deadline_timer m_IntroducersUpdateTimer, m_PeerTestsCleanupTimer;
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<uint32_t, boost::asio::ip::udp::endpoint> m_Relays; // we are introducer
std::map<uint32_t, PeerTest> m_PeerTests; // nonce -> creation time in milliseconds
Expand Down
9 changes: 8 additions & 1 deletion SSUSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1076,7 +1076,14 @@ namespace transport
uint8_t buf[48 + 18];
// encrypt message with session key
FillHeaderAndEncrypt (PAYLOAD_TYPE_SESSION_DESTROYED, buf, 48);
Send (buf, 48);
try
{
Send (buf, 48);
}
catch (std::exception& ex)
{
LogPrint (eLogError, "SSU send session destoriyed exception ", ex.what ());
}
LogPrint (eLogDebug, "SSU session destroyed sent");
}
}
Expand Down

0 comments on commit 7949ffe

Please sign in to comment.