Beispiel #1
0
        public void RegisterRequestCallCompletion(RequestCallContextSafeHandle ctx, RequestCallCompletionDelegate callback)
        {
            // TODO(jtattermusch): get rid of new delegate creation here
            OpCompletionDelegate opCallback = ((success) => HandleRequestCallCompletion(success, ctx, callback));

            Register(ctx.Handle, opCallback);
        }
        public RequestCallContextSafeHandle RegisterRequestCallCompletion(RequestCallCompletionDelegate callback)
        {
            var ctx = requestCallContextFactory();

            ctx.CompletionCallback = callback;
            Register(ctx.Handle, ctx);
            return(ctx);
        }
Beispiel #3
0
 public void RequestCall(RequestCallCompletionDelegate callback, CompletionQueueSafeHandle completionQueue)
 {
     using (completionQueue.NewScope())
     {
         var ctx = completionQueue.CompletionRegistry.RegisterRequestCallCompletion(callback);
         Native.grpcsharp_server_request_call(this, completionQueue, ctx).CheckOk();
     }
 }
 void IOpCompletionCallback.OnComplete(bool success)
 {
     try
     {
         CompletionCallback(success, this);
     }
     catch (Exception e)
     {
         Logger.Error(e, "Exception occured while invoking request call completion delegate.");
     }
     finally
     {
         CompletionCallback = null;
         Recycle();
     }
 }
Beispiel #5
0
 public void RegisterRequestCallCompletion(RequestCallContextSafeHandle ctx, RequestCallCompletionDelegate callback)
 {
     ctx.CompletionCallback = callback;
     Register(ctx.Handle, ctx);
 }
Beispiel #6
0
 public void RequestCall(RequestCallCompletionDelegate callback, CompletionQueueSafeHandle completionQueue)
 {
     using (completionQueue.NewScope())
     {
         var ctx = RequestCallContextSafeHandle.Create();
         completionQueue.CompletionRegistry.RegisterRequestCallCompletion(ctx, callback);
         Native.grpcsharp_server_request_call(this, completionQueue, ctx).CheckOk();
     }
 }
Beispiel #7
0
        public void RegisterRequestCallCompletion(RequestCallContextSafeHandle ctx, RequestCallCompletionDelegate callback)
        {
            OpCompletionDelegate opCallback = ((success) => HandleRequestCallCompletion(success, ctx, callback));

            Register(ctx.Handle, opCallback);
        }
Beispiel #8
0
 private static void HandleRequestCallCompletion(bool success, RequestCallContextSafeHandle ctx, RequestCallCompletionDelegate callback)
 {
     try
     {
         callback(success, ctx);
     }
     catch (Exception e)
     {
         Logger.Error(e, "Exception occured while invoking request call completion delegate.");
     }
     finally
     {
         if (ctx != null)
         {
             ctx.Dispose();
         }
     }
 }
Beispiel #9
0
 public void RegisterRequestCallCompletion(RequestCallContextSafeHandle ctx, RequestCallCompletionDelegate callback)
 {
     OpCompletionDelegate opCallback = ((success) => HandleRequestCallCompletion(success, ctx, callback));
     Register(ctx.Handle, opCallback);
 }
Beispiel #10
0
 private static void HandleRequestCallCompletion(bool success, RequestCallContextSafeHandle ctx, RequestCallCompletionDelegate callback)
 {
     try
     {
         callback(success, ctx);
     }
     catch (Exception e)
     {
         Logger.Error(e, "Exception occured while invoking request call completion delegate.");
     }
     finally
     {
         if (ctx != null)
         {
             ctx.Dispose();
         }
     }
 }