|
|
@ -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,7 +59,7 @@ 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,7 +75,7 @@ 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 |
|
|
@ -96,6 +96,7 @@ namespace stream |
|
|
|
if (ecode) |
|
|
|
if (ecode) |
|
|
|
{ |
|
|
|
{ |
|
|
|
LogPrint ("I2PTunnel stream read error: ", ecode.message ()); |
|
|
|
LogPrint ("I2PTunnel stream read error: ", ecode.message ()); |
|
|
|
|
|
|
|
if (ecode != boost::asio::error::operation_aborted) |
|
|
|
Terminate (); |
|
|
|
Terminate (); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
@ -110,10 +111,13 @@ namespace stream |
|
|
|
if (ecode) |
|
|
|
if (ecode) |
|
|
|
{ |
|
|
|
{ |
|
|
|
LogPrint ("I2PTunnel connect error: ", ecode.message ()); |
|
|
|
LogPrint ("I2PTunnel connect error: ", ecode.message ()); |
|
|
|
|
|
|
|
if (ecode != boost::asio::error::operation_aborted) |
|
|
|
|
|
|
|
{ |
|
|
|
if (m_Stream) m_Stream->Close (); |
|
|
|
if (m_Stream) m_Stream->Close (); |
|
|
|
DeleteStream (m_Stream); |
|
|
|
DeleteStream (m_Stream); |
|
|
|
m_Stream = nullptr; |
|
|
|
m_Stream = nullptr; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
LogPrint ("I2PTunnel connected"); |
|
|
|
LogPrint ("I2PTunnel connected"); |
|
|
|