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

johnnyv pushed a commit to branch 2.1.X
in repository https://gitbox.apache.org/repos/asf/mina.git


The following commit(s) were added to refs/heads/2.1.X by this push:
     new 2c25466  Fix DIRMINA-1130
2c25466 is described below

commit 2c254669eb772dcceb1dcc601b342a812b033f70
Author: Jonathan Valliere <john...@apache.org>
AuthorDate: Tue Sep 1 11:19:30 2020 -0700

    Fix DIRMINA-1130
---
 .../mina/transport/socket/nio/NioSocketAcceptor.java   | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

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 a3f934e..1e8e34b 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.SocketOption;
 import java.net.StandardSocketOptions;
 import java.nio.channels.SelectionKey;
 import java.nio.channels.Selector;
@@ -31,6 +32,7 @@ import java.nio.channels.SocketChannel;
 import java.nio.channels.spi.SelectorProvider;
 import java.util.Collection;
 import java.util.Iterator;
+import java.util.Set;
 import java.util.concurrent.Executor;
 
 import org.apache.mina.core.polling.AbstractPollingIoAcceptor;
@@ -251,17 +253,17 @@ implements SocketAcceptor {
             socket.setReuseAddress(isReuseAddress());
             
             // Set the SND BUFF
-           if (config.getSendBufferSize() != -1) {
-               channel.setOption(StandardSocketOptions.SO_SNDBUF, 
config.getSendBufferSize());
-           }
+                   if (config.getSendBufferSize() != -1 && 
channel.supportedOptions().contains(StandardSocketOptions.SO_SNDBUF)) {
+                       channel.setOption(StandardSocketOptions.SO_SNDBUF, 
config.getSendBufferSize());
+                   }
 
-           // Set the RCV BUFF
-           if (config.getReceiveBufferSize() != -1) {
-               channel.setOption(StandardSocketOptions.SO_RCVBUF, 
config.getReceiveBufferSize());
-           }
+                   // Set the RCV BUFF
+                   if (config.getReceiveBufferSize() != -1 && 
channel.supportedOptions().contains(StandardSocketOptions.SO_RCVBUF)) {
+                       channel.setOption(StandardSocketOptions.SO_RCVBUF, 
config.getReceiveBufferSize());
+                   }
 
             // and bind.
-            try {
+                   try {
                 socket.bind(localAddress, getBacklog());
             } catch (IOException ioe) {
                 // Add some info regarding the address we try to bind to the

Reply via email to