[System.ServiceModel] Fix timeout defaulting to 0 seconds
[mono.git] / mcs / class / System.ServiceModel / System.ServiceModel / ClientRuntimeChannel.cs
index 043b2ab7af08df3875689382a09e41e1210750f3..2e2b0d60b0860a432a7a5229b0f1e409a0ab9af2 100644 (file)
@@ -67,6 +67,8 @@ namespace System.ServiceModel.MonoInternal
                TimeSpan default_open_timeout, default_close_timeout;
                IChannel channel;
                IChannelFactory factory;
+               TimeSpan? operation_timeout = null;
+
 
                #region delegates
                readonly ProcessDelegate _processDelegate;
@@ -108,7 +110,6 @@ namespace System.ServiceModel.MonoInternal
 
                        // default values
                        AllowInitializationUI = true;
-                       OperationTimeout = TimeSpan.FromMinutes (1);
 
                        if (contextChannel != null)
                                channel = contextChannel;
@@ -322,8 +323,17 @@ namespace System.ServiceModel.MonoInternal
                        }
                }
 
-               [MonoTODO]
-               public TimeSpan OperationTimeout { get; set; }
+               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;
+                       }
+               }
 
                public IOutputSession OutputSession {
                        get {