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:
Greg Wilkins 2009-12-11 00:19:30 +00:00
parent 3fea82d8a4
commit 5e73e0462c
1 changed files with 5 additions and 0 deletions

View File

@ -201,12 +201,17 @@ public class SelectChannelConnector extends AbstractNIOConnector
{
// Create a new server socket
_acceptChannel = ServerSocketChannel.open();
// Set to blocking mode
_acceptChannel.configureBlocking(true);
// Bind the server socket to the local host and port
_acceptChannel.socket().setReuseAddress(getReuseAddress());
InetSocketAddress addr = getHost()==null?new InetSocketAddress(getPort()):new InetSocketAddress(getHost(),getPort());
_acceptChannel.socket().bind(addr,getAcceptQueueSize());
if (_acceptChannel.socket().getLocalPort()==-1)
throw new IOException("Server channel not bound");
// Set to non blocking mode
_acceptChannel.configureBlocking(false);