public void warn(String msg, Throwable e) { if (logToStdout) { System.out.println("WARNING: " + msg); if (e != null) e.printStackTrace(); } if (log.shouldLog(Log.WARN)) log.warn(msg, e); }
/** this does nothing but logging */ public void gotChoke(Peer peer, boolean choke) { if (_log.shouldLog(Log.INFO)) _log.info("Got choke(" + choke + "): " + peer); //if (listener != null) // listener.peerChange(this, peer); }
public void setWriteTimeout(int ms) { if (_log.shouldLog(Log.DEBUG)) _log.debug("Changing write timeout from " + _writeTimeout + " to " + ms); _writeTimeout = ms; }
public synchronized void stopTesting() { _keepTesting = false; if (_log.shouldLog(Log.INFO)) _log.info("Stop testing peers"); }
@Override public void close() throws IOException { if (_log.shouldLog(Log.INFO)) _log.info("Closing " + out + " threaded?? " + shouldCompress(), new Exception("I did it")); synchronized(this) { // synch with changing out field below super.close(); } }
/** * Got a SessionDestroy on an established conn * @since 0.8.1 */ void receiveSessionDestroy(RemoteHostId from, PeerState state) { if (_log.shouldLog(Log.DEBUG)) _log.debug("Receive session destroy (EST) from: " + from); _transport.dropPeer(state, false, "received destroy message"); }
/** * Outbound */ public void registerConnect(NTCPConnection con) { if (_log.shouldLog(Log.DEBUG)) _log.debug("Registering " + con); _context.statManager().addRateData("ntcp.registerConnect", 1); _wantsConRegister.offer(con); _selector.wakeup(); }
public void disconnected(I2PSession session) { if (_log.shouldLog(Log.DEBUG)) _log.debug("I2P session disconnected"); close(); }
public void attemptFailed(String url, long bytesTransferred, long bytesRemaining, int currentAttempt, int numRetries, Exception cause) { // Since readURL() runs an EepGet with 0 retries, // we can report errors with attemptFailed() instead of transferFailed(). // It has the benefit of providing cause of failure, which helps resolve issues. if (_log.shouldLog(Log.WARN)) _log.warn("EepGet failed on " + url, cause); else _log.logAlways(Log.WARN, "EepGet failed on " + url + " : " + cause); if (cause != null && cause.getMessage() != null) _checker.setError(DataHelper.escapeHTML(cause.getMessage())); }
/** * Got a SessionDestroy during outbound establish * @since 0.8.1 */ void receiveSessionDestroy(RemoteHostId from, OutboundEstablishState state) { if (_log.shouldLog(Log.DEBUG)) _log.debug("Receive session destroy (OB) from: " + from); _outboundStates.remove(from); Hash peer = state.getRemoteIdentity().calculateHash(); _transport.dropPeer(peer, false, "received destroy message during OB establish"); }
private void removeSession(PublicKey target) { if (target == null) return; OutboundSession session = null; synchronized (_outboundSessions) { session = _outboundSessions.remove(target); } if ( (session != null) && (_log.shouldLog(Log.WARN)) ) _log.warn("Removing session tags with " + session.availableTags() + " available for " + (session.getLastExpirationDate()-_context.clock().now()) + "ms more", new Exception("Removed by")); }
private void doShortCircuitTunnelGateway(I2NPMessage messageBody) { if (_log.shouldLog(Log.DEBUG)) _log.debug("Shortcut dispatch tunnelGateway message " + messageBody); _context.tunnelDispatcher().dispatch((TunnelGatewayMessage)messageBody); }
/** update the stats and rates (this should be called once a minute) */ public void coalesceStats() { if (!_expanded) return; coalesceOnly(); updateValues(); if (_log.shouldLog(Log.DEBUG)) _log.debug("Coalesced: speed [" + _speedValue + "] capacity [" + _capacityValue + "] integration [" + _integrationValue + "] failing? [" + _isFailing + "]"); }
/** client */ public void registerKeys(Destination dest, SigningPrivateKey leaseRevocationPrivateKey, PrivateKey endpointDecryptionKey) { if (_log.shouldLog(Log.INFO)) _log.info("Registering keys for destination " + dest.calculateHash().toBase64()); LeaseSetKeys keys = new LeaseSetKeys(dest, leaseRevocationPrivateKey, endpointDecryptionKey); _leaseSetKeys.put(dest.calculateHash(), keys); }
public void runJob() { if (!_keepTesting) return; Set<RouterInfo> peers = selectPeersToTest(); if (_log.shouldLog(Log.DEBUG)) _log.debug("Testing " + peers.size() + " peers"); for (RouterInfo peer : peers) { if (_log.shouldLog(Log.DEBUG)) _log.debug("Testing peer " + peer.getIdentity().getHash().toBase64()); testPeer(peer); } requeue(getPeerTestDelay()); }
/** * We sent a message which was ACKed containing the given # of bytes. */ private void messageACKed(int bytesACKed, long lifetime, int numSends) { synchronized(this) { locked_messageACKed(bytesACKed, lifetime, numSends); } if (numSends >= 2 && _log.shouldLog(Log.INFO)) _log.info("acked after numSends=" + numSends + " w/ lifetime=" + lifetime + " and size=" + bytesACKed); _context.statManager().addRateData("udp.sendBps", _sendBps); }
public void runJob() { if (_log.shouldLog(Log.WARN)) _log.warn("lookup of " + _config.getPeer(1) + " failed for " + _config); _context.statManager().addRateData("tunnel.outboundLookupSuccess", 0); } }
public void runJob() { Log log = getContext().logManager().getLog(getClass()); if (log.shouldLog(Log.INFO)) log.info(_search.getJobId() + ": search timed out"); _search.failed(); }
public void handleMessage(I2CPMessage message, I2PSessionImpl session) { if (_log.shouldLog(Log.DEBUG)) _log.debug("Handle message " + message); String reason = ((DisconnectMessage)message).getReason(); session.propogateError(reason, new I2PSessionException("Disconnect Message received: " + reason)); session.destroySession(false); if (reason.contains("restart")) { Thread t = new I2PAppThread(new Reconnector(session), "Reconnect " + session, true); t.start(); } }
public static void dumpStats(I2PAppContext context, int logLevel) { if (!_log.shouldLog(logLevel)) return; StringBuilder buf = new StringBuilder(4 * 1024); dumpFrequencies(context, buf); dumpRates(context, buf); _log.log(logLevel, buf.toString()); }