Beispiel #1
0
        public void StartCall(string methodName, CallSafeHandle call, CompletionQueueSafeHandle cq)
        {
            var asyncCall = new AsyncCall <TResponse, TRequest>(
                method.ResponseMarshaller.Serializer,
                method.RequestMarshaller.Deserializer);

            asyncCall.InitializeServer(call);

            var responseObserver = new ServerStreamingOutputObserver <TResponse, TRequest>(asyncCall);
            var requestObserver  = handler(responseObserver);
            var finishedTask     = asyncCall.ServerSideStreamingRequestCallAsync(requestObserver);

            finishedTask.Wait();
        }
Beispiel #2
0
        public void StartCall(string methodName, CallSafeHandle call, CompletionQueueSafeHandle cq)
        {
            // We don't care about the payload type here.
            AsyncCall <byte[], byte[]> asyncCall = new AsyncCall <byte[], byte[]>(
                (payload) => payload, (payload) => payload);


            asyncCall.InitializeServer(call);

            var finishedTask = asyncCall.ServerSideStreamingRequestCallAsync(new NullObserver <byte[]>());

            // TODO: this makes the call finish before all reads can be done which causes trouble
            // in AsyncCall.HandleReadFinished callback. Revisit this.
            asyncCall.SendStatusFromServerAsync(new Status(StatusCode.Unimplemented, "No such method.")).Wait();

            finishedTask.Wait();
        }