use of net.i2p.data.i2cp.SetDateMessage in project i2p.i2p by i2p.
the class SetDateMessageHandler method handleMessage.
public void handleMessage(I2CPMessage message, I2PSessionImpl session) {
if (_log.shouldLog(Log.DEBUG))
_log.debug("Handle message " + message);
SetDateMessage msg = (SetDateMessage) message;
// we did was get the time from ourselves.
if (!_context.isRouterContext())
Clock.getInstance().setNow(msg.getDate().getTime());
// TODO - save router's version string for future reference
session.dateUpdated(msg.getVersion());
}
use of net.i2p.data.i2cp.SetDateMessage in project i2p.i2p by i2p.
the class ClientMessageEventListener method handleGetDate.
/**
* Defaults in GetDateMessage options are NOT honored.
* Defaults are not serialized out-of-JVM, and the router does not recognize defaults in-JVM.
* Client side must promote defaults to the primary map.
*/
private void handleGetDate(GetDateMessage message) {
// sent by clients >= 0.8.7
String clientVersion = message.getVersion();
if (clientVersion != null)
_runner.setClientVersion(clientVersion);
Properties props = message.getOptions();
if (!checkAuth(props))
return;
try {
// only send version if the client can handle it (0.8.7 or greater)
_runner.doSend(new SetDateMessage(clientVersion != null ? CoreVersion.VERSION : null));
} catch (I2CPMessageException ime) {
if (_log.shouldLog(Log.ERROR))
_log.error("Error writing out the setDate message", ime);
}
}
Aggregations