diff --git a/shadowsocks-csharp/Controller/ShadowsocksController.cs b/shadowsocks-csharp/Controller/ShadowsocksController.cs index b67081d5..982d6237 100755 --- a/shadowsocks-csharp/Controller/ShadowsocksController.cs +++ b/shadowsocks-csharp/Controller/ShadowsocksController.cs @@ -309,12 +309,12 @@ namespace Shadowsocks.Controller public void UpdateInboundCounter(long n) { - inboundCounter += n; + Interlocked.Add(ref inboundCounter, n); } public void UpdateOutboundCounter(long n) { - outboundCounter += n; + Interlocked.Add(ref outboundCounter, n); } protected void Reload()