From e4d491cdd7ce10b2b222789ae038e5d63c9531f4 Mon Sep 17 00:00:00 2001 From: Alexander Kyte Date: Tue, 24 Mar 2015 17:50:14 -0400 Subject: [PATCH] [System.ServiceModel] Fix timeout defaulting to 0 seconds --- .../MetadataExchangeClient.cs | 13 ++++++++++++- .../System.ServiceModel/ClientRuntimeChannel.cs | 16 +++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Description/MetadataExchangeClient.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Description/MetadataExchangeClient.cs index 7d652098c94..a429fb9e4ae 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Description/MetadataExchangeClient.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Description/MetadataExchangeClient.cs @@ -53,6 +53,7 @@ namespace System.ServiceModel.Description EndpointAddress address; SMBinding binding; MetadataExchangeClientMode mode = MetadataExchangeClientMode.MetadataExchange; + TimeSpan? operation_timeout = null; // constructors @@ -88,7 +89,17 @@ namespace System.ServiceModel.Description [MonoTODO] public int MaximumResolvedReferences { get; set; } - 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; + } + } [MonoTODO] public bool ResolveMetadataReferences { get; set; } diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs b/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs index 043b2ab7af0..2e2b0d60b08 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs @@ -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 { -- 2.25.1