From c5e8648b27c6993507a036c8e76bdbc3161ba6d8 Mon Sep 17 00:00:00 2001 From: sergey vetyutnev Date: Thu, 11 May 2017 10:20:47 +0200 Subject: [PATCH 1/6] Fixing of #18: Adding of configuring for TxSending buffer for non-netty version --- .../mobicents/protocols/api/Management.java | 17 +++++++++++++++++ .../protocols/sctp/AssociationImpl.java | 7 +++++-- .../protocols/sctp/ManagementImpl.java | 19 +++++++++++++++++++ 3 files changed, 41 insertions(+), 2 deletions(-) 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/src/main/java/org/mobicents/protocols/sctp/AssociationImpl.java b/sctp-impl/src/main/java/org/mobicents/protocols/sctp/AssociationImpl.java index c1c6166..5313e16 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; @@ -415,6 +415,9 @@ public String[] getExtraHostAddresses() { */ protected void setManagement(ManagementImpl management) { this.management = management; + + rxBuffer = ByteBuffer.allocateDirect(management.getBufferSize()); + txBuffer = ByteBuffer.allocateDirect(management.getBufferSize()); } 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; } From 053b13209e0bf84ee776adfdaf48dfcedf348b89 Mon Sep 17 00:00:00 2001 From: sergey vetyutnev Date: Thu, 11 May 2017 11:33:57 +0200 Subject: [PATCH 2/6] Fixing of #18: Adding of configuring for TxSending buffer for non-netty version - part 2 --- .../protocols/sctp/AssociationImpl.java | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) 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 5313e16..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 @@ -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,10 +420,8 @@ public String[] getExtraHostAddresses() { * the management to set */ protected void setManagement(ManagementImpl management) { - this.management = management; - - rxBuffer = ByteBuffer.allocateDirect(management.getBufferSize()); - txBuffer = ByteBuffer.allocateDirect(management.getBufferSize()); + this.management = management; + this.initChannels(); } private AbstractSelectableChannel getSocketChannel() { From 6d219b16f5a8a7d6f759c9c3cd2699b2567009ba Mon Sep 17 00:00:00 2001 From: sergey vetyutnev Date: Thu, 11 May 2017 11:38:01 +0200 Subject: [PATCH 3/6] Switching to pom version 1.8.0-SNAPSHOT --- docs/pom.xml | 2 +- docs/sources-asciidoc/pom.xml | 2 +- pom.xml | 2 +- sctp-api/pom.xml | 2 +- sctp-impl/pom.xml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) 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..9ec3589 100644 --- a/docs/sources-asciidoc/pom.xml +++ b/docs/sources-asciidoc/pom.xml @@ -6,7 +6,7 @@ restcomm-sctp-docs org.mobicents.protocols.sctp.docs - 1.7.0-SNAPSHOT + 1.8.0-SNAPSHOT restcomm-sctp-docs-sources-asciidoc diff --git a/pom.xml b/pom.xml index 9103f15..0cbc886 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 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-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 From 1842bb31a4b7fd22ad724f72106919306c942abc Mon Sep 17 00:00:00 2001 From: sergey vetyutnev Date: Wed, 13 Sep 2017 17:36:40 +0200 Subject: [PATCH 4/6] Update of asciidoctor version --- docs/sources-asciidoc/pom.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/sources-asciidoc/pom.xml b/docs/sources-asciidoc/pom.xml index 9ec3589..af6655b 100644 --- a/docs/sources-asciidoc/pom.xml +++ b/docs/sources-asciidoc/pom.xml @@ -12,10 +12,10 @@ 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 From 26cfb1f729f7f34792464282b61c19afdeb490c5 Mon Sep 17 00:00:00 2001 From: sergey vetyutnev Date: Tue, 19 Sep 2017 10:48:45 +0200 Subject: [PATCH 5/6] Changing of maven-release profice (removing of modules) --- pom.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pom.xml b/pom.xml index 0cbc886..7f5026c 100755 --- a/pom.xml +++ b/pom.xml @@ -51,10 +51,12 @@ maven-release + From a38982c5c09d538d1837fc1dc5757fed8995f199 Mon Sep 17 00:00:00 2001 From: sergey vetyutnev Date: Tue, 19 Sep 2017 11:46:34 +0200 Subject: [PATCH 6/6] Fixing of releasing issues --- pom.xml | 3 +-- release/pom.xml | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 7f5026c..11e4b03 100755 --- a/pom.xml +++ b/pom.xml @@ -51,12 +51,11 @@ maven-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}