mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-31 04:44:13 +00:00
Merge pull request #1958 from Vort/session_log
improve transport session logging
This commit is contained in:
commit
411063e3b5
@ -375,7 +375,16 @@ namespace transport
|
|||||||
m_Server.RemoveNTCP2Session (shared_from_this ());
|
m_Server.RemoveNTCP2Session (shared_from_this ());
|
||||||
m_SendQueue.clear ();
|
m_SendQueue.clear ();
|
||||||
m_SendQueueSize = 0;
|
m_SendQueueSize = 0;
|
||||||
LogPrint (eLogDebug, "NTCP2: Session terminated");
|
auto remoteIdentity = GetRemoteIdentity ();
|
||||||
|
if (remoteIdentity)
|
||||||
|
{
|
||||||
|
LogPrint (eLogDebug, "NTCP2: Session with ", GetRemoteEndpoint (),
|
||||||
|
" (", i2p::data::GetIdentHashAbbreviation (GetRemoteIdentity ()->GetIdentHash ()), ") terminated");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LogPrint (eLogDebug, "NTCP2: Session with ", GetRemoteEndpoint (), " terminated");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -691,11 +700,13 @@ namespace transport
|
|||||||
i2p::data::RouterInfo ri (buf.data () + 4, size - 1); // 1 byte block type + 2 bytes size + 1 byte flag
|
i2p::data::RouterInfo ri (buf.data () + 4, size - 1); // 1 byte block type + 2 bytes size + 1 byte flag
|
||||||
if (ri.IsUnreachable ())
|
if (ri.IsUnreachable ())
|
||||||
{
|
{
|
||||||
LogPrint (eLogError, "NTCP2: Signature verification failed in SessionConfirmed");
|
LogPrint (eLogError, "NTCP2: RouterInfo verification failed in SessionConfirmed from ", GetRemoteEndpoint ());
|
||||||
SendTerminationAndTerminate (eNTCP2RouterInfoSignatureVerificationFail);
|
SendTerminationAndTerminate (eNTCP2RouterInfoSignatureVerificationFail);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto ts = i2p::util::GetMillisecondsSinceEpoch ();
|
LogPrint(eLogDebug, "NTCP2: SessionConfirmed from ", GetRemoteEndpoint (),
|
||||||
|
" (", i2p::data::GetIdentHashAbbreviation (ri.GetIdentHash ()), ")");
|
||||||
|
auto ts = i2p::util::GetMillisecondsSinceEpoch ();
|
||||||
if (ts > ri.GetTimestamp () + i2p::data::NETDB_MIN_EXPIRATION_TIMEOUT*1000LL) // 90 minutes
|
if (ts > ri.GetTimestamp () + i2p::data::NETDB_MIN_EXPIRATION_TIMEOUT*1000LL) // 90 minutes
|
||||||
{
|
{
|
||||||
LogPrint (eLogError, "NTCP2: RouterInfo is too old in SessionConfirmed for ", (ts - ri.GetTimestamp ())/1000LL, " seconds");
|
LogPrint (eLogError, "NTCP2: RouterInfo is too old in SessionConfirmed for ", (ts - ri.GetTimestamp ())/1000LL, " seconds");
|
||||||
@ -1409,7 +1420,8 @@ namespace transport
|
|||||||
LogPrint (eLogError, "NTCP2: Can't connect to unspecified address");
|
LogPrint (eLogError, "NTCP2: Can't connect to unspecified address");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LogPrint (eLogDebug, "NTCP2: Connecting to ", conn->GetRemoteEndpoint ());
|
LogPrint (eLogDebug, "NTCP2: Connecting to ", conn->GetRemoteEndpoint (),
|
||||||
|
" (", i2p::data::GetIdentHashAbbreviation (conn->GetRemoteIdentity ()->GetIdentHash ()), ")");
|
||||||
GetService ().post([this, conn]()
|
GetService ().post([this, conn]()
|
||||||
{
|
{
|
||||||
if (this->AddNTCP2Session (conn))
|
if (this->AddNTCP2Session (conn))
|
||||||
@ -1465,7 +1477,8 @@ namespace transport
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LogPrint (eLogDebug, "NTCP2: Connected to ", conn->GetRemoteEndpoint ());
|
LogPrint (eLogDebug, "NTCP2: Connected to ", conn->GetRemoteEndpoint (),
|
||||||
|
" (", i2p::data::GetIdentHashAbbreviation (conn->GetRemoteIdentity ()->GetIdentHash ()), ")");
|
||||||
conn->ClientLogin ();
|
conn->ClientLogin ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,6 +114,8 @@ namespace transport
|
|||||||
{
|
{
|
||||||
if (m_State == eSSU2SessionStateUnknown || m_State == eSSU2SessionStateTokenReceived)
|
if (m_State == eSSU2SessionStateUnknown || m_State == eSSU2SessionStateTokenReceived)
|
||||||
{
|
{
|
||||||
|
LogPrint(eLogDebug, "SSU2: Connecting to ", GetRemoteEndpoint (),
|
||||||
|
" (", i2p::data::GetIdentHashAbbreviation (GetRemoteIdentity ()->GetIdentHash ()), ")");
|
||||||
ScheduleConnectTimer ();
|
ScheduleConnectTimer ();
|
||||||
auto token = m_Server.FindOutgoingToken (m_RemoteEndpoint);
|
auto token = m_Server.FindOutgoingToken (m_RemoteEndpoint);
|
||||||
if (token)
|
if (token)
|
||||||
@ -269,7 +271,16 @@ namespace transport
|
|||||||
m_ReceivedI2NPMsgIDs.clear ();
|
m_ReceivedI2NPMsgIDs.clear ();
|
||||||
m_Server.RemoveSession (m_SourceConnID);
|
m_Server.RemoveSession (m_SourceConnID);
|
||||||
transports.PeerDisconnected (shared_from_this ());
|
transports.PeerDisconnected (shared_from_this ());
|
||||||
LogPrint (eLogDebug, "SSU2: Session terminated");
|
auto remoteIdentity = GetRemoteIdentity ();
|
||||||
|
if (remoteIdentity)
|
||||||
|
{
|
||||||
|
LogPrint (eLogDebug, "SSU2: Session with ", GetRemoteEndpoint (),
|
||||||
|
" (", i2p::data::GetIdentHashAbbreviation (GetRemoteIdentity ()->GetIdentHash ()), ") terminated");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LogPrint (eLogDebug, "SSU2: Session with ", GetRemoteEndpoint (), " terminated");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -298,6 +309,8 @@ namespace transport
|
|||||||
m_OnEstablished ();
|
m_OnEstablished ();
|
||||||
m_OnEstablished = nullptr;
|
m_OnEstablished = nullptr;
|
||||||
}
|
}
|
||||||
|
LogPrint(eLogDebug, "SSU2: Session with ", GetRemoteEndpoint (),
|
||||||
|
" (", i2p::data::GetIdentHashAbbreviation (GetRemoteIdentity ()->GetIdentHash ()), ") established");
|
||||||
}
|
}
|
||||||
|
|
||||||
void SSU2Session::Done ()
|
void SSU2Session::Done ()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user