log: Reduce logging when a TCP socket is closed

by the remote peer.
This commit is contained in:
Boris Grozev 2016-12-13 15:07:52 -06:00
parent 1cd1128b89
commit b340fa22f0
2 changed files with 21 additions and 10 deletions

View File

@ -206,7 +206,7 @@ class Connector
localSock.receive(packet);
//get lost if we are no longer running.
if(!running)
if (!running)
return;
if (logger.isLoggable(Level.FINEST)){
@ -258,15 +258,19 @@ class Connector
}
catch (ClosedChannelException cce)
{
logger.log(Level.WARNING,
"A net access point has gone useless:", cce);
stop();
errorHandler.handleFatalError(
// The socket was closed, possibly by the remote peer.
// If we were already stopped, just ignore it.
if (running)
{
// We could be the first thread to realize that the socket
// was closed. But that's normal operation, so don't
// complain too much.
stop();
errorHandler.handleFatalError(
this,
"ClosedChannelException occurred while listening"
+ " for messages!",
cce);
"The socket was closed:",
null);
}
}
catch (IOException ex)
{

View File

@ -256,7 +256,14 @@ class NetAccessManager
//make sure nothing's left and notify user
removeSocket(connector.getListenAddress(),
connector.getRemoteAddress());
logger.log(Level.WARNING, "Removing connector:" + connector, error);
if (error != null)
{
logger.log(Level.WARNING, "Removing connector:" + connector,
error);
} else if (logger.isLoggable(Level.FINE))
{
logger.fine("Removing connector " + connector);
}
}
else if( callingThread instanceof MessageProcessor )
{