Browse Source

use AsyncSend

pull/178/head
orignal 10 years ago
parent
commit
da006a1d6e
  1. 13
      I2PTunnel.cpp
  2. 13
      SAM.cpp

13
I2PTunnel.cpp

@ -85,8 +85,17 @@ namespace client
else else
{ {
if (m_Stream) if (m_Stream)
m_Stream->Send (m_Buffer, bytes_transferred); {
Receive (); auto s = shared_from_this ();
m_Stream->AsyncSend (m_Buffer, bytes_transferred,
[s](const boost::system::error_code& ecode)
{
if (!ecode)
s->Receive ();
else
s->Terminate ();
});
}
} }
} }

13
SAM.cpp

@ -558,8 +558,17 @@ namespace client
else else
{ {
if (m_Stream) if (m_Stream)
m_Stream->Send ((uint8_t *)m_Buffer, bytes_transferred); {
Receive (); auto s = shared_from_this ();
m_Stream->AsyncSend ((uint8_t *)m_Buffer, bytes_transferred,
[s](const boost::system::error_code& ecode)
{
if (!ecode)
s->Receive ();
else
s->Terminate ();
});
}
} }
} }

Loading…
Cancel
Save