[WCF] fix send timeout. Should fix bug #19697. Should fix bug #19697. Should fix...
authorAtsushi Eno <atsushieno@gmail.com>
Thu, 21 May 2015 08:07:27 +0000 (16:07 +0800)
committerAtsushi Eno <atsushieno@gmail.com>
Thu, 21 May 2015 08:07:27 +0000 (16:07 +0800)
1. Preserve ChannelFactory so that it can retrieve its ServiceEndpoint's
Binding's Timeout values.
2. Use DefaultCommunicationTimeouts.SendTimeout instead of ReceiveTimeout.
It was either written when I don't understand the API well or might be
different in duplex channel (who cares? nothing supports it now and
we will be switching to referencesource).

It is going to be my final contribution to WCF old codebase. Bye bye forever.

mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs

index 2e2b0d60b0860a432a7a5229b0f1e409a0ab9af2..354d4c8b410809c434d8f2f7966383578f56c29d 100644 (file)
@@ -68,7 +68,7 @@ namespace System.ServiceModel.MonoInternal
                IChannel channel;
                IChannelFactory factory;
                TimeSpan? operation_timeout = null;
-
+               ChannelFactory channel_factory;
 
                #region delegates
                readonly ProcessDelegate _processDelegate;
@@ -88,6 +88,7 @@ namespace System.ServiceModel.MonoInternal
                        ChannelFactory channelFactory, EndpointAddress remoteAddress, Uri via)
                        : this (endpoint.CreateClientRuntime (null), endpoint.Contract, channelFactory.DefaultOpenTimeout, channelFactory.DefaultCloseTimeout, null, channelFactory.OpenedChannelFactory, endpoint.Binding.MessageVersion, remoteAddress, via)
                {
+                       channel_factory = channelFactory;
                }
 
                public ClientRuntimeChannel (ClientRuntime runtime, ContractDescription contract, TimeSpan openTimeout, TimeSpan closeTimeout, IChannel contextChannel, IChannelFactory factory, MessageVersion messageVersion, EndpointAddress remoteAddress, Uri via)
@@ -324,15 +325,8 @@ namespace System.ServiceModel.MonoInternal
                }
 
                public TimeSpan OperationTimeout {
-                       get {
-                               if (!this.operation_timeout.HasValue) {
-                                       this.operation_timeout = DefaultCommunicationTimeouts.Instance.ReceiveTimeout;
-                               }
-                               return this.operation_timeout.Value;
-                       }
-                       set {
-                               this.operation_timeout = value;
-                       }
+                       get { return this.operation_timeout ?? (channel_factory != null ? channel_factory.Endpoint.Binding.SendTimeout : DefaultCommunicationTimeouts.Instance.SendTimeout); }
+                       set { this.operation_timeout = value; }
                }
 
                public IOutputSession OutputSession {