Search in sources :

Example 1 with DestReplyMessage

use of net.i2p.data.i2cp.DestReplyMessage in project i2p.i2p by i2p.

the class LocalClientMessageEventListener method handleDestLookup.

/**
 *  Look only in current local dests
 */
@Override
protected void handleDestLookup(DestLookupMessage message) {
    Hash h = message.getHash();
    DestReplyMessage msg;
    Destination d = ((LocalClientConnectionRunner) _runner).localLookup(h);
    if (d != null)
        msg = new DestReplyMessage(d);
    else
        msg = new DestReplyMessage(h);
    try {
        _runner.doSend(msg);
    } catch (I2CPMessageException ime) {
        ime.printStackTrace();
    }
}
Also used : I2CPMessageException(net.i2p.data.i2cp.I2CPMessageException) Destination(net.i2p.data.Destination) Hash(net.i2p.data.Hash) DestReplyMessage(net.i2p.data.i2cp.DestReplyMessage)

Example 2 with DestReplyMessage

use of net.i2p.data.i2cp.DestReplyMessage in project i2p.i2p by i2p.

the class DestReplyMessageHandler method handleMessage.

public void handleMessage(I2CPMessage message, I2PSessionImpl session) {
    if (_log.shouldLog(Log.DEBUG))
        _log.debug("Handle message " + message);
    DestReplyMessage msg = (DestReplyMessage) message;
    Destination d = msg.getDestination();
    if (d != null) {
        session.destReceived(d);
    } else {
        Hash h = msg.getHash();
        if (h != null)
            session.destLookupFailed(h);
    }
// else let it time out
}
Also used : Destination(net.i2p.data.Destination) DestReplyMessage(net.i2p.data.i2cp.DestReplyMessage) Hash(net.i2p.data.Hash)

Aggregations

Destination (net.i2p.data.Destination)2 Hash (net.i2p.data.Hash)2 DestReplyMessage (net.i2p.data.i2cp.DestReplyMessage)2 I2CPMessageException (net.i2p.data.i2cp.I2CPMessageException)1