You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by jo...@apache.org on 2020/04/15 21:56:15 UTC

[mina] branch DIRMINA-1123 created (now f789661)

This is an automated email from the ASF dual-hosted git repository.

johnnyv pushed a change to branch DIRMINA-1123
in repository https://gitbox.apache.org/repos/asf/mina.git.


      at f789661  Configures the SND/RCV socket buffer before bind()

This branch includes the following new commits:

     new f789661  Configures the SND/RCV socket buffer before bind()

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[mina] 01/01: Configures the SND/RCV socket buffer before bind()

Posted by jo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

johnnyv pushed a commit to branch DIRMINA-1123
in repository https://gitbox.apache.org/repos/asf/mina.git

commit f7896619542f0fd26593ddb4c5a5b57f2938f471
Author: jvalliere <jo...@apache.org>
AuthorDate: Wed Apr 15 17:55:57 2020 -0400

    Configures the SND/RCV socket buffer before bind()
---
 .../mina/transport/socket/nio/NioSocketAcceptor.java       | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioSocketAcceptor.java b/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioSocketAcceptor.java
index f011ca1..5090d78 100644
--- a/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioSocketAcceptor.java
+++ b/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioSocketAcceptor.java
@@ -23,6 +23,7 @@ import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.net.ServerSocket;
 import java.net.SocketAddress;
+import java.net.StandardSocketOptions;
 import java.nio.channels.SelectionKey;
 import java.nio.channels.Selector;
 import java.nio.channels.ServerSocketChannel;
@@ -40,6 +41,7 @@ import org.apache.mina.core.service.SimpleIoProcessorPool;
 import org.apache.mina.core.service.TransportMetadata;
 import org.apache.mina.transport.socket.DefaultSocketSessionConfig;
 import org.apache.mina.transport.socket.SocketAcceptor;
+import org.apache.mina.transport.socket.SocketSessionConfig;
 
 /**
  * {@link IoAcceptor} for socket transport (TCP/IP).  This class
@@ -226,6 +228,8 @@ implements SocketAcceptor {
     protected ServerSocketChannel open(SocketAddress localAddress) throws Exception {
         // Creates the listening ServerSocket
 
+	SocketSessionConfig config = this.getSessionConfig();
+	
         ServerSocketChannel channel = null;
 
         if (selectorProvider != null) {
@@ -245,6 +249,16 @@ implements SocketAcceptor {
 
             // Set the reuseAddress flag accordingly with the setting
             socket.setReuseAddress(isReuseAddress());
+            
+            // Set the SND BUFF
+	    if (config.getSendBufferSize() != -1) {
+		channel.setOption(StandardSocketOptions.SO_SNDBUF, config.getSendBufferSize());
+	    }
+
+	    // Set the RCV BUFF
+	    if (config.getReceiveBufferSize() != -1) {
+		channel.setOption(StandardSocketOptions.SO_RCVBUF, config.getReceiveBufferSize());
+	    }
 
             // and bind.
             try {