Browse Source

2009-05-13 Atsushi Enomoto <[email protected]>

	* ReplyHandler.cs, InputOrReplyRequestProcessor.cs,
	  MessageProcessingContext.cs : reply processing is also needed by
	  non-request channels (i.e. duplex). Current code basis lacked
	  such possibility. Quick fix by adding duplex support in
	  ReplyHandler so far.


svn path=/trunk/mcs/; revision=134046
Atsushi Eno 16 years ago
parent
commit
ec6df7fbdb

+ 8 - 0
mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChangeLog

@@ -1,3 +1,11 @@
+2009-05-13  Atsushi Enomoto  <[email protected]>
+
+	* ReplyHandler.cs, InputOrReplyRequestProcessor.cs,
+	  MessageProcessingContext.cs : reply processing is also needed by
+	  non-request channels (i.e. duplex). Current code basis lacked
+	  such possibility. Quick fix by adding duplex support in
+	  ReplyHandler so far.
+
 2009-05-13  Atsushi Enomoto  <[email protected]>
 
 	* ChannelDispatcher.cs, SecurityHandler.cs,

+ 1 - 1
mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/InputOrReplyRequestProcessor.cs

@@ -24,7 +24,7 @@ namespace System.ServiceModel.Dispatcher
 			ProcessingChain.AddHandler (new PostReceiveRequestHandler ()).
 							AddHandler(new SecurityHandler ()).
 							AddHandler(new OperationInvokerHandler ()).
-							AddHandler(new ReplyHandler ());			
+							AddHandler(new ReplyHandler (replyOrInput));
 
 			//errors
 			ErrorChain.AddHandler (new ErrorProcessingHandler ());

+ 10 - 1
mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/MessageProcessingContext.cs

@@ -74,6 +74,15 @@ namespace System.ServiceModel.Dispatcher
 			set { user_events_handler = value; }
 		}
 
+		public void Reply (IDuplexChannel channel, bool useTimeout)
+		{
+			EventsHandler.BeforeSendReply ();
+			if (useTimeout)
+				channel.Send (ReplyMessage, Operation.Parent.ChannelDispatcher.timeouts.SendTimeout);
+			else
+				channel.Send (ReplyMessage);
+		}
+
 		public void Reply (bool useTimeout)
 		{
 			EventsHandler.BeforeSendReply ();
@@ -81,7 +90,7 @@ namespace System.ServiceModel.Dispatcher
 				RequestContext.Reply (ReplyMessage, Operation.Parent.ChannelDispatcher.timeouts.SendTimeout);
 			else
 				RequestContext.Reply (ReplyMessage);
-		}		
+		}
 	}
 
 	#region user events implementation

+ 13 - 3
mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ReplyHandler.cs

@@ -8,10 +8,20 @@ namespace System.ServiceModel.Dispatcher
 {
 	internal class ReplyHandler : BaseRequestProcessorHandler
 	{
+		IDuplexChannel duplex;
+
+		public ReplyHandler (IChannel channel)
+		{
+			duplex = channel as IDuplexChannel;
+		}
+
 		protected override bool ProcessRequest (MessageProcessingContext mrc)
-		{			
-			mrc.Reply (true);
-			return false;			
+		{
+			if (duplex != null)
+				mrc.Reply (duplex, true);
+			else
+				mrc.Reply (true);
+			return false;
 		}
 	}
 }