kcp2k V1.37 [2023-07-31]

- fix: #47 KcpServer.Stop now clears connections so they aren't carried over to the next session
- fix: KcpPeer doesn't log 'received unreliable message while not authenticated' anymore.
This commit is contained in:
mischa 2023-07-31 18:10:23 +08:00
parent a9cbcf696e
commit e92e91dcfd
3 changed files with 19 additions and 4 deletions

View File

@ -1,3 +1,7 @@
V1.37 [2023-07-31]
- fix: #47 KcpServer.Stop now clears connections so they aren't carried over to the next session
- fix: KcpPeer doesn't log 'received unreliable message while not authenticated' anymore.
V1.36 [2023-06-08] V1.36 [2023-06-08]
- fix: #49 KcpPeer.RawInput message size check now considers cookie as well - fix: #49 KcpPeer.RawInput message size check now considers cookie as well
- kcp.cs cleanups - kcp.cs cleanups

View File

@ -6,6 +6,10 @@ namespace kcp2k
{ {
public static class Extensions public static class Extensions
{ {
// ArraySegment as HexString for convenience
public static string ToHexString(this ArraySegment<byte> segment) =>
BitConverter.ToString(segment.Array, segment.Offset, segment.Count);
// non-blocking UDP send. // non-blocking UDP send.
// allows for reuse when overwriting KcpServer/Client (i.e. for relays). // allows for reuse when overwriting KcpServer/Client (i.e. for relays).
// => wrapped with Poll to avoid WouldBlock allocating new SocketException. // => wrapped with Poll to avoid WouldBlock allocating new SocketException.

View File

@ -586,10 +586,17 @@ void OnRawInputUnreliable(ArraySegment<byte> message)
} }
else else
{ {
// invalid unreliable messages may be random internet noise. // it's common to receive unreliable messages before being
// show a warning, but don't disconnect. // authenticated, for example:
// otherwise attackers could disconnect someone with random noise. // - random internet noise
Log.Warning($"KcpPeer: received unreliable message while not authenticated."); // - game server may send an unreliable message after authenticating,
// and the unreliable message arrives on the client before the
// 'auth_ok' message. this can be avoided by sending a final
// 'ready' message after being authenticated, but this would
// add another 'round trip time' of latency to the handshake.
//
// it's best to simply ignore invalid unreliable messages here.
// Log.Info($"KcpPeer: received unreliable message while not authenticated.");
} }
} }