* NTCP: Mark unreachable on outbound connection timeout

This commit is contained in:
zzz
2008-09-06 13:49:31 +00:00
parent 536f5d0c7b
commit 1091a289d2

View File

@ -422,11 +422,15 @@ public class EventPumper implements Runnable {
_context.statManager().addRateData("ntcp.connectSuccessful", 1, 0); _context.statManager().addRateData("ntcp.connectSuccessful", 1, 0);
} else { } else {
con.close(); con.close();
_transport.markUnreachable(con.getRemotePeer().calculateHash());
_context.statManager().addRateData("ntcp.connectFailedTimeout", 1, 0); _context.statManager().addRateData("ntcp.connectFailedTimeout", 1, 0);
} }
} catch (IOException ioe) { } catch (IOException ioe) { // this is the usual failure path for a timeout or connect refused
if (_log.shouldLog(Log.DEBUG)) _log.debug("Error processing connection", ioe); if (_log.shouldLog(Log.WARN))
_log.warn("Failed outbound connection to " + con.getRemotePeer().calculateHash(), ioe);
con.close(); con.close();
//_context.shitlist().shitlistRouter(con.getRemotePeer().calculateHash(), "Error connecting", NTCPTransport.STYLE);
_transport.markUnreachable(con.getRemotePeer().calculateHash());
_context.statManager().addRateData("ntcp.connectFailedTimeoutIOE", 1, 0); _context.statManager().addRateData("ntcp.connectFailedTimeoutIOE", 1, 0);
} catch (NoConnectionPendingException ncpe) { } catch (NoConnectionPendingException ncpe) {
// ignore // ignore