Merge remote-tracking branch 'origin/jetty-9.3.x' into jetty-9.4.x
This commit is contained in:
commit
9da52222fd
|
@ -278,6 +278,22 @@ public class ServerConnector extends AbstractNetworkConnector
|
|||
public void open() throws IOException
|
||||
{
|
||||
if (_acceptChannel == null)
|
||||
{
|
||||
_acceptChannel = openAcceptChannel();
|
||||
_acceptChannel.configureBlocking(true);
|
||||
_localPort = _acceptChannel.socket().getLocalPort();
|
||||
if (_localPort <= 0)
|
||||
throw new IOException("Server channel not bound");
|
||||
addBean(_acceptChannel);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by {@link #open()} to obtain the accepting channel.
|
||||
* @return ServerSocketChannel used to accept connections.
|
||||
* @throws IOException
|
||||
*/
|
||||
protected ServerSocketChannel openAcceptChannel() throws IOException
|
||||
{
|
||||
ServerSocketChannel serverChannel = null;
|
||||
if (isInheritChannel())
|
||||
|
@ -296,17 +312,9 @@ public class ServerConnector extends AbstractNetworkConnector
|
|||
InetSocketAddress bindAddress = getHost() == null ? new InetSocketAddress(getPort()) : new InetSocketAddress(getHost(), getPort());
|
||||
serverChannel.socket().setReuseAddress(getReuseAddress());
|
||||
serverChannel.socket().bind(bindAddress, getAcceptQueueSize());
|
||||
|
||||
_localPort = serverChannel.socket().getLocalPort();
|
||||
if (_localPort <= 0)
|
||||
throw new IOException("Server channel not bound");
|
||||
}
|
||||
|
||||
serverChannel.configureBlocking(true);
|
||||
addBean(serverChannel);
|
||||
|
||||
_acceptChannel = serverChannel;
|
||||
}
|
||||
return serverChannel;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue