2009-04-22 Atsushi Enomoto <atsushi@ximian.com>
authorAtsushi Eno <atsushieno@gmail.com>
Thu, 23 Apr 2009 11:05:23 +0000 (11:05 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Thu, 23 Apr 2009 11:05:23 +0000 (11:05 -0000)
* ClientRuntimeChannel.cs : now Request() supports duplex ones too.

svn path=/trunk/mcs/; revision=132446

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

index 6a92df79cb087b4003c2b4872c835553609c26ad..685978d41e9cc438eaf9c58da4185b3810f03175 100755 (executable)
@@ -1,3 +1,7 @@
+2009-04-22  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * ClientRuntimeChannel.cs : now Request() supports duplex ones too.
+
 2009-04-22  Atsushi Enomoto  <atsushi@ximian.com>
 
        * DuplexChannelFactory.cs : remove todos. Implement CreateChannel().
index 03a6c6e7974807dfa58cd7639ce44229299b0a75..5cc13b8b4fe5396e447b7e887f3aeb7d5b47332c 100644 (file)
@@ -77,7 +77,8 @@ namespace System.ServiceModel
                        OperationTimeout = TimeSpan.FromMinutes (1);
 
                        // determine operation channel to create.
-                       if (factory.OpenedChannelFactory is IChannelFactory<IRequestChannel>)
+                       if (factory.OpenedChannelFactory is IChannelFactory<IRequestChannel> ||
+                           factory.OpenedChannelFactory is IChannelFactory<IRequestSessionChannel>)
                                SetupRequestChannel ();
                        else
                                SetupOutputChannel ();
@@ -447,14 +448,13 @@ namespace System.ServiceModel
                                output_channel.Open ();
 
                        ClientOperation op = runtime.Operations [od.Name];
-                       // FIXME: pass configured default timeout
-                       Send (CreateRequest (op, parameters), factory.Endpoint.Binding.SendTimeout);
+                       Send (CreateRequest (op, parameters), OperationTimeout);
                }
 
                object Request (OperationDescription od, object [] parameters)
                {
-                       if (request_channel.State != CommunicationState.Opened)
-                               request_channel.Open ();
+                       if (OperationChannel.State != CommunicationState.Opened)
+                               OperationChannel.Open ();
 
                        ClientOperation op = runtime.Operations [od.Name];
                        object [] inspections = new object [runtime.MessageInspectors.Count];
@@ -463,8 +463,7 @@ namespace System.ServiceModel
                        for (int i = 0; i < inspections.Length; i++)
                                inspections [i] = runtime.MessageInspectors [i].BeforeSendRequest (ref req, this);
 
-                       // FIXME: pass configured default timeout
-                       Message res = Request (req, factory.Endpoint.Binding.SendTimeout);
+                       Message res = Request (req, OperationTimeout);
                        if (res.IsFault) {
                                MessageFault fault = MessageFault.CreateFault (res, runtime.MaxFaultSize);
                                if (fault.HasDetail && fault is MessageFault.SimpleMessageFault) {
@@ -495,7 +494,13 @@ namespace System.ServiceModel
                // They are internal for ClientBase<T>.ChannelBase use.
                internal Message Request (Message msg, TimeSpan timeout)
                {
-                       return request_channel.Request (msg, timeout);
+                       if (request_channel != null)
+                               return request_channel.Request (msg, timeout);
+                       else {
+                               DateTime startTime = DateTime.Now;
+                               output_channel.Send (msg, timeout);
+                               return ((IDuplexChannel) output_channel).Receive (timeout - (DateTime.Now - startTime));
+                       }
                }
 
                internal IAsyncResult BeginRequest (Message msg, TimeSpan timeout, AsyncCallback callback, object state)