Skip to content

Commit

Permalink
Merge pull request #1568 from wongsyrone/patch-1
Browse files Browse the repository at this point in the history
Close connection if received zero bytes
  • Loading branch information
celeron533 authored Dec 15, 2017
2 parents 0c877a7 + 218925e commit f7cd239
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions shadowsocks-csharp/Controller/Service/Listener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,15 @@ private void ReceiveCallback(IAsyncResult ar)
try
{
int bytesRead = conn.EndReceive(ar);
if (bytesRead <= 0) goto Shutdown;
foreach (IService service in _services)
{
if (service.Handle(buf, bytesRead, conn, null))
{
return;
}
}
Shutdown:
// no service found for this
if (conn.ProtocolType == ProtocolType.Tcp)
{
Expand Down

0 comments on commit f7cd239

Please sign in to comment.