Ignore errors when try to close already closed WebSockets

This commit is contained in:
Stefano Merotta 2024-09-30 00:10:50 +02:00
parent 7362062556
commit 9491304b01

View file

@ -327,11 +327,18 @@ namespace Server.Network.Sockets
}
public void Close()
{
try
{
const byte header1 = 0b1000_0000 | (byte)OpCode.Close;
Socket.Send([header1, 0]);
Socket.Close();
}
catch
{
/* ignore already closed sockets */
}
}
private enum OpCode : byte
{