public void SendRequest(Message message, TimeSpan timeout)
            {
                TimeoutHelper timeoutHelper = new TimeoutHelper(timeout);

                try
                {
                    this.connection = connectionPoolHelper.EstablishConnection(timeoutHelper.RemainingTime());

                    ChannelBindingUtility.TryAddToMessage(this.channel.channelBindingToken, message, false);

                    bool success = false;
                    try
                    {
                        StreamingConnectionHelper.WriteMessage(message, this.connection, true, channel.settings, ref timeoutHelper);
                        success = true;
                    }
                    finally
                    {
                        if (!success)
                        {
                            connectionPoolHelper.Abort();
                        }
                    }
                }
                catch (TimeoutException exception)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
                              new TimeoutException(SR.GetString(SR.TimeoutOnRequest, timeout), exception));
                }
            }
Пример #2
0
            public void SendRequest(Message message, TimeSpan timeout)
            {
                TimeoutHelper timeoutHelper = new TimeoutHelper(timeout);

                try
                {
                    this.connection = this.connectionPoolHelper.EstablishConnection(timeoutHelper.RemainingTime());
                    ChannelBindingUtility.TryAddToMessage(this.channel.channelBindingToken, message, false);
                    bool flag = false;
                    try
                    {
                        StreamingConnectionHelper.WriteMessage(message, this.connection, true, this.channel.settings, ref timeoutHelper);
                        flag = true;
                    }
                    finally
                    {
                        if (!flag)
                        {
                            this.connectionPoolHelper.Abort();
                        }
                    }
                }
                catch (TimeoutException exception)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new TimeoutException(System.ServiceModel.SR.GetString("TimeoutOnRequest", new object[] { timeout }), exception));
                }
            }
Пример #3
0
 protected override void OnReply(Message message, TimeSpan timeout)
 {
     this.timeoutHelper = new TimeoutHelper(timeout);
     StreamingConnectionHelper.WriteMessage(message, this.connection, false, this.settings, ref this.timeoutHelper);
     this.parent.DoneSending(this.timeoutHelper.RemainingTime());
 }