Search in sources :

Example 6 with I2CPMessageException

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

the class LocalClientConnectionRunner method updateMessageDeliveryStatus.

/**
 *  No job queue, so super NPEs
 */
@Override
void updateMessageDeliveryStatus(Destination dest, MessageId id, long messageNonce, int status) {
    if (messageNonce <= 0)
        return;
    MessageStatusMessage msg = new MessageStatusMessage();
    msg.setMessageId(id.getMessageId());
    msg.setSessionId(getSessionId(dest.calculateHash()).getSessionId());
    // has to be >= 0, it is initialized to -1
    msg.setNonce(messageNonce);
    msg.setSize(0);
    msg.setStatus(status);
    try {
        doSend(msg);
    } catch (I2CPMessageException ime) {
        _log.warn("Error updating the status for " + id, ime);
    }
}
Also used : I2CPMessageException(net.i2p.data.i2cp.I2CPMessageException) MessageStatusMessage(net.i2p.data.i2cp.MessageStatusMessage)

Example 7 with I2CPMessageException

use of net.i2p.data.i2cp.I2CPMessageException 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 8 with I2CPMessageException

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

the class LocalClientMessageEventListener method handleGetBWLimits.

/**
 *  Send dummy limits
 */
@Override
protected void handleGetBWLimits(GetBandwidthLimitsMessage message) {
    int limit = 1024 * 1024;
    BandwidthLimitsMessage msg = new BandwidthLimitsMessage(limit, limit);
    try {
        _runner.doSend(msg);
    } catch (I2CPMessageException ime) {
        ime.printStackTrace();
    }
}
Also used : I2CPMessageException(net.i2p.data.i2cp.I2CPMessageException) BandwidthLimitsMessage(net.i2p.data.i2cp.BandwidthLimitsMessage) GetBandwidthLimitsMessage(net.i2p.data.i2cp.GetBandwidthLimitsMessage)

Example 9 with I2CPMessageException

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

the class ReportAbuseJob method runJob.

public void runJob() {
    if (_runner.isDead())
        return;
    AbuseReason res = new AbuseReason();
    res.setReason(_reason);
    AbuseSeverity sev = new AbuseSeverity();
    sev.setSeverity(_severity);
    ReportAbuseMessage msg = new ReportAbuseMessage();
    msg.setReason(res);
    SessionId id = _runner.getSessionId(_dest.calculateHash());
    if (id == null)
        return;
    msg.setSessionId(id);
    msg.setSeverity(sev);
    try {
        _runner.doSend(msg);
    } catch (I2CPMessageException ime) {
        _log.error("Error reporting abuse", ime);
    }
}
Also used : I2CPMessageException(net.i2p.data.i2cp.I2CPMessageException) AbuseSeverity(net.i2p.data.i2cp.AbuseSeverity) ReportAbuseMessage(net.i2p.data.i2cp.ReportAbuseMessage) AbuseReason(net.i2p.data.i2cp.AbuseReason) SessionId(net.i2p.data.i2cp.SessionId)

Example 10 with I2CPMessageException

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

the class LocalClientConnectionRunner method requestLeaseSet.

/**
 *  Just send the message directly,
 *  don't instantiate a RequestLeaseSetJob
 */
@Override
void requestLeaseSet(Hash h, LeaseSet set, long expirationTime, Job onCreateJob, Job onFailedJob) {
    RequestVariableLeaseSetMessage msg = new RequestVariableLeaseSetMessage();
    msg.setSessionId(getSessionId(h));
    for (int i = 0; i < set.getLeaseCount(); i++) {
        Lease lease = set.getLease(i);
        msg.addEndpoint(lease);
    }
    try {
        doSend(msg);
    } catch (I2CPMessageException ime) {
        ime.printStackTrace();
    }
}
Also used : I2CPMessageException(net.i2p.data.i2cp.I2CPMessageException) Lease(net.i2p.data.Lease) RequestVariableLeaseSetMessage(net.i2p.data.i2cp.RequestVariableLeaseSetMessage)

Aggregations

I2CPMessageException (net.i2p.data.i2cp.I2CPMessageException)16 SessionId (net.i2p.data.i2cp.SessionId)4 MessageId (net.i2p.data.i2cp.MessageId)3 MessageStatusMessage (net.i2p.data.i2cp.MessageStatusMessage)3 Destination (net.i2p.data.Destination)2 Hash (net.i2p.data.Hash)2 Lease (net.i2p.data.Lease)2 BandwidthLimitsMessage (net.i2p.data.i2cp.BandwidthLimitsMessage)2 GetBandwidthLimitsMessage (net.i2p.data.i2cp.GetBandwidthLimitsMessage)2 I2CPMessage (net.i2p.data.i2cp.I2CPMessage)2 RequestVariableLeaseSetMessage (net.i2p.data.i2cp.RequestVariableLeaseSetMessage)2 IOException (java.io.IOException)1 Date (java.util.Date)1 Properties (java.util.Properties)1 LeaseSet (net.i2p.data.LeaseSet)1 Payload (net.i2p.data.Payload)1 AbuseReason (net.i2p.data.i2cp.AbuseReason)1 AbuseSeverity (net.i2p.data.i2cp.AbuseSeverity)1 DestReplyMessage (net.i2p.data.i2cp.DestReplyMessage)1 DisconnectMessage (net.i2p.data.i2cp.DisconnectMessage)1