Browse Source

some cleanup

pull/102/head
orignal 10 years ago
parent
commit
ef2932a234
  1. 4
      HTTPServer.cpp
  2. 4
      I2PTunnel.cpp
  3. 4
      SAM.cpp
  4. 2
      SOCKS.cpp
  5. 4
      Streaming.cpp
  6. 2
      Streaming.h

4
HTTPServer.cpp

@ -540,7 +540,7 @@ namespace util
RunRequest(); RunRequest();
} }
else // follow-on else // follow-on
m_Stream->Send ((uint8_t *)m_Buffer, bytes_transferred, 10); m_Stream->Send ((uint8_t *)m_Buffer, bytes_transferred);
Receive (); Receive ();
} }
/*else if (ecode != boost::asio::error::operation_aborted) /*else if (ecode != boost::asio::error::operation_aborted)
@ -879,7 +879,7 @@ namespace util
m_Stream = i2p::stream::CreateStream (*leaseSet); m_Stream = i2p::stream::CreateStream (*leaseSet);
if (m_Stream) if (m_Stream)
{ {
m_Stream->Send ((uint8_t *)buf, len, 10); m_Stream->Send ((uint8_t *)buf, len);
AsyncStreamReceive (); AsyncStreamReceive ();
} }
} }

4
I2PTunnel.cpp

@ -13,7 +13,7 @@ namespace stream
m_Socket (socket), m_Owner (owner) m_Socket (socket), m_Owner (owner)
{ {
m_Stream = m_Owner->GetLocalDestination ()->CreateNewOutgoingStream (*leaseSet); m_Stream = m_Owner->GetLocalDestination ()->CreateNewOutgoingStream (*leaseSet);
m_Stream->Send (m_Buffer, 0, 0); // connect m_Stream->Send (m_Buffer, 0); // connect
StreamReceive (); StreamReceive ();
Receive (); Receive ();
} }
@ -64,7 +64,7 @@ namespace stream
else else
{ {
if (m_Stream) if (m_Stream)
m_Stream->Send (m_Buffer, bytes_transferred, 0); m_Stream->Send (m_Buffer, bytes_transferred);
Receive (); Receive ();
} }
} }

4
SAM.cpp

@ -249,7 +249,7 @@ namespace stream
m_SocketType = eSAMSocketTypeStream; m_SocketType = eSAMSocketTypeStream;
session->sockets.push_back (this); session->sockets.push_back (this);
m_Stream = session->localDestination->CreateNewOutgoingStream (*leaseSet); m_Stream = session->localDestination->CreateNewOutgoingStream (*leaseSet);
m_Stream->Send ((uint8_t *)m_Buffer, 0, 0); // connect m_Stream->Send ((uint8_t *)m_Buffer, 0); // connect
I2PReceive (); I2PReceive ();
SendMessageReply (SAM_STREAM_STATUS_OK, strlen(SAM_STREAM_STATUS_OK), false); SendMessageReply (SAM_STREAM_STATUS_OK, strlen(SAM_STREAM_STATUS_OK), false);
} }
@ -345,7 +345,7 @@ namespace stream
else else
{ {
if (m_Stream) if (m_Stream)
m_Stream->Send ((uint8_t *)m_Buffer, bytes_transferred, 0); m_Stream->Send ((uint8_t *)m_Buffer, bytes_transferred);
Receive (); Receive ();
} }
} }

2
SOCKS.cpp

@ -93,7 +93,7 @@ namespace proxy
} }
LogPrint("--- socks4a sock forward: ", len); LogPrint("--- socks4a sock forward: ", len);
m_stream->Send(m_sock_buff, len, 1); m_stream->Send(m_sock_buff, len);
} }
void SOCKS4AHandler::HandleSockRecv(const boost::system::error_code & ecode, std::size_t len) void SOCKS4AHandler::HandleSockRecv(const boost::system::error_code & ecode, std::size_t len)

4
Streaming.cpp

@ -96,7 +96,7 @@ namespace stream
SendQuickAck (); SendQuickAck ();
else if (isSyn) else if (isSyn)
// we have to send SYN back to incoming connection // we have to send SYN back to incoming connection
Send (nullptr, 0, 0); // also sets m_IsOpen Send (nullptr, 0); // also sets m_IsOpen
} }
else else
{ {
@ -229,7 +229,7 @@ namespace stream
m_ResendTimer.cancel (); m_ResendTimer.cancel ();
} }
size_t Stream::Send (const uint8_t * buf, size_t len, int timeout) size_t Stream::Send (const uint8_t * buf, size_t len)
{ {
bool isNoAck = m_LastReceivedSequenceNumber < 0; // first packet bool isNoAck = m_LastReceivedSequenceNumber < 0; // first packet
while (!m_IsOpen || len > 0) while (!m_IsOpen || len > 0)

2
Streaming.h

@ -92,7 +92,7 @@ namespace stream
StreamingDestination * GetLocalDestination () { return m_LocalDestination; }; StreamingDestination * GetLocalDestination () { return m_LocalDestination; };
void HandleNextPacket (Packet * packet); void HandleNextPacket (Packet * packet);
size_t Send (const uint8_t * buf, size_t len, int timeout); // timeout in seconds size_t Send (const uint8_t * buf, size_t len);
template<typename Buffer, typename ReceiveHandler> template<typename Buffer, typename ReceiveHandler>
void AsyncReceive (const Buffer& buffer, ReceiveHandler handler, int timeout = 0); void AsyncReceive (const Buffer& buffer, ReceiveHandler handler, int timeout = 0);

Loading…
Cancel
Save