Revision: aa03511b2f3e
Author:   Sergey Vetyutnev <[email protected]>
Date:     Wed Aug 15 09:38:13 2012
Log:      Anonymous connections 15082012 - 2
http://code.google.com/p/sctp/source/detail?r=aa03511b2f3e

Modified:
 /sctp-api/src/main/java/org/mobicents/protocols/api/Association.java
/sctp-impl/src/main/java/org/mobicents/protocols/sctp/AssociationHandler.java
 /sctp-impl/src/main/java/org/mobicents/protocols/sctp/AssociationImpl.java
 /sctp-impl/src/test/java/org/mobicents/protocols/sctp/AddressInUseTest.java
/sctp-impl/src/test/java/org/mobicents/protocols/sctp/ClientAssociationTest.java
 /sctp-impl/src/test/java/org/mobicents/protocols/sctp/ManagementTest.java
/sctp-impl/src/test/java/org/mobicents/protocols/sctp/MaxSequenceNumberTest.java
 /sctp-impl/src/test/java/org/mobicents/protocols/sctp/SctpTransferTest.java
/sctp-impl/src/test/java/org/mobicents/protocols/sctp/multihome/SctpMultiHomeTransferTest.java

=======================================
--- /sctp-api/src/main/java/org/mobicents/protocols/api/Association.java Wed Aug 15 06:32:03 2012 +++ /sctp-api/src/main/java/org/mobicents/protocols/api/Association.java Wed Aug 15 09:38:13 2012
@@ -141,8 +141,19 @@
         */
        public void send(PayloadData payloadData) throws Exception;

+       /**
+        * Use this method only for accepting anonymous connections
+        * from the ServerListener.onNewRemoteConnection() invoking
+        *
+        * @param associationListener
+        * @throws Exception
+        */
public void acceptAnonymousAssociation(AssociationListener associationListener) throws Exception;

+       /**
+        * Use this method only for rejecting anonymous connections
+        * from the ServerListener.onNewRemoteConnection() invoking
+        */
        public void rejectAnonymousAssociation();

        /**
=======================================
--- /sctp-impl/src/main/java/org/mobicents/protocols/sctp/AssociationHandler.java Thu May 24 08:37:11 2012 +++ /sctp-impl/src/main/java/org/mobicents/protocols/sctp/AssociationHandler.java Wed Aug 15 09:38:13 2012
@@ -84,7 +84,7 @@

                        // TODO assign Thread's ?
                        try {
-                               associtaion.up = true;
+                               associtaion.markAssociationUp();
associtaion.getAssociationListener().onCommunicationUp(associtaion, this.maxInboundStreams, this.maxOutboundStreams);
                        } catch (Exception e) {
logger.error(String.format("Exception while calling onCommunicationUp on AssociationListener for Association=%s", associtaion.getName()), e);
@@ -102,7 +102,7 @@

                        associtaion.scheduleConnect();
                        try {
-                               associtaion.up = false;
+                               associtaion.markAssociationDown();
                                
associtaion.getAssociationListener().onCommunicationLost(associtaion);
                        } catch (Exception e) {
logger.error(String.format("Exception while calling onCommunicationLost on AssociationListener for Association=%s", associtaion.getName()), e);
@@ -122,7 +122,7 @@
logger.info(String.format("Shutdown for Association=%s", associtaion.getName()));
                        }
                        try {
-                               associtaion.up = false;
+                               associtaion.markAssociationDown();
associtaion.getAssociationListener().onCommunicationShutdown(associtaion);
                        } catch (Exception e) {
logger.error(String.format("Exception while calling onCommunicationShutdown on AssociationListener for Association=%s", associtaion.getName()),
@@ -146,7 +146,7 @@
                // TODO assign Thread's ?

                try {
-                       associtaion.up = false;
+                       associtaion.markAssociationDown();
associtaion.getAssociationListener().onCommunicationShutdown(associtaion);
                } catch (Exception e) {
logger.error(String.format("Exception while calling onCommunicationShutdown on AssociationListener for Association=%s", associtaion.getName()), e);
=======================================
--- /sctp-impl/src/main/java/org/mobicents/protocols/sctp/AssociationImpl.java Wed Aug 15 06:32:03 2012 +++ /sctp-impl/src/main/java/org/mobicents/protocols/sctp/AssociationImpl.java Wed Aug 15 09:38:13 2012
@@ -305,6 +305,14 @@
        public boolean isConnected() {
                return started && up;
        }
+
+       protected void markAssociationUp() {
+               this.up = true;
+       }
+
+       protected void markAssociationDown() {
+               this.up = false;
+       }

        /**
         * @return the hostAddress
@@ -619,7 +627,7 @@
                }

                try {
-                       this.up = false;
+                       this.markAssociationDown();
                        this.associationListener.onCommunicationShutdown(this);
                } catch (Exception e) {
logger.error(String.format("Exception while calling onCommunicationShutdown on AssociationListener for Association=%s", this.name), e);
=======================================
--- /sctp-impl/src/test/java/org/mobicents/protocols/sctp/AddressInUseTest.java Mon Apr 23 07:16:22 2012 +++ /sctp-impl/src/test/java/org/mobicents/protocols/sctp/AddressInUseTest.java Wed Aug 15 09:38:13 2012
@@ -96,7 +96,7 @@
                this.management.start();
                this.management.removeAllResourses();

- this.server = this.management.addServer(SERVER_NAME, SERVER_HOST, SERVER_PORT, ipChannelType, null); + this.server = this.management.addServer(SERVER_NAME, SERVER_HOST, SERVER_PORT, ipChannelType, false, 0, null); this.serverAssociation = this.management.addServerAssociation(CLIENT_HOST, CLIENT_PORT, SERVER_NAME, SERVER_ASSOCIATION_NAME, ipChannelType); this.clientAssociation = this.management.addAssociation(CLIENT_HOST, CLIENT_PORT, SERVER_HOST, SERVER_PORT, CLIENT_ASSOCIATION_NAME, ipChannelType,
                                null);
=======================================
--- /sctp-impl/src/test/java/org/mobicents/protocols/sctp/ClientAssociationTest.java Mon Apr 23 07:16:22 2012 +++ /sctp-impl/src/test/java/org/mobicents/protocols/sctp/ClientAssociationTest.java Wed Aug 15 09:38:13 2012
@@ -95,7 +95,7 @@
                this.management.start();
                this.management.removeAllResourses();

- this.server = this.management.addServer(SERVER_NAME, SERVER_HOST, SERVER_PORT, ipChannelType, null); + this.server = this.management.addServer(SERVER_NAME, SERVER_HOST, SERVER_PORT, ipChannelType, false, 0, null); this.serverAssociation = this.management.addServerAssociation(CLIENT_HOST, CLIENT_PORT, SERVER_NAME, SERVER_ASSOCIATION_NAME, ipChannelType); this.clientAssociation = this.management.addAssociation(CLIENT_HOST, CLIENT_PORT, SERVER_HOST, SERVER_PORT, CLIENT_ASSOCIATION_NAME, ipChannelType, null);
        }
=======================================
--- /sctp-impl/src/test/java/org/mobicents/protocols/sctp/ManagementTest.java Thu Jul 5 03:32:52 2012 +++ /sctp-impl/src/test/java/org/mobicents/protocols/sctp/ManagementTest.java Wed Aug 15 09:38:13 2012
@@ -101,7 +101,7 @@
                management.removeAllResourses();

                String[] arr = new String[]{"127.0.0.2", "127.0.0.3"};
- Server server = management.addServer(SERVER_NAME, SERVER_HOST, SERVER_PORT, ipChannelType, arr); + Server server = management.addServer(SERVER_NAME, SERVER_HOST, SERVER_PORT, ipChannelType, false, 0, arr);

                management.startServer(SERVER_NAME);

@@ -217,7 +217,7 @@
                management.start();
                management.removeAllResourses();

- management.addServer(SERVER_NAME, SERVER_HOST, SERVER_PORT, ipChannelType, null); + management.addServer(SERVER_NAME, SERVER_HOST, SERVER_PORT, ipChannelType, false, 0, null); Association serverAssociation = management.addServerAssociation(CLIENT_HOST, CLIENT_PORT, SERVER_NAME, SERVER_ASSOCIATION_NAME, ipChannelType); Association clientAssociation = management.addAssociation(CLIENT_HOST, CLIENT_PORT, SERVER_HOST, SERVER_PORT, CLIENT_ASSOCIATION_NAME, ipChannelType, null);

=======================================
--- /sctp-impl/src/test/java/org/mobicents/protocols/sctp/MaxSequenceNumberTest.java Mon Apr 23 07:16:22 2012 +++ /sctp-impl/src/test/java/org/mobicents/protocols/sctp/MaxSequenceNumberTest.java Wed Aug 15 09:38:13 2012
@@ -107,7 +107,7 @@
                this.management.start();
                this.management.removeAllResourses();

- this.server = this.management.addServer(SERVER_NAME, SERVER_HOST, SERVER_PORT, ipChannelType, null); + this.server = this.management.addServer(SERVER_NAME, SERVER_HOST, SERVER_PORT, ipChannelType, false, 0, null); this.serverAssociation = this.management.addServerAssociation(CLIENT_HOST, CLIENT_PORT, SERVER_NAME, SERVER_ASSOCIATION_NAME, ipChannelType); this.clientAssociation = this.management.addAssociation(CLIENT_HOST, CLIENT_PORT, SERVER_HOST, SERVER_PORT, CLIENT_ASSOCIATION_NAME, ipChannelType,
                                null);
=======================================
--- /sctp-impl/src/test/java/org/mobicents/protocols/sctp/SctpTransferTest.java Mon Apr 23 07:16:22 2012 +++ /sctp-impl/src/test/java/org/mobicents/protocols/sctp/SctpTransferTest.java Wed Aug 15 09:38:13 2012
@@ -103,7 +103,7 @@
                this.management.start();
                this.management.removeAllResourses();

- this.server = this.management.addServer(SERVER_NAME, SERVER_HOST, SERVER_PORT, ipChannelType, null); + this.server = this.management.addServer(SERVER_NAME, SERVER_HOST, SERVER_PORT, ipChannelType, false, 0, null); this.serverAssociation = this.management.addServerAssociation(CLIENT_HOST, CLIENT_PORT, SERVER_NAME, SERVER_ASSOCIATION_NAME, ipChannelType); this.clientAssociation = this.management.addAssociation(CLIENT_HOST, CLIENT_PORT, SERVER_HOST, SERVER_PORT, CLIENT_ASSOCIATION_NAME, ipChannelType,
                                null);
=======================================
--- /sctp-impl/src/test/java/org/mobicents/protocols/sctp/multihome/SctpMultiHomeTransferTest.java Thu May 24 08:37:11 2012 +++ /sctp-impl/src/test/java/org/mobicents/protocols/sctp/multihome/SctpMultiHomeTransferTest.java Wed Aug 15 09:38:13 2012
@@ -113,7 +113,7 @@
                this.management.start();
                this.management.removeAllResourses();

- this.server = this.management.addServer(SERVER_NAME, SERVER_HOST, SERVER_PORT, ipChannelType, new String[] { SERVER_HOST1 }); + this.server = this.management.addServer(SERVER_NAME, SERVER_HOST, SERVER_PORT, ipChannelType, false, 0, new String[] { SERVER_HOST1 }); this.serverAssociation = this.management.addServerAssociation(CLIENT_HOST, CLIENT_PORT, SERVER_NAME, SERVER_ASSOCIATION_NAME, ipChannelType); this.clientAssociation = this.management.addAssociation(CLIENT_HOST, CLIENT_PORT, SERVER_HOST, SERVER_PORT, CLIENT_ASSOCIATION_NAME, ipChannelType,
                                new String[] { CLIENT_HOST1 });

Reply via email to