diff --git a/shadowsocks-csharp/Controller/Service/AvailabilityStatistics.cs b/shadowsocks-csharp/Controller/Service/AvailabilityStatistics.cs index 532ec466..1c69298d 100644 --- a/shadowsocks-csharp/Controller/Service/AvailabilityStatistics.cs +++ b/shadowsocks-csharp/Controller/Service/AvailabilityStatistics.cs @@ -96,15 +96,22 @@ namespace Shadowsocks.Controller foreach (var timestamp in Enumerable.Range(0, Repeat).Select(_ => DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))) { //ICMP echo. we can also set options and special bytes - var reply = await ping.SendTaskAsync(server.server, Timeout); - ret.Add(new List> + try { - new KeyValuePair("Timestamp", timestamp), - new KeyValuePair("Server", server.FriendlyName()), - new KeyValuePair("Status", reply?.Status.ToString()), - new KeyValuePair("RoundtripTime", reply?.RoundtripTime.ToString()) - //new KeyValuePair("data", reply.Buffer.ToString()); // The data of reply - }); + var reply = await ping.SendTaskAsync(server.server, Timeout); + ret.Add(new List> + { + new KeyValuePair("Timestamp", timestamp), + new KeyValuePair("Server", server.FriendlyName()), + new KeyValuePair("Status", reply?.Status.ToString()), + new KeyValuePair("RoundtripTime", reply?.RoundtripTime.ToString()) + //new KeyValuePair("data", reply.Buffer.ToString()); // The data of reply + }); + } + catch (PingException e) + { + Logging.LogUsefulException(e); + } } return ret; }