forked from I2P_Developers/i2p.i2p
Router: Ensure database store message is processed before reply job (Gitlab #364)
by processing DSM inline in InNetMessagePool. Caused random lookup failures of RI and LS. Made worse by previous change removing duplicate store from reply job. thanks obscuratus and drzed
This commit is contained in:
@ -1,3 +1,6 @@
|
||||
2022-09-01 zzz
|
||||
* Router: Ensure database store message is processed before reply job (Gitlab #364)
|
||||
|
||||
2022-08-29 zzz
|
||||
* SSU2: Implement ack-immediate flag
|
||||
|
||||
|
@ -17,6 +17,7 @@ import net.i2p.data.Hash;
|
||||
import net.i2p.data.router.RouterIdentity;
|
||||
import net.i2p.data.i2np.DatabaseLookupMessage;
|
||||
import net.i2p.data.i2np.DatabaseSearchReplyMessage;
|
||||
import net.i2p.data.i2np.DatabaseStoreMessage;
|
||||
import net.i2p.data.i2np.DeliveryStatusMessage;
|
||||
import net.i2p.data.i2np.I2NPMessage;
|
||||
import net.i2p.data.i2np.TunnelDataMessage;
|
||||
@ -206,6 +207,34 @@ public class InNetMessagePool implements Service {
|
||||
allowMatches = false;
|
||||
break;
|
||||
|
||||
// If a DSM has a reply job, run the DSM inline
|
||||
// so the entry is stored in the netdb before the reply job runs.
|
||||
// FloodOnlyLookupMatchJob no longer stores the entry
|
||||
case DatabaseStoreMessage.MESSAGE_TYPE:
|
||||
List<OutNetMessage> origMessages = _context.messageRegistry().getOriginalMessages(messageBody);
|
||||
HandlerJobBuilder dsmbuilder = _handlerJobBuilders[DatabaseStoreMessage.MESSAGE_TYPE];
|
||||
Job dsmjob = dsmbuilder.createJob(messageBody, fromRouter, fromRouterHash);
|
||||
int sz = origMessages.size();
|
||||
if (sz > 0) {
|
||||
// DSM inline, reply jobs on queue
|
||||
if (dsmjob != null)
|
||||
dsmjob.runJob();
|
||||
for (int i = 0; i < sz; i++) {
|
||||
OutNetMessage omsg = origMessages.get(i);
|
||||
ReplyJob job = omsg.getOnReplyJob();
|
||||
if (job != null) {
|
||||
job.setMessage(messageBody);
|
||||
_context.jobQueue().addJob(job);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// DSM on queue, no reply jobs
|
||||
if (dsmjob != null)
|
||||
_context.jobQueue().addJob(dsmjob);
|
||||
}
|
||||
allowMatches = false;
|
||||
break;
|
||||
|
||||
default:
|
||||
// why don't we allow type 0? There used to be a message of type 0 long ago...
|
||||
if ( (type > 0) && (type < _handlerJobBuilders.length) ) {
|
||||
|
@ -18,7 +18,7 @@ public class RouterVersion {
|
||||
/** deprecated */
|
||||
public final static String ID = "Git";
|
||||
public final static String VERSION = CoreVersion.VERSION;
|
||||
public final static long BUILD = 3;
|
||||
public final static long BUILD = 4;
|
||||
|
||||
/** for example "-test" */
|
||||
public final static String EXTRA = "";
|
||||
|
Reference in New Issue
Block a user