public Task WriteStatusAsync(Status status, Metadata trailers) { var taskSource = new AsyncCompletionTaskSource <object>(); call.StartSendStatusFromServer(status, trailers, taskSource.CompletionDelegate); return(taskSource.Task); }
public void OnCompleted() { var taskSource = new AsyncCompletionTaskSource(); call.StartSendStatusFromServer(new Status(StatusCode.OK, ""), taskSource.CompletionDelegate); // TODO: how bad is the Wait here? taskSource.Task.Wait(); }
public void StartCall(string methodName, CallSafeHandle call, CompletionQueueSafeHandle cq) { // We don't care about the payload type here. var asyncCall = new AsyncCallServer <byte[], byte[]>( (payload) => payload, (payload) => payload); asyncCall.Initialize(call); var finishedTask = asyncCall.ServerSideCallAsync(new NullObserver <byte[]>()); // TODO: check result of the completion status. asyncCall.StartSendStatusFromServer(new Status(StatusCode.Unimplemented, "No such method."), new AsyncCompletionDelegate((error) => { })); finishedTask.Wait(); }