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