diff --git a/shadowsocks-csharp/Proxy/Handler.cs b/shadowsocks-csharp/Proxy/Handler.cs index 12f27d5d11..b601f2f704 100644 --- a/shadowsocks-csharp/Proxy/Handler.cs +++ b/shadowsocks-csharp/Proxy/Handler.cs @@ -1615,7 +1615,19 @@ private void PipeConnectionReceiveCallback(IAsyncResult ar) var send_len = RemoteSend(connetionRecvBuffer, bytesRead); if (!(send_len == 0 && bytesRead > 0)) { - doConnectionRecv(); + Task.Run(() => + { + try + { + doConnectionRecv(); + } + catch (Exception ex) + { + local_error = true; + LogException(ex); + Close(); + } + }); } } else