Allow customizing the ServerSocketChannelAcceptor to configure the socket
differently (specifically, we want to enable SO_REUSEADDR in Spiral Knights). git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6625 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -99,7 +99,7 @@ public class ServerSocketChannelAcceptor
|
||||
{
|
||||
// create a listening socket
|
||||
final ServerSocketChannel ssocket = ServerSocketChannel.open();
|
||||
ssocket.configureBlocking(false);
|
||||
configureSocket(ssocket);
|
||||
InetSocketAddress isa = AddressUtil.getAddress(_bindHostname, port);
|
||||
ssocket.socket().bind(isa);
|
||||
|
||||
@@ -125,6 +125,16 @@ public class ServerSocketChannelAcceptor
|
||||
log.info("Server listening on " + isa + ".");
|
||||
}
|
||||
|
||||
/**
|
||||
* Override to perform any desired additional socket configuration before binding. Be sure to
|
||||
* call the superclass implementation.
|
||||
*/
|
||||
protected void configureSocket (ServerSocketChannel ssocket)
|
||||
throws IOException
|
||||
{
|
||||
ssocket.configureBlocking(false);
|
||||
}
|
||||
|
||||
protected final int[] _ports;
|
||||
protected final String _bindHostname;
|
||||
protected final ConnectionManager _conMan;
|
||||
|
||||
Reference in New Issue
Block a user