mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-13 00:07:39 +01:00
SSU2: handle standard network errors more correctly
Signed-off-by: R4SAS <r4sas@i2pmail.org>
This commit is contained in:
parent
0d523bd2a6
commit
f1437feede
1 changed files with 82 additions and 70 deletions
|
@ -236,7 +236,19 @@ namespace transport
|
||||||
void SSU2Server::HandleReceivedFrom (const boost::system::error_code& ecode, size_t bytes_transferred,
|
void SSU2Server::HandleReceivedFrom (const boost::system::error_code& ecode, size_t bytes_transferred,
|
||||||
Packet * packet, boost::asio::ip::udp::socket& socket)
|
Packet * packet, boost::asio::ip::udp::socket& socket)
|
||||||
{
|
{
|
||||||
if (!ecode)
|
if (!ecode
|
||||||
|
|| ecode == boost::asio::error::connection_refused
|
||||||
|
|| ecode == boost::asio::error::connection_reset
|
||||||
|
|| ecode == boost::asio::error::network_unreachable
|
||||||
|
|| ecode == boost::asio::error::host_unreachable
|
||||||
|
#ifdef _WIN32 // windows can throw WinAPI error, which is not handled by ASIO
|
||||||
|
|| ecode.value() == boost::winapi::ERROR_CONNECTION_REFUSED_
|
||||||
|
|| ecode.value() == boost::winapi::ERROR_NETWORK_UNREACHABLE_
|
||||||
|
|| ecode.value() == boost::winapi::ERROR_HOST_UNREACHABLE_
|
||||||
|
#endif
|
||||||
|
)
|
||||||
|
// just try continue reading when received ICMP response otherwise socket can crash,
|
||||||
|
// but better to find out which host were sent it and mark that router as unreachable
|
||||||
{
|
{
|
||||||
i2p::transport::transports.UpdateReceivedBytes (bytes_transferred);
|
i2p::transport::transports.UpdateReceivedBytes (bytes_transferred);
|
||||||
packet->len = bytes_transferred;
|
packet->len = bytes_transferred;
|
||||||
|
|
Loading…
Add table
Reference in a new issue