Browse Source

Catch exception in SSUServer that would dump core.

pull/281/head
anonimal 9 years ago
parent
commit
6ae5f20ec1
  1. 2
      core/RouterInfo.cpp
  2. 8
      core/transport/SSU.cpp

2
core/RouterInfo.cpp

@ -426,7 +426,7 @@ namespace data
void RouterInfo::CreateBuffer (const PrivateKeys& privateKeys) void RouterInfo::CreateBuffer (const PrivateKeys& privateKeys)
{ {
m_Timestamp = i2p::util::GetMillisecondsSinceEpoch (); // refresh timstamp m_Timestamp = i2p::util::GetMillisecondsSinceEpoch (); // refresh timestamp
std::stringstream s; std::stringstream s;
uint8_t ident[1024]; uint8_t ident[1024];
auto identLen = privateKeys.GetPublic ().ToBuffer (ident, 1024); auto identLen = privateKeys.GetPublic ().ToBuffer (ident, 1024);

8
core/transport/SSU.cpp

@ -137,9 +137,17 @@ namespace transport
void SSUServer::Send (const uint8_t * buf, size_t len, const boost::asio::ip::udp::endpoint& to) void SSUServer::Send (const uint8_t * buf, size_t len, const boost::asio::ip::udp::endpoint& to)
{ {
if (to.protocol () == boost::asio::ip::udp::v4()) if (to.protocol () == boost::asio::ip::udp::v4())
try {
m_Socket.send_to (boost::asio::buffer (buf, len), to); m_Socket.send_to (boost::asio::buffer (buf, len), to);
} catch (const std::exception& ex) {
LogPrint (eLogError, "SSUServer send error: ", ex.what());
}
else else
try {
m_SocketV6.send_to (boost::asio::buffer (buf, len), to); m_SocketV6.send_to (boost::asio::buffer (buf, len), to);
} catch (const std::exception& ex) {
LogPrint (eLogError, "SSUServer V6 send error: ", ex.what());
}
} }
void SSUServer::Receive () void SSUServer::Receive ()

Loading…
Cancel
Save