mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-31 09:04:14 +00:00
handle receive_from errors
This commit is contained in:
parent
2651723b50
commit
87228429d6
55
SSU.cpp
55
SSU.cpp
@ -199,13 +199,26 @@ namespace transport
|
|||||||
|
|
||||||
boost::system::error_code ec;
|
boost::system::error_code ec;
|
||||||
size_t moreBytes = m_Socket.available(ec);
|
size_t moreBytes = m_Socket.available(ec);
|
||||||
while (moreBytes && packets.size () < 25)
|
if (!ec)
|
||||||
{
|
{
|
||||||
packet = new SSUPacket ();
|
while (moreBytes && packets.size () < 25)
|
||||||
packet->len = m_Socket.receive_from (boost::asio::buffer (packet->buf, SSU_MTU_V4), packet->from);
|
{
|
||||||
packets.push_back (packet);
|
packet = new SSUPacket ();
|
||||||
moreBytes = m_Socket.available();
|
packet->len = m_Socket.receive_from (boost::asio::buffer (packet->buf, SSU_MTU_V4), packet->from, 0, ec);
|
||||||
}
|
if (!ec)
|
||||||
|
{
|
||||||
|
packets.push_back (packet);
|
||||||
|
moreBytes = m_Socket.available(ec);
|
||||||
|
if (ec) break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LogPrint (eLogError, "SSU: receive_from error: ", ec.message ());
|
||||||
|
delete packet;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_Service.post (std::bind (&SSUServer::HandleReceivedPackets, this, packets, &m_Sessions));
|
m_Service.post (std::bind (&SSUServer::HandleReceivedPackets, this, packets, &m_Sessions));
|
||||||
Receive ();
|
Receive ();
|
||||||
@ -231,15 +244,29 @@ namespace transport
|
|||||||
std::vector<SSUPacket *> packets;
|
std::vector<SSUPacket *> packets;
|
||||||
packets.push_back (packet);
|
packets.push_back (packet);
|
||||||
|
|
||||||
size_t moreBytes = m_SocketV6.available ();
|
boost::system::error_code ec;
|
||||||
while (moreBytes && packets.size () < 25)
|
size_t moreBytes = m_SocketV6.available (ec);
|
||||||
|
if (!ec)
|
||||||
{
|
{
|
||||||
packet = new SSUPacket ();
|
while (moreBytes && packets.size () < 25)
|
||||||
packet->len = m_SocketV6.receive_from (boost::asio::buffer (packet->buf, SSU_MTU_V6), packet->from);
|
{
|
||||||
packets.push_back (packet);
|
packet = new SSUPacket ();
|
||||||
moreBytes = m_SocketV6.available();
|
packet->len = m_SocketV6.receive_from (boost::asio::buffer (packet->buf, SSU_MTU_V6), packet->from, 0, ec);
|
||||||
|
if (!ec)
|
||||||
|
{
|
||||||
|
packets.push_back (packet);
|
||||||
|
moreBytes = m_SocketV6.available(ec);
|
||||||
|
if (ec) break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LogPrint (eLogError, "SSU: v6 receive_from error: ", ec.message ());
|
||||||
|
delete packet;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ServiceV6.post (std::bind (&SSUServer::HandleReceivedPackets, this, packets, &m_SessionsV6));
|
m_ServiceV6.post (std::bind (&SSUServer::HandleReceivedPackets, this, packets, &m_SessionsV6));
|
||||||
ReceiveV6 ();
|
ReceiveV6 ();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user