/// <summary> /// Selects corresponding handler for given call and handles the call. /// </summary> private async Task InvokeCallHandler(CallSafeHandle call, string method) { try { IServerCallHandler callHandler; if (!callHandlers.TryGetValue(method, out callHandler)) { callHandler = new NoSuchMethodCallHandler(); } await callHandler.HandleCall(method, call, GetCompletionQueue()); } catch (Exception e) { Console.WriteLine("Exception while handling RPC: " + e); } }
/// <summary> /// Requests and handles single RPC call. /// </summary> internal void RunRpc() { AllowOneRpc(); try { var rpcInfo = newRpcQueue.Take(); //Console.WriteLine("Server received RPC " + rpcInfo.Method); IServerCallHandler callHandler; if (!callHandlers.TryGetValue(rpcInfo.Method, out callHandler)) { callHandler = new NoSuchMethodCallHandler(); } callHandler.StartCall(rpcInfo.Method, rpcInfo.Call, GetCompletionQueue()); } catch (Exception e) { Console.WriteLine("Exception while handling RPC: " + e); } }