Skip to content

Commit

Permalink
Catch TLS exceptions in server clients loop
Browse files Browse the repository at this point in the history
  • Loading branch information
Extremelyd1 committed Feb 14, 2025
1 parent 4690d8e commit 8e383dc
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion HKMP/Networking/Server/DtlsServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,15 @@ private void ClientReceiveLoop(DtlsServerClient dtlsServerClient, CancellationTo
while (!cancellationToken.IsCancellationRequested) {
var buffer = new byte[dtlsTransport.GetReceiveLimit()];

var numReceived = dtlsTransport.Receive(buffer, 0, dtlsTransport.GetReceiveLimit(), 5);
int numReceived;

try {
numReceived = dtlsTransport.Receive(buffer, 0, dtlsTransport.GetReceiveLimit(), 5);
} catch (TlsFatalAlert alert) {
Logger.Debug($"DtlsServerClient receive call TLS fatal alert: {alert.Message}");
continue;
}

if (numReceived <= 0) {
continue;
}
Expand Down

0 comments on commit 8e383dc

Please sign in to comment.