Browse Source

MiniServer,屏蔽执行 Shutdown 时的 SocketException。

dev
王厅 2 months ago
parent
commit
71940dbf63
  1. 18
      Apewer/Web/MiniServer.cs

18
Apewer/Web/MiniServer.cs

@ -144,7 +144,23 @@ namespace Apewer.Web
{
while (_socket != null)
{
var socket = _socket.Accept();
var socket = null as Socket;
try
{
socket = _socket.Accept();
}
catch
{
if (socket != null)
{
try { socket.Close(); } catch { }
try { socket.Disconnect(false); } catch { }
#if !NET20
try { socket.Dispose(); } catch { }
#endif
}
break;
}
if (socket != null) ThreadPool.QueueUserWorkItem(Process, socket);
}
}

Loading…
Cancel
Save