mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-27 21:34:17 +00:00
remove incoming session from pending list when established
This commit is contained in:
parent
03a861745b
commit
d6b1d0d4fb
@ -719,7 +719,7 @@ namespace transport
|
|||||||
// ready to communicate
|
// ready to communicate
|
||||||
auto existing = i2p::data::netdb.FindRouter (ri.GetRouterIdentity ()->GetIdentHash ()); // check if exists already
|
auto existing = i2p::data::netdb.FindRouter (ri.GetRouterIdentity ()->GetIdentHash ()); // check if exists already
|
||||||
SetRemoteIdentity (existing ? existing->GetRouterIdentity () : ri.GetRouterIdentity ());
|
SetRemoteIdentity (existing ? existing->GetRouterIdentity () : ri.GetRouterIdentity ());
|
||||||
m_Server.AddNTCP2Session (shared_from_this ());
|
m_Server.AddNTCP2Session (shared_from_this (), true);
|
||||||
Established ();
|
Established ();
|
||||||
ReceiveLength ();
|
ReceiveLength ();
|
||||||
}
|
}
|
||||||
@ -1258,7 +1258,7 @@ namespace transport
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NTCP2Server::AddNTCP2Session (std::shared_ptr<NTCP2Session> session)
|
bool NTCP2Server::AddNTCP2Session (std::shared_ptr<NTCP2Session> session, bool incoming)
|
||||||
{
|
{
|
||||||
if (!session || !session->GetRemoteIdentity ()) return false;
|
if (!session || !session->GetRemoteIdentity ()) return false;
|
||||||
auto& ident = session->GetRemoteIdentity ()->GetIdentHash ();
|
auto& ident = session->GetRemoteIdentity ()->GetIdentHash ();
|
||||||
@ -1270,6 +1270,8 @@ namespace transport
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
m_NTCP2Sessions.insert (std::make_pair (ident, session));
|
m_NTCP2Sessions.insert (std::make_pair (ident, session));
|
||||||
|
if (incoming)
|
||||||
|
m_PendingIncomingSessions.remove (session);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ namespace transport
|
|||||||
void Start ();
|
void Start ();
|
||||||
void Stop ();
|
void Stop ();
|
||||||
|
|
||||||
bool AddNTCP2Session (std::shared_ptr<NTCP2Session> session);
|
bool AddNTCP2Session (std::shared_ptr<NTCP2Session> session, bool incoming = false);
|
||||||
void RemoveNTCP2Session (std::shared_ptr<NTCP2Session> session);
|
void RemoveNTCP2Session (std::shared_ptr<NTCP2Session> session);
|
||||||
std::shared_ptr<NTCP2Session> FindNTCP2Session (const i2p::data::IdentHash& ident);
|
std::shared_ptr<NTCP2Session> FindNTCP2Session (const i2p::data::IdentHash& ident);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user