bind server socket in blocking mode
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1141 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
parent
3fea82d8a4
commit
5e73e0462c
|
@ -201,12 +201,17 @@ public class SelectChannelConnector extends AbstractNIOConnector
|
||||||
{
|
{
|
||||||
// Create a new server socket
|
// Create a new server socket
|
||||||
_acceptChannel = ServerSocketChannel.open();
|
_acceptChannel = ServerSocketChannel.open();
|
||||||
|
// Set to blocking mode
|
||||||
|
_acceptChannel.configureBlocking(true);
|
||||||
|
|
||||||
// Bind the server socket to the local host and port
|
// Bind the server socket to the local host and port
|
||||||
_acceptChannel.socket().setReuseAddress(getReuseAddress());
|
_acceptChannel.socket().setReuseAddress(getReuseAddress());
|
||||||
InetSocketAddress addr = getHost()==null?new InetSocketAddress(getPort()):new InetSocketAddress(getHost(),getPort());
|
InetSocketAddress addr = getHost()==null?new InetSocketAddress(getPort()):new InetSocketAddress(getHost(),getPort());
|
||||||
_acceptChannel.socket().bind(addr,getAcceptQueueSize());
|
_acceptChannel.socket().bind(addr,getAcceptQueueSize());
|
||||||
|
|
||||||
|
if (_acceptChannel.socket().getLocalPort()==-1)
|
||||||
|
throw new IOException("Server channel not bound");
|
||||||
|
|
||||||
// Set to non blocking mode
|
// Set to non blocking mode
|
||||||
_acceptChannel.configureBlocking(false);
|
_acceptChannel.configureBlocking(false);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue