use of net.i2p.data.i2cp.SessionStatusMessage in project i2p.i2p by i2p.
the class SessionStatusMessageHandler method handleMessage.
public void handleMessage(I2CPMessage message, I2PSessionImpl session) {
if (_log.shouldLog(Log.DEBUG))
_log.debug("Handle message " + message);
SessionStatusMessage msg = (SessionStatusMessage) message;
session.setSessionId(msg.getSessionId());
switch(msg.getStatus()) {
case SessionStatusMessage.STATUS_CREATED:
_log.info("Session created successfully");
break;
case SessionStatusMessage.STATUS_DESTROYED:
_log.warn("Session destroyed");
session.propogateError("Destroyed", new I2PSessionException("Session Status Message received"));
// session.destroySession();
// la la la
session.reconnect();
break;
case SessionStatusMessage.STATUS_INVALID:
_log.warn("Session invalid");
session.propogateError("Invalid", new I2PSessionException("Session Status Message received"));
// ok, honor this destroy message, because we're b0rked
session.destroySession();
break;
case SessionStatusMessage.STATUS_UPDATED:
_log.info("Session status updated");
break;
default:
if (_log.shouldLog(Log.WARN))
_log.warn("Unknown session status sent: " + msg.getStatus());
}
return;
}
use of net.i2p.data.i2cp.SessionStatusMessage in project i2p.i2p by i2p.
the class ClientMessageEventListener method sendStatusMessage.
private void sendStatusMessage(SessionId id, int status) {
SessionStatusMessage msg = new SessionStatusMessage();
msg.setSessionId(id);
msg.setStatus(status);
try {
_runner.doSend(msg);
} catch (I2CPMessageException ime) {
if (_log.shouldLog(Log.WARN))
_log.warn("Error writing out the session status message", ime);
}
}
Aggregations