From 218925e191cb19ddc577f0526f9f691239d29fea Mon Sep 17 00:00:00 2001 From: Syrone Wong Date: Thu, 14 Dec 2017 09:54:31 +0800 Subject: [PATCH] Close connection if received zero bytes This might fix 500 Privoxy Internal Error: no-server-data --- shadowsocks-csharp/Controller/Service/Listener.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shadowsocks-csharp/Controller/Service/Listener.cs b/shadowsocks-csharp/Controller/Service/Listener.cs index 56222d7f..27f29d9d 100644 --- a/shadowsocks-csharp/Controller/Service/Listener.cs +++ b/shadowsocks-csharp/Controller/Service/Listener.cs @@ -202,6 +202,7 @@ namespace Shadowsocks.Controller try { int bytesRead = conn.EndReceive(ar); + if (bytesRead <= 0) goto Shutdown; foreach (IService service in _services) { if (service.Handle(buf, bytesRead, conn, null)) @@ -209,6 +210,7 @@ namespace Shadowsocks.Controller return; } } + Shutdown: // no service found for this if (conn.ProtocolType == ProtocolType.Tcp) {