Esempio n. 1
0
        /// <summary>
        /// Handles the native callback.
        /// </summary>
        private void HandleNewServerRpc(bool success, BatchContextSafeHandle ctx)
        {
            Task.Run(() => AllowOneRpc());

            if (success)
            {
                ServerRpcNew newRpc = ctx.GetServerRpcNew(this);

                // after server shutdown, the callback returns with null call
                if (!newRpc.Call.IsInvalid)
                {
                    HandleCallAsync(newRpc);  // we don't need to await.
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Handles the native callback.
        /// </summary>
        private void HandleNewServerRpc(bool success, BatchContextSafeHandle ctx)
        {
            if (success)
            {
                ServerRpcNew newRpc = ctx.GetServerRpcNew(this);

                // after server shutdown, the callback returns with null call
                if (!newRpc.Call.IsInvalid)
                {
                    Task.Run(async() => await HandleCallAsync(newRpc)).ConfigureAwait(false);
                }
            }

            AllowOneRpc();
        }
Esempio n. 3
0
 /// <summary>
 /// Selects corresponding handler for given call and handles the call.
 /// </summary>
 private async Task HandleCallAsync(ServerRpcNew newRpc)
 {
     try
     {
         IServerCallHandler callHandler;
         if (!callHandlers.TryGetValue(newRpc.Method, out callHandler))
         {
             callHandler = NoSuchMethodCallHandler.Instance;
         }
         await callHandler.HandleCall(newRpc, environment).ConfigureAwait(false);
     }
     catch (Exception e)
     {
         Logger.Warning(e, "Exception while handling RPC.");
     }
 }
Esempio n. 4
0
 /// <summary>
 /// Selects corresponding handler for given call and handles the call.
 /// </summary>
 private async Task HandleCallAsync(ServerRpcNew newRpc, CompletionQueueSafeHandle cq)
 {
     try
     {
         IServerCallHandler callHandler;
         if (!callHandlers.TryGetValue(newRpc.Method, out callHandler))
         {
             callHandler = UnimplementedMethodCallHandler.Instance;
         }
         await callHandler.HandleCall(newRpc, cq).ConfigureAwait(false);
     }
     catch (Exception e)
     {
         Logger.Warning(e, "Exception while handling RPC.");
     }
 }