Use task pool for message dispatch again
@@ -171,13 +171,16 @@ namespace MiningCore.Stratum
}
}
- protected virtual async void OnReceive(StratumClient client, PooledArraySegment<byte> data)
+ protected virtual void OnReceive(StratumClient client, PooledArraySegment<byte> data)
+ {
+ // get off of LibUV event-loop-thread immediately
+ Task.Run(async () =>
+ {
+ using (data)
{
JsonRpcRequest request = null;
try
- {
- using (data)
{
// boot pre-connected clients
if (banManager?.IsBanned(client.RemoteEndpoint.Address) == true)
@@ -201,7 +204,6 @@ namespace MiningCore.Stratum
else
logger.Trace(() => $"[{LogCat}] [{client.ConnectionId}] Unable to deserialize request");
}
- }
catch (JsonReaderException jsonEx)
{
@@ -221,6 +223,8 @@ namespace MiningCore.Stratum
logger.Error(ex, () => $"[{LogCat}] [{client.ConnectionId}] Error processing request {request.Method} [{request.Id}]");
}
}
+ });
+ }
protected virtual void OnReceiveError(StratumClient client, Exception ex)
{
