msg.getExpireEvent().cancel(); receiveComplete(msg); } else {
/** * Will force a fast restransmit on the 3rd call (FAST_RETRANSMIT_THRESHOLD) * but only if it's the lowest unacked (see Connection.ResendPacketEvent) */ public void incrementNACKs() { final int cnt = _nackCount.incrementAndGet(); SimpleTimer2.TimedEvent evt = _resendEvent; if (cnt >= Connection.FAST_RETRANSMIT_THRESHOLD && evt != null && (!_retransmitted) && (_numSends.get() == 1 || _lastSend < _context.clock().now() - 4*1000)) { // Don't fast retx if we recently resent it _retransmitted = true; evt.reschedule(0); // the predicate used to be '+', changing to '-' --zab if (_log.shouldLog(Log.DEBUG)) { final String log = String.format("%s nacks and retransmits. Criteria: nacks=%d, retransmitted=%b,"+ " numSends=%d, lastSend=%d, now=%d", toString(), cnt, _retransmitted, _numSends.get(), _lastSend, _context.clock().now()); _log.debug(log); } } else if (_log.shouldLog(Log.DEBUG)) { final String log = String.format("%s nack but no retransmit. Criteria: nacks=%d, retransmitted=%b,"+ " numSends=%d, lastSend=%d, now=%d", toString(), cnt, _retransmitted, _numSends.get(), _lastSend, _context.clock().now()); _log.debug(log); } } public int getNACKs() { return _nackCount.get(); }
if (_log.shouldInfo()) _log.info("Early execution, Rescheduling for " + difference + " later: " + this); schedule(difference); return; timeReached(); } catch (Throwable t) { _log.log(Log.CRIT, _pool + ": Timed task " + this + " exited unexpectedly, please report", t); if (_log.shouldInfo()) _log.info("Reschedule after run: " + this); schedule(_nextRun - System.currentTimeMillis());
/** * Will force a fast restransmit on the 3rd call (FAST_RETRANSMIT_THRESHOLD) * but only if it's the lowest unacked (see Connection.ResendPacketEvent) */ public void incrementNACKs() { final int cnt = _nackCount.incrementAndGet(); SimpleTimer2.TimedEvent evt = _resendEvent; if (cnt >= Connection.FAST_RETRANSMIT_THRESHOLD && evt != null && (!_retransmitted) && (_numSends.get() == 1 || _lastSend < _context.clock().now() - 4*1000)) { // Don't fast retx if we recently resent it _retransmitted = true; evt.reschedule(0); // the predicate used to be '+', changing to '-' --zab if (_log.shouldLog(Log.DEBUG)) { final String log = String.format("%s nacks and retransmits. Criteria: nacks=%d, retransmitted=%b,"+ " numSends=%d, lastSend=%d, now=%d", toString(), cnt, _retransmitted, _numSends.get(), _lastSend, _context.clock().now()); _log.debug(log); } } else if (_log.shouldLog(Log.DEBUG)) { final String log = String.format("%s nack but no retransmit. Criteria: nacks=%d, retransmitted=%b,"+ " numSends=%d, lastSend=%d, now=%d", toString(), cnt, _retransmitted, _numSends.get(), _lastSend, _context.clock().now()); _log.debug(log); } } public int getNACKs() { return _nackCount.get(); }
private void cancelResend() { SimpleTimer2.TimedEvent ev = _resendEvent; if (ev != null) ev.cancel(); }
} else { _decayEvent = new DecayEvent(); _decayEvent.schedule(_durationMs);
msg.getExpireEvent().cancel(); _context.statManager().addRateData("tunnel.fragmentedComplete", msg.getFragmentCount(), msg.getLifetime()); receiveComplete(msg);
t.start(); _listeners.add(listener); _clientTimestamper.schedule(ClientTimestamper.LOOP_TIME);
if (_log.shouldLog(Log.DEBUG)) _log.debug("Cancelling next announce " + _threadName); e.cancel(); _event = null;
else delay = REORGANIZE_TIME; _event.schedule(delay);
_idleChecker.schedule(5*60*1000); if (!_context.isRouterContext()) { String lang = _config.getProperty(PROP_LANG);
/** * @param msg message to send to the clients */ public synchronized void shutdown(String msg) { _isStarted = false; _log.info("Shutting down the ClientManager"); for (ClientListenerRunner listener : _listeners) listener.stopListening(); _listeners.clear(); Set<ClientConnectionRunner> runners = new HashSet<ClientConnectionRunner>(); synchronized (_runners) { for (ClientConnectionRunner runner : _runners.values()) { runners.add(runner); } } synchronized (_pendingRunners) { for (ClientConnectionRunner runner : _pendingRunners) { runners.add(runner); } } for (ClientConnectionRunner runner : runners) { runner.disconnectClient(msg, Log.WARN); } _runnersByHash.clear(); _clientTimestamper.cancel(); }
public void stop() { if (_log.shouldDebug()) _log.debug("Snark stop() begin", new Exception("I did it")); if (_umgr != null && _uhandler != null) { //_uhandler.shutdown(); _umgr.unregister(_uhandler, UpdateType.ROUTER_SIGNED, UpdateMethod.TORRENT); _umgr.unregister(_uhandler, UpdateType.ROUTER_SIGNED_SU3, UpdateMethod.TORRENT); } _running = false; _monitor.interrupt(); _connectionAcceptor.halt(); _idleChecker.cancel(); stopAllTorrents(true); if ("i2psnark".equals(_contextName)) { // only if default instance ClientAppManager cmgr = _context.clientAppManager(); if (cmgr != null) cmgr.unregister(this); } if (_log.shouldWarn()) _log.warn("Snark stop() end"); }
/** only for extension by DHS */ protected DecayingBloomFilter(int durationMs, int entryBytes, String name, I2PAppContext context) { _context = context; _log = context.logManager().getLog(getClass()); _entryBytes = entryBytes; _name = name; _durationMs = durationMs; // all final _extenders = null; _extended = null; _longToEntry = null; _longToEntryMask = 0; context.addShutdownTask(new Shutdown()); _keepDecaying = true; if (_durationMs == 60*60*1000) { // special mode for BuildMessageProcessor _decayEvent = new DecayHourlyEvent(); } else { _decayEvent = new DecayEvent(); _decayEvent.schedule(_durationMs); } }
/** * Caller must synch * @since 0.9.9 */ private void locked_halt() { I2PServerSocket ss = _util.getServerSocket(); if (ss != null) { try { ss.close(); } catch(I2PException ioe) { } } _badCounter.clear(); _cleaner.cancel(); }
/** * Blocking, may take a while, up to 20 seconds */ public synchronized void stop() { if (_log.shouldLog(Log.DEBUG)) _log.debug("UPnP Stop"); _shouldBeRunning = false; _rescanner.cancel(); if (_isRunning) _upnp.terminate(); _isRunning = false; _detectedAddress = null; if (_log.shouldLog(Log.DEBUG)) _log.debug("UPnP Stop Done"); }
/** * May be called even when already running. May be called to start up again after halt(). */ public synchronized void startAccepting() { stop = false; if (_log.shouldLog(Log.WARN)) _log.warn("ConnectionAcceptor startAccepting new thread? " + (thread == null)); if (thread == null) { thread = new I2PAppThread(this, "I2PSnark acceptor"); thread.setDaemon(true); thread.start(); _cleaner.reschedule(BAD_CLEAN_INTERVAL, false); } }