shitlist appropriately (continued)
This commit is contained in:
@ -272,7 +272,7 @@ class RestrictiveTCPConnection extends TCPConnection {
|
|||||||
// not only do we remove the reference to the invalid peer
|
// not only do we remove the reference to the invalid peer
|
||||||
_context.netDb().fail(_remoteIdentity.getHash());
|
_context.netDb().fail(_remoteIdentity.getHash());
|
||||||
// but we make sure that we don't try to talk to them soon even if we get a new ref
|
// but we make sure that we don't try to talk to them soon even if we get a new ref
|
||||||
_context.shitlist().shitlistRouter(_remoteIdentity.getHash());
|
_context.shitlist().shitlistRouter(_remoteIdentity.getHash(), "Invalid protocol version");
|
||||||
throw new DataFormatException("Peer uses an invalid version! dropping");
|
throw new DataFormatException("Peer uses an invalid version! dropping");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,7 +280,7 @@ class RestrictiveTCPConnection extends TCPConnection {
|
|||||||
boolean timeOk = validateTime();
|
boolean timeOk = validateTime();
|
||||||
if (_log.shouldLog(Log.DEBUG)) _log.debug("after validateTime [" + timeOk + "]...");
|
if (_log.shouldLog(Log.DEBUG)) _log.debug("after validateTime [" + timeOk + "]...");
|
||||||
if (!timeOk) {
|
if (!timeOk) {
|
||||||
_context.shitlist().shitlistRouter(_remoteIdentity.getHash());
|
_context.shitlist().shitlistRouter(_remoteIdentity.getHash(), "Time too far out of sync");
|
||||||
throw new DataFormatException("Peer is too far out of sync with the current router's clock! dropping");
|
throw new DataFormatException("Peer is too far out of sync with the current router's clock! dropping");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -288,7 +288,7 @@ class RestrictiveTCPConnection extends TCPConnection {
|
|||||||
boolean peerReachable = validatePeerAddress();
|
boolean peerReachable = validatePeerAddress();
|
||||||
if (_log.shouldLog(Log.DEBUG)) _log.debug("after validatePeerAddress [" + peerReachable + "]...");
|
if (_log.shouldLog(Log.DEBUG)) _log.debug("after validatePeerAddress [" + peerReachable + "]...");
|
||||||
if (!peerReachable) {
|
if (!peerReachable) {
|
||||||
_context.shitlist().shitlistRouter(_remoteIdentity.getHash());
|
_context.shitlist().shitlistRouter(_remoteIdentity.getHash(), "Unreachable address");
|
||||||
throw new DataFormatException("Peer provided us with an unreachable router address, and we can't handle restricted routes yet! dropping");
|
throw new DataFormatException("Peer provided us with an unreachable router address, and we can't handle restricted routes yet! dropping");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,26 +190,31 @@ public class TCPTransport extends TransportImpl {
|
|||||||
if (_log.shouldLog(Log.WARN))
|
if (_log.shouldLog(Log.WARN))
|
||||||
_log.warn("Unable to establish a socket in time to " + addr);
|
_log.warn("Unable to establish a socket in time to " + addr);
|
||||||
_context.profileManager().commErrorOccurred(target.getIdentity().getHash());
|
_context.profileManager().commErrorOccurred(target.getIdentity().getHash());
|
||||||
|
_context.shitlist().shitlistRouter(target.getIdentity().getHash(), "Unable to contact host");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (_log.shouldLog(Log.DEBUG))
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
_log.debug("Socket created");
|
_log.debug("Socket created");
|
||||||
if (s != null) {
|
|
||||||
TCPConnection con = new RestrictiveTCPConnection(_context, s, true);
|
TCPConnection con = new RestrictiveTCPConnection(_context, s, true);
|
||||||
conCreated = _context.clock().now();
|
conCreated = _context.clock().now();
|
||||||
if (_log.shouldLog(Log.DEBUG))
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
_log.debug("TCPConnection created");
|
_log.debug("TCPConnection created");
|
||||||
boolean established = handleConnection(con, target);
|
boolean established = handleConnection(con, target);
|
||||||
conEstablished = _context.clock().now();
|
conEstablished = _context.clock().now();
|
||||||
if (_log.shouldLog(Log.DEBUG))
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
_log.debug("connection handled");
|
_log.debug("connection handled");
|
||||||
return established;
|
return established;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_context.shitlist().shitlistRouter(target.getIdentity().getHash(), "No addresses we can handle");
|
||||||
|
return false;
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
if (_log.shouldLog(Log.WARN))
|
if (_log.shouldLog(Log.WARN))
|
||||||
_log.warn("Unexpected error establishing the connection", t);
|
_log.warn("Unexpected error establishing the connection", t);
|
||||||
|
_context.shitlist().shitlistRouter(target.getIdentity().getHash(), "Internal error connecting");
|
||||||
|
return false;
|
||||||
} finally {
|
} finally {
|
||||||
long diff = conEstablished - startEstablish;
|
long diff = conEstablished - startEstablish;
|
||||||
if ( ( (diff > 6000) || (conEstablished == 0) ) && (_log.shouldLog(Log.WARN)) ) {
|
if ( ( (diff > 6000) || (conEstablished == 0) ) && (_log.shouldLog(Log.WARN)) ) {
|
||||||
@ -219,7 +224,6 @@ public class TCPTransport extends TransportImpl {
|
|||||||
(conEstablished - conCreated) + "ms overall: " + diff);
|
(conEstablished - conCreated) + "ms overall: " + diff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Socket createSocket(RouterAddress addr) {
|
protected Socket createSocket(RouterAddress addr) {
|
||||||
@ -444,7 +448,7 @@ public class TCPTransport extends TransportImpl {
|
|||||||
con.closeConnection();
|
con.closeConnection();
|
||||||
// remove the old ref, since they likely just created a new identity
|
// remove the old ref, since they likely just created a new identity
|
||||||
_context.netDb().fail(target.getIdentity().getHash());
|
_context.netDb().fail(target.getIdentity().getHash());
|
||||||
_context.shitlist().shitlistRouter(target.getIdentity().getHash());
|
_context.shitlist().shitlistRouter(target.getIdentity().getHash(), "Peer changed identities");
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
if (_log.shouldLog(Log.DEBUG))
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
@ -623,7 +627,9 @@ public class TCPTransport extends TransportImpl {
|
|||||||
if (_log.shouldLog(Log.INFO))
|
if (_log.shouldLog(Log.INFO))
|
||||||
_log.info("Unable to establish a connection to " + pending.getPeer());
|
_log.info("Unable to establish a connection to " + pending.getPeer());
|
||||||
failPending(pending);
|
failPending(pending);
|
||||||
_context.shitlist().shitlistRouter(pending.getPeer());
|
|
||||||
|
// shitlisted by establishConnection with a more detailed reason
|
||||||
|
//_context.shitlist().shitlistRouter(pending.getPeer(), "Unable to contact host");
|
||||||
//ProfileManager.getInstance().commErrorOccurred(pending.getPeer());
|
//ProfileManager.getInstance().commErrorOccurred(pending.getPeer());
|
||||||
failedPending = _context.clock().now();
|
failedPending = _context.clock().now();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user