Browse Source

TCP_QUICKACK

pull/1583/head
orignal 4 years ago
parent
commit
1c5b350c2b
  1. 8
      libi2pd/NTCP2.cpp

8
libi2pd/NTCP2.cpp

@ -742,6 +742,10 @@ namespace transport @@ -742,6 +742,10 @@ namespace transport
void NTCP2Session::ReceiveLength ()
{
if (IsTerminated ()) return;
#ifdef __linux__
const int one = 1;
setsockopt(m_Socket.native_handle(), IPPROTO_TCP, TCP_QUICKACK, &one, sizeof(one));
#endif
boost::asio::async_read (m_Socket, boost::asio::buffer(&m_NextReceivedLen, 2), boost::asio::transfer_all (),
std::bind(&NTCP2Session::HandleReceivedLength, shared_from_this (), std::placeholders::_1, std::placeholders::_2));
}
@ -793,6 +797,10 @@ namespace transport @@ -793,6 +797,10 @@ namespace transport
void NTCP2Session::Receive ()
{
if (IsTerminated ()) return;
#ifdef __linux__
const int one = 1;
setsockopt(m_Socket.native_handle(), IPPROTO_TCP, TCP_QUICKACK, &one, sizeof(one));
#endif
boost::asio::async_read (m_Socket, boost::asio::buffer(m_NextReceivedBuffer, m_NextReceivedLen), boost::asio::transfer_all (),
std::bind(&NTCP2Session::HandleReceived, shared_from_this (), std::placeholders::_1, std::placeholders::_2));
}

Loading…
Cancel
Save