handle sending errors

This commit is contained in:
orignal 2019-11-18 14:13:31 -05:00
parent 515c086099
commit 6cfe4fa580

View File

@ -1035,7 +1035,9 @@ namespace transport
if (ecode) if (ecode)
{ {
LogPrint (eLogWarning, "NTCP2: Couldn't send frame ", ecode.message ()); if (ecode != boost::asio::error::operation_aborted)
LogPrint (eLogWarning, "NTCP2: Couldn't send frame ", ecode.message ());
Terminate ();
} }
else else
{ {
@ -1260,7 +1262,10 @@ namespace transport
bool NTCP2Server::AddNTCP2Session (std::shared_ptr<NTCP2Session> session, bool incoming) bool NTCP2Server::AddNTCP2Session (std::shared_ptr<NTCP2Session> session, bool incoming)
{ {
if (!session || !session->GetRemoteIdentity ()) return false; if (!session) return false;
if (incoming)
m_PendingIncomingSessions.remove (session);
if (!session->GetRemoteIdentity ()) return false;
auto& ident = session->GetRemoteIdentity ()->GetIdentHash (); auto& ident = session->GetRemoteIdentity ()->GetIdentHash ();
auto it = m_NTCP2Sessions.find (ident); auto it = m_NTCP2Sessions.find (ident);
if (it != m_NTCP2Sessions.end ()) if (it != m_NTCP2Sessions.end ())
@ -1270,8 +1275,6 @@ 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;
} }