From 12ba488c7bac56753f575c86e6c7fd64d8f171bc Mon Sep 17 00:00:00 2001 From: Gang Zhuo Date: Tue, 5 Jan 2016 21:42:57 -0500 Subject: [PATCH] atomic operations to increase traffic statistics --- shadowsocks-csharp/Controller/ShadowsocksController.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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()