Changeset 2c24a68


Ignore:
Timestamp:
Jun 8, 2019 12:58:05 PM (10 months ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
46ad48d
Parents:
5ed953e
Message:

NetDB: Fix Deliv. Status msg sent direct to tunnel,
must be wrapped in a Tunnel GW msg.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/networkdb/kademlia/HandleFloodfillDatabaseStoreMessageJob.java

    r5ed953e r2c24a68  
    2222import net.i2p.data.i2np.DatabaseStoreMessage;
    2323import net.i2p.data.i2np.DeliveryStatusMessage;
     24import net.i2p.data.i2np.I2NPMessage;
    2425import net.i2p.data.i2np.TunnelGatewayMessage;
    2526import net.i2p.router.Job;
     
    294295                getContext().tunnelDispatcher().dispatch(tgm2);
    295296            }
    296         } else if (toUs || getContext().commSystem().isEstablished(toPeer)) {
     297            return;
     298        }
     299        if (toUs) {
    297300            Job send = new SendMessageDirectJob(getContext(), msg, toPeer, REPLY_TIMEOUT, MESSAGE_PRIORITY);
    298301            send.runJob();
     
    301304                send2.runJob();
    302305            }
    303         } else {
     306            return;
     307        }
     308        boolean isEstab = getContext().commSystem().isEstablished(toPeer);
     309        if (isEstab) {
     310            I2NPMessage out1 = msg;
     311            I2NPMessage out2 = msg2;
     312            if (replyTunnel != null) {
     313                // wrap reply in a TGM
     314                TunnelGatewayMessage tgm = new TunnelGatewayMessage(getContext());
     315                tgm.setMessage(msg);
     316                tgm.setTunnelId(replyTunnel);
     317                tgm.setMessageExpiration(msg.getMessageExpiration());
     318                out1 = tgm;
     319                if (out2 != null) {
     320                    TunnelGatewayMessage tgm2 = new TunnelGatewayMessage(getContext());
     321                    tgm2.setMessage(msg2);
     322                    tgm2.setTunnelId(replyTunnel);
     323                    tgm2.setMessageExpiration(msg.getMessageExpiration());
     324                    out2 = tgm2;
     325                }
     326            }
     327            Job send = new SendMessageDirectJob(getContext(), out1, toPeer, REPLY_TIMEOUT, MESSAGE_PRIORITY);
     328            send.runJob();
     329            if (msg2 != null) {
     330                Job send2 = new SendMessageDirectJob(getContext(), out2, toPeer, REPLY_TIMEOUT, MESSAGE_PRIORITY);
     331                send2.runJob();
     332            }
     333            return;
     334        }
     335
    304336            // pick tunnel with endpoint closest to toPeer
    305337            TunnelInfo outTunnel = getContext().tunnelManager().selectOutboundExploratoryTunnel(toPeer);
     
    314346                getContext().tunnelDispatcher().dispatchOutbound(msg2, outTunnel.getSendTunnelId(0),
    315347                                                                 replyTunnel, toPeer);
    316         }
    317348    }
    318349 
Note: See TracChangeset for help on using the changeset viewer.