Ver Fonte

2009-07-08 Atsushi Enomoto <[email protected]>

	* PeerDuplexChannel.cs, PeerChannelListener.cs, PeerOutputChannel.cs,
	  PeerInputChannel.cs, PeerChannelFactory.cs : those channels are
	  going to be unified to PeerDuplexChannel. And it is likely that
	  input and output functionalities are to be unified too.


svn path=/trunk/mcs/; revision=137535
Atsushi Eno há 16 anos atrás
pai
commit
680c9fc67d

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

@@ -1,3 +1,10 @@
+2009-07-08  Atsushi Enomoto  <[email protected]>
+
+	* PeerDuplexChannel.cs, PeerChannelListener.cs, PeerOutputChannel.cs,
+	  PeerInputChannel.cs, PeerChannelFactory.cs : those channels are
+	  going to be unified to PeerDuplexChannel. And it is likely that
+	  input and output functionalities are to be unified too.
+
 2009-07-08  Atsushi Enomoto  <[email protected]>
 
 	* TcpChannelFactory.cs : (TcpChannelInfo) ease type restriction. I

+ 9 - 3
mcs/class/System.ServiceModel/System.ServiceModel.Channels/PeerChannelFactory.cs

@@ -36,7 +36,13 @@ using System.Text;
 
 namespace System.ServiceModel.Channels
 {
-	internal class PeerChannelFactory<TChannel> : ChannelFactoryBase<TChannel>
+	internal interface IPeerChannelManager
+	{
+		PeerTransportBindingElement Source { get; }
+		PeerResolver Resolver { get; }
+	}
+
+	internal class PeerChannelFactory<TChannel> : ChannelFactoryBase<TChannel>, IPeerChannelManager
 	{
 		PeerTransportBindingElement source;
 		MessageEncoder encoder;
@@ -75,9 +81,9 @@ namespace System.ServiceModel.Channels
 
 			Type t = typeof (TChannel);
 			if (t == typeof (IOutputChannel))
-				return (TChannel) (object) new PeerOutputChannel ((PeerChannelFactory<IOutputChannel>) (object) this, address, via, Resolver);
+				return (TChannel) (object) new PeerDuplexChannel (this, address, via, Resolver);
 			if (t == typeof (IDuplexChannel))
-				return (TChannel) (object) new PeerDuplexChannel ((PeerChannelFactory<IDuplexChannel>) (object) this, address, via, Resolver);
+				return (TChannel) (object) new PeerDuplexChannel (this, address, via, Resolver);
 			throw new InvalidOperationException (String.Format ("channel type {0} is not supported.", typeof (TChannel).Name));
 		}
 

+ 3 - 3
mcs/class/System.ServiceModel/System.ServiceModel.Channels/PeerChannelListener.cs

@@ -37,7 +37,7 @@ using System.Text;
 
 namespace System.ServiceModel.Channels
 {
-	internal class PeerChannelListener<TChannel> : InternalChannelListenerBase<TChannel>
+	internal class PeerChannelListener<TChannel> : InternalChannelListenerBase<TChannel>, IPeerChannelManager
 		where TChannel : class, IChannel
 	{
 		PeerTransportBindingElement source;
@@ -89,10 +89,10 @@ namespace System.ServiceModel.Channels
 		TChannel PopulateChannel (TimeSpan timeout)
 		{
 			if (typeof (TChannel) == typeof (IInputChannel))
-				return (TChannel) (object) new PeerInputChannel ((PeerChannelListener<IInputChannel>) (object) this, timeout);
+				return (TChannel) (object) new PeerDuplexChannel (this);
 			// FIXME: handle timeout somehow.
 			if (typeof (TChannel) == typeof (IDuplexChannel))
-				return (TChannel) (object) new PeerDuplexChannel ((PeerChannelListener<IDuplexChannel>) (object) this);
+				return (TChannel) (object) new PeerDuplexChannel (this);
 
 			throw new InvalidOperationException (String.Format ("Not supported channel '{0}' (mono bug; it is incorrectly allowed at construction time)", typeof (TChannel)));
 		}

+ 4 - 4
mcs/class/System.ServiceModel/System.ServiceModel.Channels/PeerDuplexChannel.cs

@@ -44,8 +44,8 @@ namespace System.ServiceModel.Channels
 		PeerResolver resolver;
 		PeerNode node;
 
-		public PeerDuplexChannel (PeerChannelFactory<IDuplexChannel> factory, EndpointAddress address, Uri via, PeerResolver resolver)
-			: base (factory, address, via)
+		public PeerDuplexChannel (IPeerChannelManager factory, EndpointAddress address, Uri via, PeerResolver resolver)
+			: base ((ChannelFactoryBase) factory, address, via)
 		{
 			binding = factory.Source;
 			this.resolver = factory.Resolver;
@@ -56,8 +56,8 @@ namespace System.ServiceModel.Channels
 		}
 
 		// FIXME: receive local_address too
-		public PeerDuplexChannel (PeerChannelListener<IDuplexChannel> listener)
-			: base (listener)
+		public PeerDuplexChannel (IPeerChannelManager listener)
+			: base ((ChannelListenerBase) listener)
 		{
 			binding = listener.Source;
 			this.resolver = listener.Resolver;

+ 2 - 0
mcs/class/System.ServiceModel/System.ServiceModel.Channels/PeerInputChannel.cs

@@ -1,3 +1,4 @@
+#if false
 //
 // PeerInputChannel.cs
 //
@@ -130,3 +131,4 @@ namespace System.ServiceModel.Channels
 		}
 	}
 }
+#endif

+ 2 - 0
mcs/class/System.ServiceModel/System.ServiceModel.Channels/PeerOutputChannel.cs

@@ -1,3 +1,4 @@
+#if false
 //
 // PeerOutputChannel.cs
 //
@@ -111,3 +112,4 @@ namespace System.ServiceModel.Channels
 		}
 	}
 }
+#endif