You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@etch.apache.org by sc...@apache.org on 2008/12/01 22:50:56 UTC

svn commit: r722250 - in /incubator/etch/trunk/binding-csharp/runtime/src: main/csharp/Etch/Transport/TcpTransportFactory.cs main/csharp/Etch/Util/SessionListener.cs main/csharp/Etch/Util/TcpListener.cs test/csharp/Etch/Util/TestTcpConnection.cs

Author: sccomer
Date: Mon Dec  1 13:50:56 2008
New Revision: 722250

URL: http://svn.apache.org/viewvc?rev=722250&view=rev
Log:
csharp fix for ETCH-17: SessionListener needs to be more independent.

Modified:
    incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Etch/Transport/TcpTransportFactory.cs
    incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Etch/Util/SessionListener.cs
    incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Etch/Util/TcpListener.cs
    incubator/etch/trunk/binding-csharp/runtime/src/test/csharp/Etch/Util/TestTcpConnection.cs

Modified: incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Etch/Transport/TcpTransportFactory.cs
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Etch/Transport/TcpTransportFactory.cs?rev=722250&r1=722249&r2=722250&view=diff
==============================================================================
--- incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Etch/Transport/TcpTransportFactory.cs (original)
+++ incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Etch/Transport/TcpTransportFactory.cs Mon Dec  1 13:50:56 2008
@@ -47,7 +47,7 @@
 
             Object socket = resources.Get(SOCKET);
 
-            TransportData c = null;
+            TransportData c;
 
             if (isSecure)
                 c = new TlsConnection((Socket)socket, u, resources);
@@ -73,15 +73,15 @@
         protected override Transport<ServerFactory> NewListener( string uri, Resources resources,
             ServerFactory factory )
         {
-            Transport<SessionListener> l = new Etch.Util.TcpListener(uri, resources);
+            Transport<SessionListener<Socket>> l = new Etch.Util.TcpListener(uri, resources);
             MySessionListener b = new MySessionListener(this, l, uri, resources);
             b.SetSession(factory);
             return b;
         }
 
-        public class MySessionListener : Transport<ServerFactory>, SessionListener
+        public class MySessionListener : Transport<ServerFactory>, SessionListener<Socket>
         {
-            public MySessionListener(TcpTransportFactory ttf, Transport<SessionListener> transport,
+            public MySessionListener(TcpTransportFactory ttf, Transport<SessionListener<Socket>> transport,
                 String uri, Resources resources )
             {
                 this.ttf = ttf;
@@ -93,7 +93,7 @@
             }
 
             private readonly TcpTransportFactory ttf;
-            private readonly Transport<SessionListener> transport;
+            private readonly Transport<SessionListener<Socket>> transport;
             private readonly string uri;
             private readonly Resources resources;
 

Modified: incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Etch/Util/SessionListener.cs
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Etch/Util/SessionListener.cs?rev=722250&r1=722249&r2=722250&view=diff
==============================================================================
--- incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Etch/Util/SessionListener.cs (original)
+++ incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Etch/Util/SessionListener.cs Mon Dec  1 13:50:56 2008
@@ -13,13 +13,15 @@
 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 // License for the specific language governing permissions and limitations
 // under the License.
- 
-using System.Net.Sockets;
 
 namespace Etch.Util
 {
-    public interface SessionListener : Session
+    /// <summary>
+    /// Interface used to deliver new connections to the session from the listener.
+    /// </summary>
+    /// <typeparam name="T">the type of the connection for the session.</typeparam>
+    public interface SessionListener<T> : Session
     {
-        void SessionAccepted(Socket socket);
+        void SessionAccepted(T socket);
     }
 }

Modified: incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Etch/Util/TcpListener.cs
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Etch/Util/TcpListener.cs?rev=722250&r1=722249&r2=722250&view=diff
==============================================================================
--- incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Etch/Util/TcpListener.cs (original)
+++ incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Etch/Util/TcpListener.cs Mon Dec  1 13:50:56 2008
@@ -25,7 +25,7 @@
     /// <summary>
     /// Implementation of a connection which handles a socket listener.
     /// </summary>
-    public class TcpListener : Connection<SessionListener>, Transport<SessionListener>
+    public class TcpListener : Connection<SessionListener<Socket>>
     {
         /// <summary>
         /// Constructs the TcpListener.
@@ -235,7 +235,7 @@
             {
                 if (e.Message != null && e.Message.Contains("interrupted"))
                     return;
-                throw e;
+                throw;
             }
         }
 

Modified: incubator/etch/trunk/binding-csharp/runtime/src/test/csharp/Etch/Util/TestTcpConnection.cs
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-csharp/runtime/src/test/csharp/Etch/Util/TestTcpConnection.cs?rev=722250&r1=722249&r2=722250&view=diff
==============================================================================
--- incubator/etch/trunk/binding-csharp/runtime/src/test/csharp/Etch/Util/TestTcpConnection.cs (original)
+++ incubator/etch/trunk/binding-csharp/runtime/src/test/csharp/Etch/Util/TestTcpConnection.cs Mon Dec  1 13:50:56 2008
@@ -27,9 +27,9 @@
     public class TestTcpConnection
     {
         public static MyListener lh = new MyListener();
-        public static Connection<SessionListener> l;
+        public static Connection<SessionListener<Socket>> l;
         public TcpConnection c;
-        private static int TIMEOUT = 4000;
+        private const int TIMEOUT = 4000;
         private static int port;
 
         [TestFixtureSetUp]
@@ -724,7 +724,7 @@
 
         #region Filler classes
 
-        public class MyListener : SessionListener
+        public class MyListener : SessionListener<Socket>
         {
             public Monitor<Socket> accepted = new Monitor<Socket>( "accepted" );