Skip to content

Commit

Permalink
Move packet retransmit to packetlog and reduce to debug
Browse files Browse the repository at this point in the history
  • Loading branch information
Mag-nus committed Feb 13, 2024
1 parent 39592f2 commit ce484fc
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions Source/ACE.Server/Network/NetworkSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -660,20 +660,23 @@ private bool Retransmit(uint sequence)
return true;
}

if (cachedPackets.Count > 0)
if (packetLog.IsDebugEnabled)
{
// This is to catch a race condition between .Count and .Min() and .Max()
try
{
log.Error($"Session {session.Network?.ClientId}\\{session.EndPointC2S} ({session.Account}:{session.Player?.Name}) retransmit requested packet {sequence} not in cache. Cache range {cachedPackets.Keys.Min()} - {cachedPackets.Keys.Max()}.");
}
catch
if (cachedPackets.Count > 0)
{
log.Error($"Session {session.Network?.ClientId}\\{session.EndPointC2S} ({session.Account}:{session.Player?.Name}) retransmit requested packet {sequence} not in cache. Cache is empty. Race condition threw exception.");
// This is to catch a race condition between .Count and .Min() and .Max()
try
{
packetLog.DebugFormat("Session {0}\\{1} ({2}:{3}) retransmit requested packet {4} not in cache. Cache range {5} - {6}.", session.Network?.ClientId, session.EndPointC2S, session.Account, session.Player?.Name, sequence, cachedPackets.Keys.Min(), cachedPackets.Keys.Max());
}
catch
{
packetLog.DebugFormat("Session {0}\\{1} ({2}:{3}) retransmit requested packet {4} not in cache. Cache is empty. Race condition threw exception.", session.Network?.ClientId, session.EndPointC2S, session.Account, session.Player?.Name, sequence);
}
}
else
packetLog.DebugFormat("Session {0}\\{1} ({2}:{3}) retransmit requested packet {4} not in cache. Cache is empty.", session.Network?.ClientId, session.EndPointC2S, session.Account, session.Player?.Name, sequence);
}
else
log.Error($"Session {session.Network?.ClientId}\\{session.EndPointC2S} ({session.Account}:{session.Player?.Name}) retransmit requested packet {sequence} not in cache. Cache is empty.");

return false;
}
Expand Down

0 comments on commit ce484fc

Please sign in to comment.