using System.Net;
using System.Net.Sockets;
using System.Threading;
+using System.Threading.Channels;
using System.Threading.Tasks;
using Microsoft.Extensions.ObjectPool;
using Serilog;
Logger.Fatal("Hazel read 0 bytes from UDP server socket.");
continue;
}
+ await ProcessData(data);
}
catch (SocketException)
{
// Socket was disposed, don't care.
return;
}
-
- await ProcessData(data);
+ catch (ChannelClosedException)
+ {
+ // Client closed, pretend it didn't happen
+ continue;
+ }
}
}
catch (Exception e)
}
// Write to client.
- await client.Pipeline.Writer.WriteAsync(data.Buffer);
+ client.Pipeline.Writer.TryWrite(data.Buffer);
}
/// <summary>