Explorar el Código

2003-02-05 Alvaro del Castillo <[email protected]>

        * System.Runtime.Remoting.Channels.Tcp/TcpClientTransportSink.cs:
        * System.Runtime.Remoting.Channels.Tcp/TcpMessageIO.cs:
        * System.Runtime.Remoting.Channels.Tcp/TcpServerChannel.cs:
        Change MessageType to MessageStatus so the code is
        more clear

svn path=/trunk/mcs/; revision=11254
Alvaro del Castillo hace 23 años
padre
commit
fe14fa4e67

+ 9 - 1
mcs/class/System.Runtime.Remoting/ChangeLog

@@ -1,3 +1,11 @@
+2003-02-05  Alvaro del Castillo <[email protected]>
+
+	* System.Runtime.Remoting.Channels.Tcp/TcpClientTransportSink.cs:
+	* System.Runtime.Remoting.Channels.Tcp/TcpMessageIO.cs:
+	* System.Runtime.Remoting.Channels.Tcp/TcpServerChannel.cs:
+	Change MessageType to MessageStatus so the code is
+	more clear
+
 2002-12-29  Lluis Sanchez Gual <[email protected]>
 
 	* TcpServerChannel.cs: Changed management of listener threads.
@@ -49,4 +57,4 @@
 
 2002-08-14  Rodrigo Moya <[email protected]>
 
-	* TcpChannel.cs: new classes.
+	* TcpChannel.cs: new classes.

+ 4 - 4
mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpClientTransportSink.cs

@@ -88,9 +88,9 @@ namespace System.Runtime.Remoting.Channels.Tcp
 				ITransportHeaders responseHeaders;
 
 				// Read the response, blocking if necessary
-				MessageType type = TcpMessageIO.ReceiveMessageType (connection.Stream);
+				MessageStatus status = TcpMessageIO.ReceiveMessageStatus (connection.Stream);
 
-				if (type != MessageType.MethodMessage)
+				if (status != MessageStatus.MethodMessage)
 					throw new RemotingException ("Unknown response message from server");
 
 				Stream responseStream = TcpMessageIO.ReceiveMessageStream (connection.Stream, out responseHeaders, connection.Buffer);
@@ -138,9 +138,9 @@ namespace System.Runtime.Remoting.Channels.Tcp
 				if (!RemotingServices.IsOneWay (((IMethodMessage)msg).MethodBase)) 
 				{
 					// Reads the response
-					MessageType type = TcpMessageIO.ReceiveMessageType (connection.Stream);
+					MessageStatus status = TcpMessageIO.ReceiveMessageStatus (connection.Stream);
 
-					if (type != MessageType.MethodMessage)
+					if (status != MessageStatus.MethodMessage)
 						throw new RemotingException ("Unknown response message from server");
 
 					responseStream = TcpMessageIO.ReceiveMessageStream (connection.Stream, out responseHeaders, connection.Buffer);

+ 6 - 6
mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpMessageIO.cs

@@ -12,7 +12,7 @@ using System.Net.Sockets;
 
 namespace System.Runtime.Remoting.Channels.Tcp 
 {
-	enum MessageType { MethodMessage = 0, CancelSignal = 1, Unknown = 10}
+	enum MessageStatus { MethodMessage = 0, CancelSignal = 1, Unknown = 10}
 
 	internal class TcpMessageIO
 	{
@@ -25,7 +25,7 @@ namespace System.Runtime.Remoting.Channels.Tcp
 		public static int DefaultStreamBufferSize = 1000;
 
 		// Identifies an incoming message
-		public static MessageType ReceiveMessageType (Stream networkStream)
+		public static MessageStatus ReceiveMessageStatus (Stream networkStream)
 		{
 			try
 			{
@@ -42,17 +42,17 @@ namespace System.Runtime.Remoting.Channels.Tcp
 						if (i > 0 && !isOnTrack[n]) continue;
 
 						isOnTrack[n] = (c == _msgHeaders[n][i]);
-						if (isOnTrack[n] && (i == _msgHeaders[n].Length-1)) return (MessageType)n;
+						if (isOnTrack[n] && (i == _msgHeaders[n].Length-1)) return (MessageStatus) n;
 						atLeastOneOnTrack = atLeastOneOnTrack || isOnTrack[n];
 					}
 					i++;
 				}
-				return MessageType.Unknown;
+				return MessageStatus.Unknown;
 			}
 			catch (IOException)
 			{
 				// Stream closed
-				return MessageType.CancelSignal;
+				return MessageStatus.CancelSignal;
 			}
 		}
 
@@ -61,7 +61,7 @@ namespace System.Runtime.Remoting.Channels.Tcp
 			if (buffer == null) buffer = new byte[DefaultStreamBufferSize];
 
 			// Writes the message start header
-			byte[] dotnetHeader = _msgHeaders[(int)MessageType.MethodMessage];
+			byte[] dotnetHeader = _msgHeaders[(int) MessageStatus.MethodMessage];
 			networkStream.Write(dotnetHeader, 0, dotnetHeader.Length);
 
 			// Writes the length of the stream being sent (not including the headers)

+ 3 - 3
mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpServerChannel.cs

@@ -246,15 +246,15 @@ namespace System.Runtime.Remoting.Channels.Tcp
 				bool end = false;
 				while (!end)
 				{
-					MessageType type = TcpMessageIO.ReceiveMessageType (_stream);
+					MessageStatus type = TcpMessageIO.ReceiveMessageStatus (_stream);
 
 					switch (type)
 					{
-						case MessageType.MethodMessage:
+						case MessageStatus.MethodMessage:
 							_sink.InternalProcessMessage (this);
 							break;
 
-						case MessageType.CancelSignal:
+						case MessageStatus.CancelSignal:
 							end = true;
 							break;
 					}