Made connection termination safer
@@ -116,7 +116,10 @@ namespace MiningCore.JsonRpc
{
logger.Debug(() => $"[{ConnectionId}] Last subscriber disconnected from receiver stream");
+ upstream.Shutdown((tcp, ex) =>
+ {
upstream.Dispose();
+ });
}
});
});
@@ -143,6 +146,7 @@ namespace MiningCore.JsonRpc
try
{
+ if(!upstream.IsClosing)
upstream.QueueWrite(Encoding.UTF8.GetBytes(json));
}
catch (ObjectDisposedException)
@@ -158,6 +162,7 @@ namespace MiningCore.JsonRpc
try
{
+ if (!upstream.IsClosing)
upstream.QueueWrite(Encoding.UTF8.GetBytes(json));
}
catch (ObjectDisposedException)
