Pārlūkot izejas kodu

Changed RPCClientPipeTransport Ping() timeout to 10 seconds
RPCClient Ping() now doesn't send anything if the connection fails
Reduced Profiler Logging for Ping() and CheckClient()

frogsoftware 11 mēneši atpakaļ
vecāks
revīzija
9b8aa3bfbc

+ 6 - 2
InABox.Client.RPC/RPCClient.cs

@@ -225,8 +225,12 @@ namespace InABox.Rpc
             {
                 if (!_transport.IsConnected())
                     _transport.Connect();
-                _transport.Send<RpcPingCommand, RpcPingParameters, RpcPingResult>(new RpcPingParameters());
-                return true;
+                if (_transport.IsConnected())
+                {
+                    _transport.Send<RpcPingCommand, RpcPingParameters, RpcPingResult>(new RpcPingParameters());
+                    return true;
+                }
+                return false;
             }
             catch (Exception)
             {

+ 1 - 1
InABox.Client.RPC/Transports/Pipe/RPCClientPipeTransport.cs

@@ -23,7 +23,7 @@ namespace InABox.Rpc
 
         public override bool Connect(CancellationToken ct = default)
         {
-            _pipe.ConnectAsync(ct).Wait();
+            _pipe.ConnectAsync(ct).Wait(10000, ct);
             return _pipe.IsConnected;
         }
 

+ 2 - 4
InABox.Core/Client/Client.cs

@@ -48,8 +48,7 @@ namespace InABox.Clients
 
         private static IClient CheckClient()
         {
-            using (new Profiler(true))
-                return ClientFactory.CreateClient<User>();
+            return ClientFactory.CreateClient<User>();
         }
 
         public static Dictionary<string, CoreTable> QueryMultiple(Dictionary<string, IQueryDef> queries)
@@ -265,8 +264,7 @@ namespace InABox.Clients
         {
             try
             {
-                using (new Profiler(true))
-                    return CheckClient().Ping();
+                return CheckClient().Ping();
             }
             catch (RequestException e)
             {