mark local queries and make sure they get broadcast

auto-update
Zlatin Balevsky 2021-10-10 08:11:55 +01:00
parent 3c1fbf1953
commit 2bfcbbf1c5
No known key found for this signature in database
GPG Key ID: A72832072D525E41
4 changed files with 6 additions and 6 deletions

View File

@ -46,7 +46,7 @@ class UltrapeerConnectionManager extends ConnectionManager {
void onQueryEvent(QueryEvent e) {
forwardQueryToLeafs(e)
if (!e.firstHop)
if (!e.firstHop && !e.local)
return
if (e.replyTo != me.destination && e.receivedOn != me.destination &&
!leafConnections.containsKey(e.receivedOn))
@ -60,7 +60,7 @@ class UltrapeerConnectionManager extends ConnectionManager {
// 2. if firstHop forward to everyone
// 3. otherwise to everyone who has recently responded/transferred to us + randomized sqrt of neighbors
if (e.getReceivedOn() != it.getEndpoint().getDestination() &&
(e.firstHop ||
(e.firstHop || e.local ||
responderCache.hasResponded(it.endpoint.destination) ||
random.nextInt(connCount) < treshold))
it.sendQuery(e)

View File

@ -8,7 +8,7 @@ import net.i2p.data.Destination
class QueryEvent extends Event {
SearchEvent searchEvent
boolean firstHop
boolean firstHop, local
Destination replyTo
Persona originator
Destination receivedOn

View File

@ -184,7 +184,7 @@ class UpdateClient {
long timestamp = System.currentTimeMillis()
byte [] sig2 = DataUtil.signUUID(uuid, timestamp, spk)
def searchEvent = new SearchEvent(searchHash : updateInfoHash.getRoot(), uuid : uuid, oobInfohash : true, persona : me)
def queryEvent = new QueryEvent(searchEvent : searchEvent, firstHop : true, replyTo : me.destination,
def queryEvent = new QueryEvent(searchEvent : searchEvent, firstHop : true, local: true, replyTo : me.destination,
receivedOn : me.destination, originator : me, sig : sig.data, queryTime : timestamp, sig2 : sig2)
eventBus.publish(queryEvent)
}

View File

@ -146,7 +146,7 @@ class MainFrameController {
Signature sig = DSAEngine.getInstance().sign(payload, core.spk)
long timestamp = System.currentTimeMillis()
core.eventBus.publish(new QueryEvent(searchEvent : searchEvent, firstHop : firstHop,
core.eventBus.publish(new QueryEvent(searchEvent : searchEvent, firstHop : firstHop, local: true,
replyTo: core.me.destination, receivedOn: core.me.destination,
originator : core.me, sig : sig.data, queryTime : timestamp, sig2 : DataUtil.signUUID(uuid, timestamp, core.spk)))
@ -171,7 +171,7 @@ class MainFrameController {
def searchEvent = new SearchEvent(searchHash : Base64.decode(infoHash), uuid:uuid,
oobInfohash: true, persona : core.me)
core.eventBus.publish(new QueryEvent(searchEvent : searchEvent, firstHop : true,
core.eventBus.publish(new QueryEvent(searchEvent : searchEvent, firstHop : true, local: true,
replyTo: core.me.destination, receivedOn: core.me.destination,
originator : core.me, sig : sig.data, queryTime : timestamp, sig2 : sig2))
}