mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 08:00:38 +03:00
if NTCP failed, try to send through SSU
This commit is contained in:
parent
fb2a89cbea
commit
ff9f14d7a6
@ -56,11 +56,19 @@ namespace ntcp
|
|||||||
{
|
{
|
||||||
m_IsEstablished = false;
|
m_IsEstablished = false;
|
||||||
m_Socket.close ();
|
m_Socket.close ();
|
||||||
for (auto it :m_DelayedMessages)
|
|
||||||
delete it;
|
|
||||||
m_DelayedMessages.clear ();
|
|
||||||
// TODO: notify tunnels
|
|
||||||
i2p::transports.RemoveNTCPSession (this);
|
i2p::transports.RemoveNTCPSession (this);
|
||||||
|
int numDelayed = 0;
|
||||||
|
for (auto it :m_DelayedMessages)
|
||||||
|
{
|
||||||
|
// try to send them again
|
||||||
|
i2p::transports.SendMessage (m_RemoteRouterInfo.GetIdentHash (), it);
|
||||||
|
numDelayed++;
|
||||||
|
}
|
||||||
|
m_DelayedMessages.clear ();
|
||||||
|
if (numDelayed > 0)
|
||||||
|
LogPrint ("NTCP session ", numDelayed, " not sent");
|
||||||
|
// TODO: notify tunnels
|
||||||
|
|
||||||
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
|
||||||
|
@ -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…
Reference in New Issue
Block a user