|
|
@ -29,6 +29,11 @@ namespace stream |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
I2PTunnelConnection::~I2PTunnelConnection () |
|
|
|
I2PTunnelConnection::~I2PTunnelConnection () |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
delete m_Socket; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void I2PTunnelConnection::Terminate () |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (m_Stream) |
|
|
|
if (m_Stream) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -36,15 +41,10 @@ namespace stream |
|
|
|
DeleteStream (m_Stream); |
|
|
|
DeleteStream (m_Stream); |
|
|
|
m_Stream = nullptr; |
|
|
|
m_Stream = nullptr; |
|
|
|
} |
|
|
|
} |
|
|
|
delete m_Socket; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void I2PTunnelConnection::Terminate () |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
m_Socket->close (); |
|
|
|
m_Socket->close (); |
|
|
|
if (m_Owner) |
|
|
|
if (m_Owner) |
|
|
|
m_Owner->RemoveConnection (this); |
|
|
|
m_Owner->RemoveConnection (this); |
|
|
|
// TODO: delete
|
|
|
|
delete this; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void I2PTunnelConnection::Receive () |
|
|
|
void I2PTunnelConnection::Receive () |
|
|
@ -59,8 +59,8 @@ namespace stream |
|
|
|
if (ecode) |
|
|
|
if (ecode) |
|
|
|
{ |
|
|
|
{ |
|
|
|
LogPrint ("I2PTunnel read error: ", ecode.message ()); |
|
|
|
LogPrint ("I2PTunnel read error: ", ecode.message ()); |
|
|
|
m_Stream->Close (); |
|
|
|
if (ecode != boost::asio::error::operation_aborted) |
|
|
|
Terminate (); |
|
|
|
Terminate (); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
@ -75,8 +75,8 @@ namespace stream |
|
|
|
if (ecode) |
|
|
|
if (ecode) |
|
|
|
{ |
|
|
|
{ |
|
|
|
LogPrint ("I2PTunnel write error: ", ecode.message ()); |
|
|
|
LogPrint ("I2PTunnel write error: ", ecode.message ()); |
|
|
|
m_Stream->Close (); |
|
|
|
if (ecode != boost::asio::error::operation_aborted) |
|
|
|
Terminate (); |
|
|
|
Terminate (); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
StreamReceive (); |
|
|
|
StreamReceive (); |
|
|
@ -96,7 +96,8 @@ namespace stream |
|
|
|
if (ecode) |
|
|
|
if (ecode) |
|
|
|
{ |
|
|
|
{ |
|
|
|
LogPrint ("I2PTunnel stream read error: ", ecode.message ()); |
|
|
|
LogPrint ("I2PTunnel stream read error: ", ecode.message ()); |
|
|
|
Terminate (); |
|
|
|
if (ecode != boost::asio::error::operation_aborted) |
|
|
|
|
|
|
|
Terminate (); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
@ -110,9 +111,12 @@ namespace stream |
|
|
|
if (ecode) |
|
|
|
if (ecode) |
|
|
|
{ |
|
|
|
{ |
|
|
|
LogPrint ("I2PTunnel connect error: ", ecode.message ()); |
|
|
|
LogPrint ("I2PTunnel connect error: ", ecode.message ()); |
|
|
|
if (m_Stream) m_Stream->Close (); |
|
|
|
if (ecode != boost::asio::error::operation_aborted) |
|
|
|
DeleteStream (m_Stream); |
|
|
|
{ |
|
|
|
m_Stream = nullptr; |
|
|
|
if (m_Stream) m_Stream->Close (); |
|
|
|
|
|
|
|
DeleteStream (m_Stream); |
|
|
|
|
|
|
|
m_Stream = nullptr; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|