[ https://issues.apache.org/jira/browse/SSHD-333?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14055572#comment-14055572 ]
Guillaume Nodet commented on SSHD-333: -------------------------------------- You mean if several threads call start() on the same server? This has never really been supported afaik. > Ephemeral port handling is faulty > --------------------------------- > > Key: SSHD-333 > URL: https://issues.apache.org/jira/browse/SSHD-333 > Project: MINA SSHD > Issue Type: Bug > Affects Versions: 0.9.0 > Reporter: Przemek Bruski > Assignee: Guillaume Nodet > Fix For: 0.12.0 > > > An excerpt from org.apache.sshd.SshServer: > {code} > if (host != null) { > String[] hosts = host.split(","); > LinkedList<InetSocketAddress> addresses = new > LinkedList<InetSocketAddress>(); > for (String host : hosts) { > InetAddress[] inetAddresses = InetAddress.getAllByName(host); > for (InetAddress inetAddress : inetAddresses) { > InetSocketAddress inetSocketAddress = new > InetSocketAddress(inetAddress, port); > if (port == 0) { > port = inetSocketAddress.getPort(); > } > addresses.add(inetSocketAddress); > } > } > acceptor.bind(addresses); > } > {code} > The line: > {code} > if (port == 0) { > port = inetSocketAddress.getPort(); > } > {code} > Will still retrieve 0. The ephemeral port can be determined only after the > socket address is bound. -- This message was sent by Atlassian JIRA (v6.2#6252)