|
|
@ -35,6 +35,9 @@ namespace ntcp |
|
|
|
delete m_DHKeysPair; |
|
|
|
delete m_DHKeysPair; |
|
|
|
if (m_NextMessage) |
|
|
|
if (m_NextMessage) |
|
|
|
i2p::DeleteI2NPMessage (m_NextMessage); |
|
|
|
i2p::DeleteI2NPMessage (m_NextMessage); |
|
|
|
|
|
|
|
for (auto it :m_DelayedMessages) |
|
|
|
|
|
|
|
i2p::DeleteI2NPMessage (it); |
|
|
|
|
|
|
|
m_DelayedMessages.clear (); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void NTCPSession::CreateAESKey (uint8_t * pubKey, uint8_t * aesKey) |
|
|
|
void NTCPSession::CreateAESKey (uint8_t * pubKey, uint8_t * aesKey) |
|
|
@ -144,6 +147,7 @@ namespace ntcp |
|
|
|
if (ecode) |
|
|
|
if (ecode) |
|
|
|
{ |
|
|
|
{ |
|
|
|
LogPrint ("Couldn't send Phase 1 message: ", ecode.message ()); |
|
|
|
LogPrint ("Couldn't send Phase 1 message: ", ecode.message ()); |
|
|
|
|
|
|
|
if (ecode != boost::asio::error::operation_aborted) |
|
|
|
Terminate (); |
|
|
|
Terminate (); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
@ -160,6 +164,7 @@ namespace ntcp |
|
|
|
if (ecode) |
|
|
|
if (ecode) |
|
|
|
{ |
|
|
|
{ |
|
|
|
LogPrint ("Phase 1 read error: ", ecode.message ()); |
|
|
|
LogPrint ("Phase 1 read error: ", ecode.message ()); |
|
|
|
|
|
|
|
if (ecode != boost::asio::error::operation_aborted) |
|
|
|
Terminate (); |
|
|
|
Terminate (); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
@ -215,6 +220,7 @@ namespace ntcp |
|
|
|
if (ecode) |
|
|
|
if (ecode) |
|
|
|
{ |
|
|
|
{ |
|
|
|
LogPrint ("Couldn't send Phase 2 message: ", ecode.message ()); |
|
|
|
LogPrint ("Couldn't send Phase 2 message: ", ecode.message ()); |
|
|
|
|
|
|
|
if (ecode != boost::asio::error::operation_aborted) |
|
|
|
Terminate (); |
|
|
|
Terminate (); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
@ -231,11 +237,14 @@ namespace ntcp |
|
|
|
if (ecode) |
|
|
|
if (ecode) |
|
|
|
{ |
|
|
|
{ |
|
|
|
LogPrint ("Phase 2 read error: ", ecode.message (), ". Wrong ident assumed"); |
|
|
|
LogPrint ("Phase 2 read error: ", ecode.message (), ". Wrong ident assumed"); |
|
|
|
|
|
|
|
if (ecode != boost::asio::error::operation_aborted) |
|
|
|
|
|
|
|
{ |
|
|
|
GetRemoteRouterInfo ().SetUnreachable (true); // this RouterInfo is not valid
|
|
|
|
GetRemoteRouterInfo ().SetUnreachable (true); // this RouterInfo is not valid
|
|
|
|
i2p::transports.ReuseDHKeysPair (m_DHKeysPair); |
|
|
|
i2p::transports.ReuseDHKeysPair (m_DHKeysPair); |
|
|
|
m_DHKeysPair = nullptr; |
|
|
|
m_DHKeysPair = nullptr; |
|
|
|
Terminate (); |
|
|
|
Terminate (); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
LogPrint ("Phase 2 received: ", bytes_transferred); |
|
|
|
LogPrint ("Phase 2 received: ", bytes_transferred); |
|
|
@ -291,6 +300,7 @@ namespace ntcp |
|
|
|
if (ecode) |
|
|
|
if (ecode) |
|
|
|
{ |
|
|
|
{ |
|
|
|
LogPrint ("Couldn't send Phase 3 message: ", ecode.message ()); |
|
|
|
LogPrint ("Couldn't send Phase 3 message: ", ecode.message ()); |
|
|
|
|
|
|
|
if (ecode != boost::asio::error::operation_aborted) |
|
|
|
Terminate (); |
|
|
|
Terminate (); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
@ -307,6 +317,7 @@ namespace ntcp |
|
|
|
if (ecode) |
|
|
|
if (ecode) |
|
|
|
{ |
|
|
|
{ |
|
|
|
LogPrint ("Phase 3 read error: ", ecode.message ()); |
|
|
|
LogPrint ("Phase 3 read error: ", ecode.message ()); |
|
|
|
|
|
|
|
if (ecode != boost::asio::error::operation_aborted) |
|
|
|
Terminate (); |
|
|
|
Terminate (); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
@ -356,6 +367,7 @@ namespace ntcp |
|
|
|
if (ecode) |
|
|
|
if (ecode) |
|
|
|
{ |
|
|
|
{ |
|
|
|
LogPrint ("Couldn't send Phase 4 message: ", ecode.message ()); |
|
|
|
LogPrint ("Couldn't send Phase 4 message: ", ecode.message ()); |
|
|
|
|
|
|
|
if (ecode != boost::asio::error::operation_aborted) |
|
|
|
Terminate (); |
|
|
|
Terminate (); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
@ -373,9 +385,12 @@ namespace ntcp |
|
|
|
if (ecode) |
|
|
|
if (ecode) |
|
|
|
{ |
|
|
|
{ |
|
|
|
LogPrint ("Phase 4 read error: ", ecode.message ()); |
|
|
|
LogPrint ("Phase 4 read error: ", ecode.message ()); |
|
|
|
|
|
|
|
if (ecode != boost::asio::error::operation_aborted) |
|
|
|
|
|
|
|
{ |
|
|
|
GetRemoteRouterInfo ().SetUnreachable (true); // this router doesn't like us
|
|
|
|
GetRemoteRouterInfo ().SetUnreachable (true); // this router doesn't like us
|
|
|
|
Terminate (); |
|
|
|
Terminate (); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
LogPrint ("Phase 4 received: ", bytes_transferred); |
|
|
|
LogPrint ("Phase 4 received: ", bytes_transferred); |
|
|
@ -418,6 +433,7 @@ namespace ntcp |
|
|
|
if (ecode) |
|
|
|
if (ecode) |
|
|
|
{ |
|
|
|
{ |
|
|
|
LogPrint ("Read error: ", ecode.message ()); |
|
|
|
LogPrint ("Read error: ", ecode.message ()); |
|
|
|
|
|
|
|
if (ecode != boost::asio::error::operation_aborted) |
|
|
|
Terminate (); |
|
|
|
Terminate (); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
@ -604,9 +620,12 @@ namespace ntcp |
|
|
|
if (ecode) |
|
|
|
if (ecode) |
|
|
|
{ |
|
|
|
{ |
|
|
|
LogPrint ("Connect error: ", ecode.message ()); |
|
|
|
LogPrint ("Connect error: ", ecode.message ()); |
|
|
|
|
|
|
|
if (ecode != boost::asio::error::operation_aborted) |
|
|
|
|
|
|
|
{ |
|
|
|
GetRemoteRouterInfo ().SetUnreachable (true); |
|
|
|
GetRemoteRouterInfo ().SetUnreachable (true); |
|
|
|
Terminate (); |
|
|
|
Terminate (); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
LogPrint ("Connected"); |
|
|
|
LogPrint ("Connected"); |
|
|
|