Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non netty #20

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.mobicents.protocols.sctp</groupId>
<artifactId>sctp-parent</artifactId>
<version>1.7.0-SNAPSHOT</version>
<version>1.8.0-SNAPSHOT</version>
</parent>

<artifactId>restcomm-sctp-docs</artifactId>
Expand Down
10 changes: 5 additions & 5 deletions docs/sources-asciidoc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
<parent>
<artifactId>restcomm-sctp-docs</artifactId>
<groupId>org.mobicents.protocols.sctp.docs</groupId>
<version>1.7.0-SNAPSHOT</version>
<version>1.8.0-SNAPSHOT</version>
</parent>

<artifactId>restcomm-sctp-docs-sources-asciidoc</artifactId>

<properties>
<asciidoctor.maven.plugin.version>1.5.3</asciidoctor.maven.plugin.version>
<asciidoctorj.pdf.version>1.5.0-alpha.11</asciidoctorj.pdf.version>
<asciidoctorj.version>1.5.4</asciidoctorj.version>
<jruby.version>1.7.21</jruby.version>
<asciidoctor.maven.plugin.version>1.5.5</asciidoctor.maven.plugin.version>
<asciidoctorj.pdf.version>1.5.0-alpha.15</asciidoctorj.pdf.version>
<asciidoctorj.version>1.5.5</asciidoctorj.version>
<jruby.version>1.7.25</jruby.version>
<docs.this.ra>SCTP</docs.this.ra>
</properties>

Expand Down
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<groupId>org.mobicents.protocols.sctp</groupId>
<artifactId>sctp-parent</artifactId>
<version>1.7.0-SNAPSHOT</version>
<version>1.8.0-SNAPSHOT</version>
<name>Restcomm :: SCTP :: Parent :: ${pom.artifactId}</name>
<packaging>pom</packaging>

Expand Down Expand Up @@ -51,6 +51,7 @@
<profiles>
<profile>
<id>maven-release</id>

<modules>
<module>docs</module>
<module>release</module>
Expand Down
2 changes: 2 additions & 0 deletions release/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
</parent>

<artifactId>sctp-release</artifactId>
<!--
<version>2.22</version>
-->
<name>Restcomm :: Release :: ${pom.artifactId}</name>
<profiles>
<profile>
Expand Down
2 changes: 1 addition & 1 deletion sctp-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.mobicents.protocols.sctp</groupId>
<artifactId>sctp-parent</artifactId>
<version>1.7.0-SNAPSHOT</version>
<version>1.8.0-SNAPSHOT</version>
</parent>

<artifactId>sctp-api</artifactId>
Expand Down
17 changes: 17 additions & 0 deletions sctp-api/src/main/java/org/mobicents/protocols/api/Management.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

}
2 changes: 1 addition & 1 deletion sctp-impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.mobicents.protocols.sctp</groupId>
<artifactId>sctp-parent</artifactId>
<version>1.7.0-SNAPSHOT</version>
<version>1.8.0-SNAPSHOT</version>
</parent>

<artifactId>sctp-impl</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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();
}

/**
Expand Down Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -104,6 +106,8 @@ public class ManagementImpl implements Management {

private int connectDelay = 5000;

private int bufferSize = 8192;

private ExecutorService[] executorServices = null;

private FastList<ManagementEventListener> managementEventListeners = new FastList<ManagementEventListener>();
Expand Down Expand Up @@ -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;
}
Expand Down