コード例 #1
0
            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);
            }
コード例 #2
0
            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));
            }
コード例 #3
0
 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;
         }
     }
 }
コード例 #4
0
            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);
            }
コード例 #5
0
            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;
            }
コード例 #6
0
 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;
         }
     }
 }