directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r123028 - in incubator/directory/seda/trunk/src: java/org/apache/seda/listener test/org/apache/seda
Date Wed, 22 Dec 2004 01:28:45 GMT
Author: trustin
Date: Tue Dec 21 17:28:43 2004
New Revision: 123028

URL: http://svn.apache.org/viewcvs?view=rev&rev=123028
Log:
 * Added another constructor for UDP/TCPListenerConfig to make ListenerManagers listen to
all IP addresses available in machine.
   * Modified ProtocolTestCases to use these new constructors.
 * Replaced SocketListenerConfig.getInetAddress() with getInetSocketAddress()
Modified:
   incubator/directory/seda/trunk/src/java/org/apache/seda/listener/SocketListenerConfig.java
   incubator/directory/seda/trunk/src/java/org/apache/seda/listener/TCPListenerConfig.java
   incubator/directory/seda/trunk/src/java/org/apache/seda/listener/TCPListenerManager.java
   incubator/directory/seda/trunk/src/java/org/apache/seda/listener/UDPListenerConfig.java
   incubator/directory/seda/trunk/src/java/org/apache/seda/listener/UDPListenerManager.java
   incubator/directory/seda/trunk/src/test/org/apache/seda/ProtocolTestCase.java

Modified: incubator/directory/seda/trunk/src/java/org/apache/seda/listener/SocketListenerConfig.java
Url: http://svn.apache.org/viewcvs/incubator/directory/seda/trunk/src/java/org/apache/seda/listener/SocketListenerConfig.java?view=diff&rev=123028&p1=incubator/directory/seda/trunk/src/java/org/apache/seda/listener/SocketListenerConfig.java&r1=123027&p2=incubator/directory/seda/trunk/src/java/org/apache/seda/listener/SocketListenerConfig.java&r2=123028
==============================================================================
--- incubator/directory/seda/trunk/src/java/org/apache/seda/listener/SocketListenerConfig.java
(original)
+++ incubator/directory/seda/trunk/src/java/org/apache/seda/listener/SocketListenerConfig.java
Tue Dec 21 17:28:43 2004
@@ -18,6 +18,7 @@
 package org.apache.seda.listener;
 
 import java.net.InetAddress;
+import java.net.InetSocketAddress;
 
 import org.apache.seda.protocol.InetServiceEntry;
 
@@ -52,13 +53,16 @@
     }
 
     /**
-     * Gets the InetAddress associated with this server socket configuration.
+     * Gets the InetSocketAddress associated with this server socket configuration.
      *
-     * @return the address for the server socket associated with this config
+     * @return the socket address for the server socket associated with this config
      */
-    public InetAddress getInetAddress()
+    public InetSocketAddress getInetSocketAddress()
     {
-        return inetAddress;
+        if (inetAddress == null)
+            return new InetSocketAddress(servEnt.getPort());
+        else
+            return new InetSocketAddress(inetAddress, servEnt.getPort());
     }
 
     /**

Modified: incubator/directory/seda/trunk/src/java/org/apache/seda/listener/TCPListenerConfig.java
Url: http://svn.apache.org/viewcvs/incubator/directory/seda/trunk/src/java/org/apache/seda/listener/TCPListenerConfig.java?view=diff&rev=123028&p1=incubator/directory/seda/trunk/src/java/org/apache/seda/listener/TCPListenerConfig.java&r1=123027&p2=incubator/directory/seda/trunk/src/java/org/apache/seda/listener/TCPListenerConfig.java&r2=123028
==============================================================================
--- incubator/directory/seda/trunk/src/java/org/apache/seda/listener/TCPListenerConfig.java
(original)
+++ incubator/directory/seda/trunk/src/java/org/apache/seda/listener/TCPListenerConfig.java
Tue Dec 21 17:28:43 2004
@@ -46,6 +46,18 @@
     {
         super(inetAddress, servEnt);
     }
+    
+    /**
+     * Creates a default listener with the inet service entry only.
+     * This configuration will make listener listen to all network interfaces.
+     *
+     * @param servEnt the inet service entry for the service this listner
+     * provides
+     */
+    public TCPListenerConfig(InetServiceEntry servEnt)
+    {
+        super(null, servEnt);
+    }
 
     /* (non-Javadoc)
      * @see org.apache.seda.listener.ServerListener#getBacklog()

Modified: incubator/directory/seda/trunk/src/java/org/apache/seda/listener/TCPListenerManager.java
Url: http://svn.apache.org/viewcvs/incubator/directory/seda/trunk/src/java/org/apache/seda/listener/TCPListenerManager.java?view=diff&rev=123028&p1=incubator/directory/seda/trunk/src/java/org/apache/seda/listener/TCPListenerManager.java&r1=123027&p2=incubator/directory/seda/trunk/src/java/org/apache/seda/listener/TCPListenerManager.java&r2=123028
==============================================================================
--- incubator/directory/seda/trunk/src/java/org/apache/seda/listener/TCPListenerManager.java
(original)
+++ incubator/directory/seda/trunk/src/java/org/apache/seda/listener/TCPListenerManager.java
Tue Dec 21 17:28:43 2004
@@ -183,11 +183,7 @@
                 try
                 {
                     ServerSocketChannel channel = ServerSocketChannel.open();
-                    InetSocketAddress address =
-                        new InetSocketAddress(
-                                              listener.getInetAddress(),
-                                              listener.getInetServiceEntry()
-                                                      .getPort());
+                    InetSocketAddress address = listener.getInetSocketAddress();
                     channel.socket().bind(address, listener.getBacklog());
                     channel.configureBlocking(false);
                     channel.register(

Modified: incubator/directory/seda/trunk/src/java/org/apache/seda/listener/UDPListenerConfig.java
Url: http://svn.apache.org/viewcvs/incubator/directory/seda/trunk/src/java/org/apache/seda/listener/UDPListenerConfig.java?view=diff&rev=123028&p1=incubator/directory/seda/trunk/src/java/org/apache/seda/listener/UDPListenerConfig.java&r1=123027&p2=incubator/directory/seda/trunk/src/java/org/apache/seda/listener/UDPListenerConfig.java&r2=123028
==============================================================================
--- incubator/directory/seda/trunk/src/java/org/apache/seda/listener/UDPListenerConfig.java
(original)
+++ incubator/directory/seda/trunk/src/java/org/apache/seda/listener/UDPListenerConfig.java
Tue Dec 21 17:28:43 2004
@@ -42,4 +42,16 @@
     {
         super(a_address, servEnt);
     }
+    
+    /**
+     * Creates a default listener with the inet service entry only.
+     * This configuration will make listener listen to all network interfaces.
+     *
+     * @param servEnt the inet service entry for the service this listner
+     * provides
+     */
+    public UDPListenerConfig(InetServiceEntry servEnt)
+    {
+        super(null, servEnt);
+    }
 }

Modified: incubator/directory/seda/trunk/src/java/org/apache/seda/listener/UDPListenerManager.java
Url: http://svn.apache.org/viewcvs/incubator/directory/seda/trunk/src/java/org/apache/seda/listener/UDPListenerManager.java?view=diff&rev=123028&p1=incubator/directory/seda/trunk/src/java/org/apache/seda/listener/UDPListenerManager.java&r1=123027&p2=incubator/directory/seda/trunk/src/java/org/apache/seda/listener/UDPListenerManager.java&r2=123028
==============================================================================
--- incubator/directory/seda/trunk/src/java/org/apache/seda/listener/UDPListenerManager.java
(original)
+++ incubator/directory/seda/trunk/src/java/org/apache/seda/listener/UDPListenerManager.java
Tue Dec 21 17:28:43 2004
@@ -179,11 +179,7 @@
                 try
                 {
                     DatagramChannel channel = DatagramChannel.open();
-                    InetSocketAddress address =
-                        new InetSocketAddress(
-                                              listener.getInetAddress(),
-                                              listener.getInetServiceEntry()
-                                                      .getPort());
+                    InetSocketAddress address = listener.getInetSocketAddress();
                     channel.socket().bind(address);
                     channel.configureBlocking(false);
                     channel.register(selector, SelectionKey.OP_READ, listener);
@@ -480,7 +476,7 @@
      *
      * @author <a href="mailto:aok123@bellsouth.net">Alex Karasulu</a>
      * @author $Author: trustin $
-     * @version $Revision: 56106 $
+     * @version $Revision$
      */
     class ConcreteInputEvent extends InputEvent
     {

Modified: incubator/directory/seda/trunk/src/test/org/apache/seda/ProtocolTestCase.java
Url: http://svn.apache.org/viewcvs/incubator/directory/seda/trunk/src/test/org/apache/seda/ProtocolTestCase.java?view=diff&rev=123028&p1=incubator/directory/seda/trunk/src/test/org/apache/seda/ProtocolTestCase.java&r1=123027&p2=incubator/directory/seda/trunk/src/test/org/apache/seda/ProtocolTestCase.java&r2=123028
==============================================================================
--- incubator/directory/seda/trunk/src/test/org/apache/seda/ProtocolTestCase.java	(original)
+++ incubator/directory/seda/trunk/src/test/org/apache/seda/ProtocolTestCase.java	Tue Dec
21 17:28:43 2004
@@ -17,8 +17,6 @@
 
 package org.apache.seda;
 
-import java.net.InetAddress;
-
 import junit.framework.TestCase;
 
 import org.apache.seda.listener.AvailablePortFinder;
@@ -88,12 +86,12 @@
 
         srvEntry = new InetServiceEntry(proto.getName(), port, proto, TransportTypeEnum.TCP);
         ((DefaultInetServicesDatabase) fe.getInetServicesDatabase()).addEntry(srvEntry);
-        tcpConfig = new TCPListenerConfig(InetAddress.getLocalHost(), srvEntry);
+        tcpConfig = new TCPListenerConfig(srvEntry);
         fe.getTCPListenerManager().bind(tcpConfig);
 
         srvEntry = new InetServiceEntry(proto.getName(), port, proto, TransportTypeEnum.UDP);
         ((DefaultInetServicesDatabase) fe.getInetServicesDatabase()).addEntry(srvEntry);
-        udpConfig = new UDPListenerConfig(InetAddress.getLocalHost(), srvEntry);
+        udpConfig = new UDPListenerConfig(srvEntry);
         fe.getUDPListenerManager().bind(udpConfig);
     }
 

Mime
View raw message