Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection request logging #2

Merged
merged 2 commits into from
Apr 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions LiteNetLib/NetPeer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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);
}
Expand Down
Loading