public Message WaitForReply(TimeSpan timeout) { ClientSingletonConnectionReader connectionReader = new ClientSingletonConnectionReader( connection, connectionPoolHelper, channel.settings); connectionReader.DoneSending(TimeSpan.Zero); // we still need to receive Message message = connectionReader.Receive(timeout); if (message != null) { ChannelBindingUtility.TryAddToMessage(this.channel.channelBindingToken, message, false); } return(message); }
bool HandleWriteMessage(IAsyncResult result) { // write out the streamed message StreamingConnectionHelper.EndWriteMessage(result); connectionReader = new ClientSingletonConnectionReader(connection, connectionPoolHelper, channel.settings); connectionReader.DoneSending(TimeSpan.Zero); // we still need to receive IAsyncResult receiveResult = connectionReader.BeginReceive(timeoutHelper.RemainingTime(), onReceiveReply, this); if (!receiveResult.CompletedSynchronously) { return(false); } return(CompleteReceiveReply(receiveResult)); }
public Task <Message> ReceiveReplyAsync(TimeoutHelper timeoutHelper) { try { _connectionReader = new ClientSingletonConnectionReader(_connection, _connectionPoolHelper, _channel._settings); return(_connectionReader.ReceiveAsync(timeoutHelper)); } catch (OperationCanceledException) { var cancelToken = _timeoutHelper.GetCancellationToken(); if (cancelToken.IsCancellationRequested) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new TimeoutException(SR.Format( SR.RequestChannelWaitForReplyTimedOut, timeoutHelper.OriginalTimeout))); } else { // Cancellation came from somewhere other than timeoutCts and needs to be handled differently. throw; } } }
bool HandleWriteMessage(IAsyncResult result) { // write out the streamed message StreamingConnectionHelper.EndWriteMessage(result); connectionReader = new ClientSingletonConnectionReader(connection, connectionPoolHelper, channel.settings); connectionReader.DoneSending(TimeSpan.Zero); // we still need to receive IAsyncResult receiveResult = connectionReader.BeginReceive(timeoutHelper.RemainingTime(), onReceiveReply, this); if (!receiveResult.CompletedSynchronously) { return false; } return CompleteReceiveReply(receiveResult); }
public Message WaitForReply(TimeSpan timeout) { ClientSingletonConnectionReader connectionReader = new ClientSingletonConnectionReader( connection, connectionPoolHelper, channel.settings); connectionReader.DoneSending(TimeSpan.Zero); // we still need to receive Message message = connectionReader.Receive(timeout); if (message != null) { ChannelBindingUtility.TryAddToMessage(this.channel.channelBindingToken, message, false); } return message; }
public Task<Message> ReceiveReplyAsync(TimeoutHelper timeoutHelper) { try { _connectionReader = new ClientSingletonConnectionReader(_connection, _connectionPoolHelper, _channel._settings); return _connectionReader.ReceiveAsync(timeoutHelper); } catch (OperationCanceledException) { var cancelToken = _timeoutHelper.GetCancellationToken(); if (cancelToken.IsCancellationRequested) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new TimeoutException(SR.Format( SR.RequestChannelWaitForReplyTimedOut, timeoutHelper.OriginalTimeout))); } else { // Cancellation came from somewhere other than timeoutCts and needs to be handled differently. throw; } } }