put verified sources in the responder cache as well
This commit is contained in:
@ -313,6 +313,7 @@ public class Core {
|
||||
log.info("initializing responder cache")
|
||||
ResponderCache responderCache = new ResponderCache(props.responderCacheSize)
|
||||
eventBus.register(UIResultBatchEvent.class, responderCache)
|
||||
eventBus.register(SourceVerifiedEvent.class, responderCache)
|
||||
|
||||
|
||||
log.info("initializing connection manager")
|
||||
|
@ -56,7 +56,7 @@ class UltrapeerConnectionManager extends ConnectionManager {
|
||||
peerConnections.values().each {
|
||||
// 1. do not send query back to originator
|
||||
// 2. if firstHop forward to everyone
|
||||
// 3. otherwise to everyone who has recently responded to us + randomized sqrt of neighbors
|
||||
// 3. otherwise to everyone who has recently responded/transferred to us + randomized sqrt of neighbors
|
||||
if (e.getReceivedOn() != it.getEndpoint().getDestination() &&
|
||||
(e.firstHop ||
|
||||
responderCache.hasResponded(it.endpoint.destination) ||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.muwire.core.search
|
||||
|
||||
import com.muwire.core.download.SourceVerifiedEvent
|
||||
import com.muwire.core.util.FixedSizeFIFOSet
|
||||
|
||||
import net.i2p.data.Destination
|
||||
@ -19,6 +20,10 @@ class ResponderCache {
|
||||
cache.add(e.results[0].sender.destination)
|
||||
}
|
||||
|
||||
synchronized void onSourceVerifiedEvent(SourceVerifiedEvent e) {
|
||||
cache.add(e.source)
|
||||
}
|
||||
|
||||
synchronized boolean hasResponded(Destination d) {
|
||||
cache.contains(d)
|
||||
}
|
||||
|
Reference in New Issue
Block a user