use of net.i2p.data.i2cp.CreateSessionMessage in project i2p.i2p by i2p.
the class I2CPMessageProducer method connect.
/**
* Send all the messages that a client needs to send to a router to establish
* a new session.
*/
public void connect(I2PSessionImpl session) throws I2PSessionException {
updateBandwidth(session);
CreateSessionMessage msg = new CreateSessionMessage();
SessionConfig cfg = new SessionConfig(session.getMyDestination());
cfg.setOptions(session.getOptions());
if (_log.shouldLog(Log.DEBUG))
_log.debug("config created");
try {
cfg.signSessionConfig(session.getPrivateKey());
} catch (DataFormatException dfe) {
throw new I2PSessionException("Unable to sign the session config", dfe);
}
if (_log.shouldLog(Log.DEBUG))
_log.debug("config signed");
msg.setSessionConfig(cfg);
if (_log.shouldLog(Log.DEBUG))
_log.debug("config loaded into message");
session.sendMessage_unchecked(msg);
if (_log.shouldLog(Log.DEBUG))
_log.debug("config message sent");
}
Aggregations