Forráskód Böngészése

Log net.tcp transport messages too.

Atsushi Eno 14 éve
szülő
commit
ae9baa13dd

+ 7 - 0
mcs/class/System.ServiceModel/System.ServiceModel.Channels.NetTcp/TcpDuplexSessionChannel.cs

@@ -147,6 +147,9 @@ namespace System.ServiceModel.Channels.NetTcp
 			}
 
 			client.SendTimeout = (int) timeout.TotalMilliseconds;
+
+			Logger.LogMessage (MessageLogSourceKind.TransportSend, ref message, info.BindingElement.MaxReceivedMessageSize);
+
 			frame.WriteSizedMessage (message);
 		}
 		
@@ -164,12 +167,16 @@ namespace System.ServiceModel.Channels.NetTcp
 			if (timeout <= TimeSpan.Zero)
 				throw new ArgumentException (String.Format ("Timeout value must be positive value. It was {0}", timeout));
 			client.ReceiveTimeout = (int) timeout.TotalMilliseconds;
+
 			message = frame.ReadSizedMessage ();
 			// FIXME: this may not be precise, but connection might be reused for some weird socket state transition (that's what happens). So as a workaround, avoid closing the session by sending EndRecord from this channel at OnClose().
 			if (message == null) {
 				session = null;
 				return false;
 			}
+
+			Logger.LogMessage (MessageLogSourceKind.TransportReceive, ref message, info.BindingElement.MaxReceivedMessageSize);
+
 			return true;
 		}
 		

+ 5 - 0
mcs/class/System.ServiceModel/System.ServiceModel.Channels.NetTcp/TcpReplyChannel.cs

@@ -72,6 +72,9 @@ namespace System.ServiceModel.Channels.NetTcp
 			frame.ProcessPreambleAckRecipient ();
 
 			var msg = frame.ReadUnsizedMessage (timeout);
+
+			Logger.LogMessage (MessageLogSourceKind.TransportReceive, ref msg, info.BindingElement.MaxReceivedMessageSize);
+
 			// LAMESPEC: it contradicts the protocol explanation at section 3.1.1.1.1 in [MC-NMF].
 			// Moving ReadEndRecord() after context's WriteUnsizedMessage() causes TCP connection blocking.
 			frame.ReadEndRecord ();
@@ -105,6 +108,8 @@ namespace System.ServiceModel.Channels.NetTcp
 
 			public override void Reply (Message message, TimeSpan timeout)
 			{
+				Logger.LogMessage (MessageLogSourceKind.TransportSend, ref message, owner.info.BindingElement.MaxReceivedMessageSize);
+
 				DateTime start = DateTime.Now;
 				owner.frame.WriteUnsizedMessage (message, timeout);
 				// FIXME: consider timeout here too.

+ 5 - 0
mcs/class/System.ServiceModel/System.ServiceModel.Channels.NetTcp/TcpRequestChannel.cs

@@ -93,6 +93,8 @@ namespace System.ServiceModel.Channels.NetTcp
 			if (input.Headers.MessageId == null)
 				input.Headers.MessageId = new UniqueId ();
 
+			Logger.LogMessage (MessageLogSourceKind.TransportSend, ref input, int.MaxValue); // It is not a receive buffer
+
 			frame.WriteUnsizedMessage (input, timeout - (DateTime.Now - start));
 
 			// LAMESPEC: it contradicts the protocol described at section 3.1.1.1.1 in [MC-NMF].
@@ -100,6 +102,9 @@ namespace System.ServiceModel.Channels.NetTcp
 			frame.WriteEndRecord ();
 
 			var ret = frame.ReadUnsizedMessage (timeout - (DateTime.Now - start));
+
+			Logger.LogMessage (MessageLogSourceKind.TransportReceive, ref ret, info.BindingElement.MaxReceivedMessageSize);
+
 			frame.ReadEndRecord (); // both
 			return ret;
 		}