Revision: 1225da543f7d
Author:   Sergey Vetyutnev <[email protected]>
Date:     Mon Aug 20 00:11:12 2012
Log:      Finishing anonymous connection support
http://code.google.com/p/sctp/source/detail?r=1225da543f7d

Modified:
 /sctp-api/src/main/java/org/mobicents/protocols/api/Management.java
 /sctp-api/src/main/java/org/mobicents/protocols/api/Server.java
 /sctp-impl/src/main/java/org/mobicents/protocols/sctp/ManagementImpl.java
 /sctp-impl/src/main/java/org/mobicents/protocols/sctp/ServerImpl.java

=======================================
--- /sctp-api/src/main/java/org/mobicents/protocols/api/Management.java Thu Aug 16 04:26:22 2012 +++ /sctp-api/src/main/java/org/mobicents/protocols/api/Management.java Mon Aug 20 00:11:12 2012
@@ -153,7 +153,28 @@
int maxConcurrentConnectionsCount, String[] extraHostAddresses) throws Exception;

        /**
-        * Add new {@link Server}. IP channel type is SCTP.
+        * Add new {@link Server}. Server can not accept anonymous connections.
+        *
+        * @param serverName
+        *            name of the Server. Should be unique name
+        * @param hostAddress
+        *            IP address that this server will bind to
+        * @param port
+        *            port that this server will bind to
+        * @param ipChannelType
+        *            IP channel type: SCTP or TCP
+        * @param extraHostAddresses
+ * When SCTP multi-homing configuration extra IP addresses can be put here
+        *            If multi-homing absence this parameter can be null
+        * @return new Server instance
+        * @throws Exception
+        *             Exception if management not started or server name 
already
+        *             taken or some other server already has same ip:port
+        */
+ public Server addServer(String serverName, String hostAddress, int port, IpChannelType ipChannelType, String[] extraHostAddresses) throws Exception;
+
+       /**
+ * Add new {@link Server}. IP channel type is SCTP. Server can not accept anonymous connections.
         *
         * @param serverName
         *            name of the Server. Should be unique name
=======================================
--- /sctp-api/src/main/java/org/mobicents/protocols/api/Server.java Wed Aug 15 06:32:03 2012 +++ /sctp-api/src/main/java/org/mobicents/protocols/api/Server.java Mon Aug 20 00:11:12 2012
@@ -102,4 +102,10 @@
         */
        public List<String> getAssociations();

+       /**
+ * Returns an unmodifiable list of anonymous associations that are connected at the moment
+        * @return
+        */
+       public List<Association> getAnonymAssociations();
+
 }
=======================================
--- /sctp-impl/src/main/java/org/mobicents/protocols/sctp/ManagementImpl.java Thu Aug 16 04:10:09 2012 +++ /sctp-impl/src/main/java/org/mobicents/protocols/sctp/ManagementImpl.java Mon Aug 20 00:11:12 2012
@@ -439,6 +439,10 @@
public ServerImpl addServer(String serverName, String hostAddress, int port) throws Exception { return addServer(serverName, hostAddress, port, IpChannelType.SCTP, false, 0, null);
        }
+
+ public Server addServer(String serverName, String hostAddress, int port, IpChannelType ipChannelType, String[] extraHostAddresses) throws Exception { + return addServer(serverName, hostAddress, port, ipChannelType, false, 0, extraHostAddresses);
+       }

public ServerImpl addServer(String serverName, String hostAddress, int port, IpChannelType ipChannelType, boolean acceptAnonymousConnections, int maxConcurrentConnectionsCount, String[] extraHostAddresses) throws Exception {
=======================================
--- /sctp-impl/src/main/java/org/mobicents/protocols/sctp/ServerImpl.java Thu Aug 16 04:10:09 2012 +++ /sctp-impl/src/main/java/org/mobicents/protocols/sctp/ServerImpl.java Mon Aug 20 00:11:12 2012
@@ -128,7 +128,10 @@
                }

                synchronized (this.anonymAssociations) {
-                       // TODO: stop all anonymous associations?
+                       // stopping all anonymous associations
+                       for (Association ass : this.anonymAssociations) {
+                               ass.stopAnonymousAssociation();
+                       }
                        this.anonymAssociations.clear();
                }

@@ -219,10 +222,9 @@
                maxConcurrentConnectionsCount = val;
        }

-       // TODO: should we share an access to the anonymAssociations list
-//     public FastList<Association> getAnonymAssociations() {
-//             return this.anonymAssociations;
-//     }
+       public List<Association> getAnonymAssociations() {
+               return this.anonymAssociations.unmodifiable();
+       }

        protected AbstractSelectableChannel getIpChannel() {
                if (this.ipChannelType == IpChannelType.SCTP)

Reply via email to