[ 
https://issues.apache.org/jira/browse/SSHD-554?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14703120#comment-14703120
 ] 

Matt Kusnierz commented on SSHD-554:
------------------------------------

This code
org.apache.sshd.common.io.nio2.Nio2Service:
try {
    socket.setOption(option, val);
} catch (IOException e) {
    logger.warn("Unable to set socket option " + option + " to " + val, e);
}

Doesn't work as expected, as the
sun.nio.ch.WindowsAsynchronousServerSocketChannelImpl[unbound]
throws an UnsupportedOperationException, not an IOException, so the try/catch 
and logged warning doesn't work as expected.

So this try catch method should probably catch all Exceptions, not just 
IOExceptions...

But the bigger question; is why is this option not supported and/or cannot be 
set at this time.

> Cannot set SO_KEEPALIVE on SshServer
> ------------------------------------
>
>                 Key: SSHD-554
>                 URL: https://issues.apache.org/jira/browse/SSHD-554
>             Project: MINA SSHD
>          Issue Type: Bug
>    Affects Versions: 0.14.0
>            Reporter: Matt Kusnierz
>
> When trying to create an SshServer and configuring SO_KEEPALIVE by setting:
> getProperties().put(FactoryManager.SOCKET_KEEPALIVE, "true");
> The following exception is thrown:
> java.lang.UnsupportedOperationException: 'SO_KEEPALIVE' not supported
>       at 
> sun.nio.ch.AsynchronousServerSocketChannelImpl.setOption(AsynchronousServerSocketChannelImpl.java:187)
>  ~[na:1.8.0]
>       at 
> sun.nio.ch.AsynchronousServerSocketChannelImpl.setOption(AsynchronousServerSocketChannelImpl.java:47)
>  ~[na:1.8.0]
>       at 
> org.apache.sshd.common.io.nio2.Nio2Service.setOption(Nio2Service.java:94) 
> ~[sshd-core-0.14.0.jar:0.14.0]
>       at 
> org.apache.sshd.common.io.nio2.Nio2Acceptor.bind(Nio2Acceptor.java:60) 
> ~[sshd-core-0.14.0.jar:0.14.0]
>       at 
> org.apache.sshd.common.io.nio2.Nio2Acceptor.bind(Nio2Acceptor.java:74) 
> ~[sshd-core-0.14.0.jar:0.14.0]
>       at org.apache.sshd.SshServer.start(SshServer.java:294) 
> ~[sshd-core-0.14.0.jar:0.14.0]



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to