Browse Source

if NTCP failed, try to send through SSU

pull/59/head
orignal 11 years ago
parent
commit
ff9f14d7a6
  1. 13
      NTCPSession.cpp
  2. 2
      Transports.cpp

13
NTCPSession.cpp

@ -56,11 +56,19 @@ namespace ntcp
{ {
m_IsEstablished = false; m_IsEstablished = false;
m_Socket.close (); m_Socket.close ();
i2p::transports.RemoveNTCPSession (this);
int numDelayed = 0;
for (auto it :m_DelayedMessages) for (auto it :m_DelayedMessages)
delete it; {
// try to send them again
i2p::transports.SendMessage (m_RemoteRouterInfo.GetIdentHash (), it);
numDelayed++;
}
m_DelayedMessages.clear (); m_DelayedMessages.clear ();
if (numDelayed > 0)
LogPrint ("NTCP session ", numDelayed, " not sent");
// TODO: notify tunnels // TODO: notify tunnels
i2p::transports.RemoveNTCPSession (this);
delete this; delete this;
LogPrint ("NTCP session terminated"); LogPrint ("NTCP session terminated");
} }
@ -327,6 +335,7 @@ namespace ntcp
if (ecode) if (ecode)
{ {
LogPrint ("Phase 4 read error: ", ecode.message ()); LogPrint ("Phase 4 read error: ", ecode.message ());
GetRemoteRouterInfo ().SetUnreachable (true); // this router doesn't like us
Terminate (); Terminate ();
} }
else else

2
Transports.cpp

@ -239,7 +239,7 @@ namespace i2p
// existing session not found. create new // existing session not found. create new
// try NTCP first // try NTCP first
auto address = r->GetNTCPAddress (); auto address = r->GetNTCPAddress ();
if (address) if (address && !r->IsUnreachable ())
{ {
auto s = new i2p::ntcp::NTCPClient (m_Service, address->host, address->port, *r); auto s = new i2p::ntcp::NTCPClient (m_Service, address->host, address->port, *r);
AddNTCPSession (s); AddNTCPSession (s);

Loading…
Cancel
Save