public TaskFailedException(string message, Task baseTask) : base( String.Format("{0}{1}", message, baseTask != null ? " <-> " + baseTask.TryGetException().Message : String.Empty)) { }
/// <summary> /// After sending, we check if the write was successful or if it was a fire-and-forget. /// </summary> /// <param name="sendTask">The task of the send operation.</param> /// <param name="tcsResponse"></param> /// <param name="isFireAndForget">True, if we don't expect a response message.</param> /// <param name="channel"></param> private async Task AfterSendAsync(Task sendTask, TaskCompletionSource<Message.Message> tcsResponse, bool isFireAndForget, IClientChannel channel) { // TODO use for UDP connections, too await sendTask; if (sendTask.IsFaulted) { string msg = String.Format("Failed to write channel the request {0} {1}.", tcsResponse.Task.AsyncState, sendTask.Exception); Logger.Warn(msg); tcsResponse.SetException(sendTask.TryGetException()); } if (isFireAndForget) { Logger.Debug("Fire and forget message {0} sent. Close channel {1} now. {0}", tcsResponse.Task.AsyncState, channel); tcsResponse.SetResult(null); // set FF result // close channel now } else { //.NET specific, we wait here for the response // receive response message // processes client-side inbound pipeline await channel.ReceiveMessageAsync(); } channel.Close(); // TODO not needed, receive method closes... }
public TaskFailedException(Task baseTask) : base(baseTask.TryGetException().Message) { }