diff --git a/docs/pom.xml b/docs/pom.xml index 3c4b46c..040fd77 100755 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -6,7 +6,7 @@ org.mobicents.protocols.sctp sctp-parent - 1.7.0-SNAPSHOT + 1.8.0-SNAPSHOT restcomm-sctp-docs diff --git a/docs/sources-asciidoc/pom.xml b/docs/sources-asciidoc/pom.xml index 1f49368..af6655b 100644 --- a/docs/sources-asciidoc/pom.xml +++ b/docs/sources-asciidoc/pom.xml @@ -6,16 +6,16 @@ restcomm-sctp-docs org.mobicents.protocols.sctp.docs - 1.7.0-SNAPSHOT + 1.8.0-SNAPSHOT restcomm-sctp-docs-sources-asciidoc - 1.5.3 - 1.5.0-alpha.11 - 1.5.4 - 1.7.21 + 1.5.5 + 1.5.0-alpha.15 + 1.5.5 + 1.7.25 SCTP diff --git a/pom.xml b/pom.xml index 9103f15..11e4b03 100755 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ org.mobicents.protocols.sctp sctp-parent - 1.7.0-SNAPSHOT + 1.8.0-SNAPSHOT Restcomm :: SCTP :: Parent :: ${pom.artifactId} pom @@ -51,6 +51,7 @@ maven-release + docs release diff --git a/release/pom.xml b/release/pom.xml index 4b82b96..188143e 100755 --- a/release/pom.xml +++ b/release/pom.xml @@ -10,7 +10,9 @@ sctp-release + Restcomm :: Release :: ${pom.artifactId} diff --git a/sctp-api/pom.xml b/sctp-api/pom.xml index 0cef550..b22ad42 100755 --- a/sctp-api/pom.xml +++ b/sctp-api/pom.xml @@ -4,7 +4,7 @@ org.mobicents.protocols.sctp sctp-parent - 1.7.0-SNAPSHOT + 1.8.0-SNAPSHOT sctp-api diff --git a/sctp-api/src/main/java/org/mobicents/protocols/api/Management.java b/sctp-api/src/main/java/org/mobicents/protocols/api/Management.java index 560adf2..4d442b9 100644 --- a/sctp-api/src/main/java/org/mobicents/protocols/api/Management.java +++ b/sctp-api/src/main/java/org/mobicents/protocols/api/Management.java @@ -396,4 +396,21 @@ public Association addAssociation(String hostAddress, int hostPort, String peerA * @param singleThread */ public void setSingleThread(boolean singleThread) throws Exception; + + /** + * Get a sending / receiving buffer size per an association (in bytes). + * Default value is 8192. + * + * @return + */ + public int getBufferSize(); + + /** + * Set a sending / receiving buffer size per an association (in bytes). + * Default value is 8192. + * + * @param bufferSize + */ + public void setBufferSize(int bufferSize) throws Exception; + } diff --git a/sctp-impl/pom.xml b/sctp-impl/pom.xml index 1923934..2321a12 100755 --- a/sctp-impl/pom.xml +++ b/sctp-impl/pom.xml @@ -4,7 +4,7 @@ org.mobicents.protocols.sctp sctp-parent - 1.7.0-SNAPSHOT + 1.8.0-SNAPSHOT sctp-impl diff --git a/sctp-impl/src/main/java/org/mobicents/protocols/sctp/AssociationImpl.java b/sctp-impl/src/main/java/org/mobicents/protocols/sctp/AssociationImpl.java index c1c6166..c04e5a6 100644 --- a/sctp-impl/src/main/java/org/mobicents/protocols/sctp/AssociationImpl.java +++ b/sctp-impl/src/main/java/org/mobicents/protocols/sctp/AssociationImpl.java @@ -109,8 +109,8 @@ public class AssociationImpl implements Association { private SocketChannel socketChannelTcp; // The buffer into which we'll read data when it's available - private ByteBuffer rxBuffer = ByteBuffer.allocateDirect(8192); - private ByteBuffer txBuffer = ByteBuffer.allocateDirect(8192); + private ByteBuffer rxBuffer; + private ByteBuffer txBuffer; private volatile MessageInfo msgInfo; @@ -123,15 +123,21 @@ public class AssociationImpl implements Association { public AssociationImpl() { super(); - // clean transmission buffer - txBuffer.clear(); - txBuffer.rewind(); - txBuffer.flip(); + } - // clean receiver buffer - rxBuffer.clear(); - rxBuffer.rewind(); - rxBuffer.flip(); + protected void initChannels() { + rxBuffer = ByteBuffer.allocateDirect(management.getBufferSize()); + txBuffer = ByteBuffer.allocateDirect(management.getBufferSize()); + + // clean transmission buffer + txBuffer.clear(); + txBuffer.rewind(); + txBuffer.flip(); + + // clean receiver buffer + rxBuffer.clear(); + rxBuffer.rewind(); + rxBuffer.flip(); } /** @@ -414,7 +420,8 @@ public String[] getExtraHostAddresses() { * the management to set */ protected void setManagement(ManagementImpl management) { - this.management = management; + this.management = management; + this.initChannels(); } private AbstractSelectableChannel getSocketChannel() { diff --git a/sctp-impl/src/main/java/org/mobicents/protocols/sctp/ManagementImpl.java b/sctp-impl/src/main/java/org/mobicents/protocols/sctp/ManagementImpl.java index 4f065e9..f0236bd 100644 --- a/sctp-impl/src/main/java/org/mobicents/protocols/sctp/ManagementImpl.java +++ b/sctp-impl/src/main/java/org/mobicents/protocols/sctp/ManagementImpl.java @@ -36,12 +36,14 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; + import javolution.text.TextBuilder; import javolution.util.FastList; import javolution.util.FastMap; import javolution.xml.XMLObjectReader; import javolution.xml.XMLObjectWriter; import javolution.xml.stream.XMLStreamException; + import org.apache.log4j.Logger; import org.mobicents.protocols.api.Association; import org.mobicents.protocols.api.AssociationType; @@ -104,6 +106,8 @@ public class ManagementImpl implements Management { private int connectDelay = 5000; + private int bufferSize = 8192; + private ExecutorService[] executorServices = null; private FastList managementEventListeners = new FastList(); @@ -217,6 +221,21 @@ public void setSingleThread(boolean singleThread) throws Exception { // this.store(); } + @Override + public int getBufferSize() { + return bufferSize; + } + + @Override + public void setBufferSize(int bufferSize) throws Exception { + if (this.started) + throw new Exception("BufferSize parameter can be updated only when SCTP stack is NOT running"); + if (bufferSize < 1000 || bufferSize > 1000000) + throw new Exception("BufferSize must be between 1000 and 1000000 bytes"); + + this.bufferSize = bufferSize; + } + public ServerListener getServerListener() { return serverListener; }