diff options
author | Atsushi Eno <atsushieno@gmail.com> | 2009-08-07 06:29:12 +0400 |
---|---|---|
committer | Atsushi Eno <atsushieno@gmail.com> | 2009-08-07 06:29:12 +0400 |
commit | 44bcad3d2e5f6ce445f9f2666ac70de033e716d7 (patch) | |
tree | 449dd922740f17f7b74d20254dd7fc56cc785036 /mcs/class | |
parent | 8018f7b220e957ed040838cb3a55b67b48112734 (diff) |
2009-08-07 Atsushi Enomoto <atsushi@ximian.com>
* ClientRuntimeChannel.cs : close/abort channels.
factory is optional now.
svn path=/trunk/mcs/; revision=139536
Diffstat (limited to 'mcs/class')
-rwxr-xr-x | mcs/class/System.ServiceModel/System.ServiceModel/ChangeLog | 5 | ||||
-rw-r--r-- | mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs | 22 |
2 files changed, 21 insertions, 6 deletions
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/ChangeLog b/mcs/class/System.ServiceModel/System.ServiceModel/ChangeLog index d06e990130d..e4fc2051104 100755 --- a/mcs/class/System.ServiceModel/System.ServiceModel/ChangeLog +++ b/mcs/class/System.ServiceModel/System.ServiceModel/ChangeLog @@ -1,3 +1,8 @@ +2009-08-07 Atsushi Enomoto <atsushi@ximian.com> + + * ClientRuntimeChannel.cs : close/abort channels. + factory is optional now. + 2009-08-06 Atsushi Enomoto <atsushi@ximian.com> * ClientRuntimeChannel.cs : unify IChannel field to one. diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs b/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs index 408dd877f8e..726098c60bc 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs @@ -85,9 +85,9 @@ namespace System.ServiceModel EndpointAddress remote_address; ContractDescription contract; MessageVersion message_version; - IChannelFactory factory; TimeSpan default_open_timeout, default_close_timeout; IChannel channel; + IChannelFactory factory; #region delegates readonly ProcessDelegate _processDelegate; @@ -116,7 +116,6 @@ namespace System.ServiceModel runtime.Via = via; this.contract = contract; this.message_version = messageVersion; - this.factory = factory; default_open_timeout = openTimeout; default_close_timeout = closeTimeout; _processDelegate = new ProcessDelegate (Process); @@ -130,6 +129,8 @@ namespace System.ServiceModel var method = factory.GetType ().GetMethod ("CreateChannel", new Type [] {typeof (EndpointAddress), typeof (Uri)}); channel = (IChannel) method.Invoke (factory, new object [] {remote_address, Via}); + + this.factory = factory; } public ClientRuntime Runtime { @@ -355,23 +356,32 @@ namespace System.ServiceModel protected override void OnAbort () { - factory.Abort (); + channel.Abort (); + if (factory != null) + factory.Abort (); } + Action<TimeSpan> close_delegate; + protected override IAsyncResult OnBeginClose ( TimeSpan timeout, AsyncCallback callback, object state) { - return factory.BeginClose (timeout, callback, state); + if (close_delegate == null) + close_delegate = new Action<TimeSpan> (OnClose); + return close_delegate.BeginInvoke (timeout, callback, state); } protected override void OnEndClose (IAsyncResult result) { - factory.EndClose (result); + close_delegate.EndInvoke (result); } protected override void OnClose (TimeSpan timeout) { - factory.Close (timeout); + DateTime start = DateTime.Now; + channel.Close (timeout); + if (factory != null) + factory.Close (timeout - (DateTime.Now - start)); } protected override IAsyncResult OnBeginOpen ( |