From 4325b7f6f9d706f8893feb32efbc9c36a60876d1 Mon Sep 17 00:00:00 2001 From: Gang Zhuo Date: Wed, 2 Mar 2016 21:00:57 -0500 Subject: [PATCH 1/2] fix https://github.com/shadowsocks/shadowsocks-windows/issues/466 --- .../Controller/Service/AvailabilityStatistics.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/shadowsocks-csharp/Controller/Service/AvailabilityStatistics.cs b/shadowsocks-csharp/Controller/Service/AvailabilityStatistics.cs index 790f5d1b..af039b18 100644 --- a/shadowsocks-csharp/Controller/Service/AvailabilityStatistics.cs +++ b/shadowsocks-csharp/Controller/Service/AvailabilityStatistics.cs @@ -196,7 +196,12 @@ namespace Shadowsocks.Controller _inboundSpeedRecords.TryGetValue(id, out inboundSpeedRecords); _outboundSpeedRecords.TryGetValue(id, out outboundSpeedRecords); _latencyRecords.TryGetValue(id, out latencyRecords); - records.Add(id, new StatisticsRecord(id, inboundSpeedRecords, outboundSpeedRecords, latencyRecords)); + StatisticsRecord record = new StatisticsRecord(id, inboundSpeedRecords, outboundSpeedRecords, latencyRecords); + /* duplicate server identifier */ + if (records.ContainsKey(id)) + records[id] = record; + else + records.Add(id, record); } if (Config.Ping) From 3da00178dec3a01e1a5fb8163b9cccc8825c58e8 Mon Sep 17 00:00:00 2001 From: Gang Zhuo Date: Wed, 2 Mar 2016 21:15:25 -0500 Subject: [PATCH 2/2] better way to kill privoxy --- shadowsocks-csharp/Controller/Service/PolipoRunner.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/shadowsocks-csharp/Controller/Service/PolipoRunner.cs b/shadowsocks-csharp/Controller/Service/PolipoRunner.cs index f824c2e5..1c0efcdd 100644 --- a/shadowsocks-csharp/Controller/Service/PolipoRunner.cs +++ b/shadowsocks-csharp/Controller/Service/PolipoRunner.cs @@ -49,8 +49,13 @@ namespace Shadowsocks.Controller { try { - p.Kill(); - p.WaitForExit(); + p.CloseMainWindow(); + p.WaitForExit(100); + if (!p.HasExited) + { + p.Kill(); + p.WaitForExit(); + } } catch (Exception e) {