From e30981141c217926e80fc77b065e1a69bcefe367 Mon Sep 17 00:00:00 2001 From: Richard Fox Date: Tue, 23 Apr 2024 02:36:59 -0700 Subject: [PATCH 1/2] feat(logging): add remote endpoint to constructor logging --- LiteNetLib/NetPeer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LiteNetLib/NetPeer.cs b/LiteNetLib/NetPeer.cs index 5cd95639..16e5fd66 100644 --- a/LiteNetLib/NetPeer.cs +++ b/LiteNetLib/NetPeer.cs @@ -402,7 +402,7 @@ internal NetPeer(NetManager netManager, IPEndPoint remoteEndPoint, int id, byte //Send request NetManager.SendRaw(_connectRequestPacket, this); - NetDebug.Write(NetLogLevel.Trace, $"[CC] ConnectId: {_connectTime}, ConnectNum: {connectNum}"); + NetDebug.Write(NetLogLevel.Trace, $"[CC] ConnectId: {_connectTime}, ConnectNum: {connectNum}, Endpoint: {remoteEndPoint}"); } //"Accept" incoming constructor @@ -422,7 +422,7 @@ internal NetPeer(NetManager netManager, ConnectionRequest request, int id) //Send NetManager.SendRaw(_connectAcceptPacket, this); - NetDebug.Write(NetLogLevel.Trace, $"[CC] ConnectId: {_connectTime}"); + NetDebug.Write(NetLogLevel.Trace, $"[CC] ConnectId: {_connectTime}, Endpoint: {request.RemoteEndPoint}"); } //Reject From ab90522babeed953a92eea8109b8f25f3854e6ba Mon Sep 17 00:00:00 2001 From: Richard Fox Date: Tue, 23 Apr 2024 02:37:28 -0700 Subject: [PATCH 2/2] feat(logging): log connection request packet sending --- LiteNetLib/NetPeer.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/LiteNetLib/NetPeer.cs b/LiteNetLib/NetPeer.cs index 16e5fd66..251c6a96 100644 --- a/LiteNetLib/NetPeer.cs +++ b/LiteNetLib/NetPeer.cs @@ -1342,10 +1342,12 @@ internal void Update(int deltaTime) _connectAttempts++; if (_connectAttempts > NetManager.MaxConnectAttempts) { + NetDebug.Write($"[Update] Connected ID: {_connectTime} failed to respond to a connection request after {_connectAttempts} attempts."); NetManager.DisconnectPeerForce(this, DisconnectReason.ConnectionFailed, 0, null); return; } + NetDebug.Write($"[Update] Connected ID: {_connectTime} Sending another connection request, this is attempt {_connectAttempts}."); //else send connect again NetManager.SendRaw(_connectRequestPacket, this); }