Bläddra i källkod

2009-06-01 Atsushi Enomoto <[email protected]>

	* TcpDuplexSessionChannel.cs : WaitForMessage() should not return
	  true when socket input is not available.


svn path=/trunk/mcs/; revision=135117
Atsushi Eno 16 år sedan
förälder
incheckning
c3abee4dfd

+ 5 - 0
mcs/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog

@@ -1,3 +1,8 @@
+2009-06-01  Atsushi Enomoto  <[email protected]>
+
+	* TcpDuplexSessionChannel.cs : WaitForMessage() should not return
+	  true when socket input is not available.
+
 2009-05-29  Atsushi Enomoto  <[email protected]>
 
 	* TcpDuplexSessionChannel.cs : Moved tcp listener accept to OnOpen().

+ 11 - 1
mcs/class/System.ServiceModel/System.ServiceModel.Channels/TcpDuplexSessionChannel.cs

@@ -38,6 +38,7 @@ using System.Runtime.Serialization;
 using System.Runtime.Serialization.Formatters.Binary;
 using System.ServiceModel.Channels;
 using System.Text;
+using System.Threading;
 using System.Xml;
 
 namespace System.ServiceModel.Channels
@@ -168,7 +169,16 @@ namespace System.ServiceModel.Channels
 		
 		public override bool WaitForMessage (TimeSpan timeout)
 		{
-			return true;
+			if (client.Available > 0)
+				return true;
+
+			DateTime start = DateTime.Now;
+			do {
+				Thread.Sleep (50);
+				if (client.Available > 0)
+					return true;
+			} while (DateTime.Now - start < timeout);
+			return false;
 		}
 		
 		// CommunicationObject