BaseSender(Key key, boolean realTimeFlag, PeerNode source, Node node, short htl, long uid) { if(key.getRoutingKey() == null) throw new NullPointerException(); startTime = System.currentTimeMillis(); this.uid = uid; this.key = key; this.realTimeFlag = realTimeFlag; this.node = node; this.source = source; target = key.toNormalizedDouble(); this.isSSK = key instanceof NodeSSK; assert(isSSK || key instanceof NodeCHK); this.htl = htl; this.origHTL = htl; newLoadManagement = node.enableNewLoadManagement(realTimeFlag); incomingSearchTimeout = calculateTimeout(realTimeFlag, htl, node); }
public long checkRecentlyFailed(Key key, boolean realTime) { RecentlyFailedReturn r = new RecentlyFailedReturn(); // We always decrement when we start a request. This feeds into the // routing decision. Depending on our decrementAtMax flag, it may or // may not actually go down one hop. But if we don't use it here then // this won't be comparable to the decisions taken by the RequestSender, // so we will keep on selecting and RF'ing locally, and wasting send // slots and CPU. FIXME SECURITY/NETWORK: Reconsider if we ever decide // not to decrement on the originator. short origHTL = node.decrementHTL(null, node.maxHTL()); node.peers.closerPeer(null, new HashSet<PeerNode>(), key.toNormalizedDouble(), true, false, -1, null, 2.0, key, origHTL, 0, true, realTime, r, false, System.currentTimeMillis(), node.enableNewLoadManagement(realTime)); return r.recentlyFailed(); }
@Override public void blockTransferFinished(boolean success) { if(success) { // for byte logging status = RequestSender.SUCCESS; // We've fetched it from our datastore, so there won't be a downstream noderef. // But we want to send at least an FNPOpennetCompletedAck, otherwise the request source // may have to timeout waiting for one. That will be the terminal message. try { finishOpennetNoRelay(); } catch (NotConnectedException e) { Logger.normal(this, "requestor gone, could not start request handler wait"); tag.handlerThrew(e); } } else { //also for byte logging, since the block is the 'terminal' message. applyByteCounts(); unregisterRequestHandlerWithNode(); } node.nodeStats.remoteRequest(false, success, true, htl, key.toNormalizedDouble(), realTimeFlag, false); }
public void requestCompleted(boolean isSSK, boolean isInsert, Key key, boolean realTime) { getThrottleWindow(realTime).requestCompleted(); (isSSK ? throttleWindowSSK : throttleWindowCHK).requestCompleted(); (isInsert ? throttleWindowInsert : throttleWindowRequest).requestCompleted(); stats.reportOutgoingRequestLocation(key.toNormalizedDouble()); }
@Override public void run() { freenet.support.Logger.OSThread.logPID(this); // FIXME ? key is not known for inserts here if (key != null) stats.reportOutgoingLocalRequestLocation(key.toNormalizedDouble()); if(!req.send(core, sched)) { if(!((!req.isPersistent()) && req.isCancelled())) Logger.error(this, "run() not able to send a request on "+req); else Logger.normal(this, "run() not able to send a request on "+req+" - request was cancelled"); } if(logMINOR) Logger.minor(this, "Finished "+req); }
next.reportRoutedTo(key.toNormalizedDouble(), source == null, realTimeFlag, source, nodesRoutedTo, htl); node.peers.incrementSelectionSamples(System.currentTimeMillis(), next); } catch (NotConnectedException e) {
node.nodeStats.remoteRequest(true, true, true, htl, key.toNormalizedDouble(), realTimeFlag, false); } else if(block instanceof CHKBlock) { Message df = DMT.createFNPCHKDataFound(uid, block.getRawHeaders());
node.nodeStats.remoteRequest(key instanceof NodeSSK, false, false, htl, key.toNormalizedDouble(), realTimeFlag, false); return; } else {
double target = key.toNormalizedDouble(); double myDist = Location.distance(myLoc, target);
rejectedOverload = true; long rtt = System.currentTimeMillis() - startTime; double targetLocation=key.toNormalizedDouble(); if(isSSK) { node.nodeStats.reportSSKOutcome(rtt, false, realTimeFlag); (status == RequestSender.GET_OFFER_VERIFY_FAILURE))) { long rtt = System.currentTimeMillis() - startTime; double targetLocation=key.toNormalizedDouble(); if(!rejectedOverload) requestStarters.requestCompleted(isSSK, false, key, realTimeFlag);
node.nodeStats.remoteRequest(key instanceof NodeSSK, status == RequestSender.SUCCESS, false, htl, key.toNormalizedDouble(), realTimeFlag, fromOfferedKey);
next.reportRoutedTo(key.toNormalizedDouble(), source == null, realTimeFlag, source, nodesRoutedTo, htl); next.sendSync(req, this, realTimeFlag); } catch (NotConnectedException e) {
nodeStats.reportIncomingRequestLocation(key.toNormalizedDouble());