From 1ecd7daac8b88c05a6c9cb02f92e2d4152046e82 Mon Sep 17 00:00:00 2001 From: clowwindy Date: Sun, 9 Nov 2014 19:16:02 +0800 Subject: [PATCH] add lock for Close() --- shadowsocks-csharp/Controller/Local.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/shadowsocks-csharp/Controller/Local.cs b/shadowsocks-csharp/Controller/Local.cs index 7bd0fb98..924cfbad 100755 --- a/shadowsocks-csharp/Controller/Local.cs +++ b/shadowsocks-csharp/Controller/Local.cs @@ -144,11 +144,14 @@ namespace Shadowsocks.Controller public void Close() { - if (closed) + lock (this) { - return; + if (closed) + { + return; + } + closed = true; } - closed = true; if (connection != null) { try