public void disconnected(I2PSession session) { _l.disconnected(session); } public void errorOccurred(I2PSession session, String message, Throwable error) {
/** * Tear down the session, and do NOT reconnect. * * Blocks if session has not been fully started. */ @Override public void destroySession() { _primary.destroySession(); if (_availabilityNotifier != null) _availabilityNotifier.stopNotifying(); if (_sessionListener != null) _sessionListener.disconnected(this); changeState(State.CLOSED); }
/** * Tear down the session, and do NOT reconnect. * * Will interrupt an open in progress. */ public void destroySession(boolean sendDisconnect) { synchronized(_stateLock) { if (_state == State.CLOSING || _state == State.CLOSED || _state == State.INIT) return; changeState(State.CLOSING); } if (_log.shouldLog(Log.INFO)) _log.info(getPrefix() + "Destroy the session", new Exception("DestroySession()")); if (sendDisconnect && _producer != null) { // only null if overridden by I2PSimpleSession try { _producer.disconnect(this); } catch (I2PSessionException ipe) { //propogateError("Error destroying the session", ipe); if (_log.shouldLog(Log.WARN)) _log.warn("Error destroying the session", ipe); } } // SimpleSession does not initialize if (_availabilityNotifier != null) _availabilityNotifier.stopNotifying(); closeSocket(); _subsessionMap.clear(); if (_sessionListener != null) _sessionListener.disconnected(this); }
/** * Will interrupt a connect in progress. */ protected void disconnect() { State oldState; synchronized(_stateLock) { if (_state == State.CLOSING || _state == State.CLOSED || _state == State.INIT) return; oldState = _state; changeState(State.CLOSING); } if (_log.shouldLog(Log.DEBUG)) _log.debug(getPrefix() + "Disconnect() called", new Exception("Disconnect")); // don't try to reconnect if it failed before GETTDATE if (oldState != State.OPENING && shouldReconnect()) { if (reconnect()) { if (_log.shouldLog(Log.INFO)) _log.info(getPrefix() + "I2CP reconnection successful"); return; } if (_log.shouldLog(Log.ERROR)) _log.error(getPrefix() + "I2CP reconnection failed"); } if (_log.shouldLog(Log.ERROR)) _log.error(getPrefix() + "Disconned from the router, and not trying to reconnect"); if (_sessionListener != null) _sessionListener.disconnected(this); closeSocket(); changeState(State.CLOSED); // break out of wait for initial LS in connect() synchronized (_leaseSetWait) { _leaseSetWait.notifyAll(); } }