if (tcp_listen_port < 0 || tcp_listen_port > 65535 || tcp_listen_port == 6880)
{
String msg = "Invalid incoming TCP listen port configured, " + tcp_listen_port + ". Port reset to default. Please check your config!";
Debug.out(msg);
Logger.log(new LogAlert(LogAlert.UNREPEATABLE, LogAlert.AT_ERROR, msg));
tcp_listen_port = RandomUtils.generateRandomNetworkListenPort();
COConfigurationManager.setParameter(port_config_key, tcp_listen_port);
}
if (COConfigurationManager.getBooleanParameter(port_enable_config_key))
{
last_non_local_connection_time = COConfigurationManager.getLongParameter( "network.tcp.port." + tcp_listen_port + ".last.nonlocal.incoming", 0 );
if ( last_non_local_connection_time > SystemTime.getCurrentTime()){
last_non_local_connection_time = SystemTime.getCurrentTime();
}
if (serverSelectors.length == 0)
{
InetSocketAddress address;
InetAddress[] bindAddresses = getEffectiveBindAddresses();
List tempSelectors = new ArrayList(bindAddresses.length);
listenFailCounts = new int[bindAddresses.length];
for (int i = 0; i < bindAddresses.length; i++)
{
InetAddress bindAddress = bindAddresses[i];
if(!NetworkAdmin.getSingleton().hasIPV6Potential(true) && bindAddress instanceof Inet6Address)
continue;
if (bindAddress != null)
address = new InetSocketAddress(bindAddress, tcp_listen_port);
else
address = new InetSocketAddress(tcp_listen_port);
VirtualServerChannelSelector serverSelector;
if(bindAddresses.length == 1)
serverSelector = VirtualServerChannelSelectorFactory.createBlocking(address, so_rcvbuf_size, selectListener);
else
serverSelector = VirtualServerChannelSelectorFactory.createNonBlocking(address, so_rcvbuf_size, selectListener);
serverSelector.start();
tempSelectors.add(serverSelector);
}
if(tempSelectors.size() == 0)
Logger.log(new LogAlert(true,LogAlert.AT_WARNING,MessageText.getString("network.bindError")));
serverSelectors = (VirtualServerChannelSelector[])tempSelectors.toArray(new VirtualServerChannelSelector[tempSelectors.size()]);
}
} else
{