/** * There is no noderef to pass downstream. If we want a connection, send our * noderef and wait for a reply, otherwise just send an ack. */ private void finishOpennetNoRelay() throws NotConnectedException { OpennetManager om = node.getOpennet(); if(om != null && (source.isOpennet() || node.passOpennetRefsThroughDarknet())) { finishOpennetNoRelayInner(om); } else { ackOpennet(); } }
status = rs.getStatus(); applyByteCounts(); unregisterRequestHandlerWithNode();
/** * Either send an ack, indicating we've finished and aren't interested in opennet, * or wait for a noderef and relay it and wait for a response and relay that, * or send our own noderef and wait for a response and add that. * * One way or another this method must call applyByteCounts; unregisterRequestHandlerWithNode. * This happens asynchronously via ackOpennet() if we are unable to send a noderef. It * happens explicitly otherwise. */ private void finishOpennetChecked() throws NotConnectedException { OpennetManager om = node.getOpennet(); if(om != null && (node.passOpennetRefsThroughDarknet() || source.isOpennet())) { finishOpennetInner(om); } else { ackOpennet(); } }
xferFinished = readyToFinishTransfer(); xferSuccess = transferSuccess; unregisterRequestHandlerWithNode(); else if(reject != null) sendTerminal(reject); else if(xferFinished) transferFinished(xferSuccess);
if(tag.hasSourceReallyRestarted()) { Logger.normal(this, "requestor is gone, can't send terminal message"); applyByteCounts(); unregisterRequestHandlerWithNode(); return; case RequestSender.DATA_NOT_FOUND: Message dnf = DMT.createFNPDataNotFound(uid); sendTerminal(dnf); return; case RequestSender.RECENTLY_FAILED: Message rf = DMT.createFNPRecentlyFailed(uid, rs.getRecentlyFailedTimeLeft()); sendTerminal(rf); return; case RequestSender.GENERATED_REJECTED_OVERLOAD: sendTerminal(reject); return; case RequestSender.ROUTE_NOT_FOUND: sendTerminal(rnf); return; case RequestSender.SUCCESS: if(key instanceof NodeSSK) sendSSK(rs.getHeaders(), rs.getSSKData(), needsPubKey, (rs.getSSKBlock().getKey()).getPubKey()); else { maybeCompleteTransfer(); case RequestSender.GET_OFFER_VERIFY_FAILURE:
Logger.minor(this, "Finishing opennet: sending own reference on "+this, new Exception("debug")); if(!om.wantPeer(null, false, false, false, ConnectionType.PATH_FOLDING)) { ackOpennet(); return; // Don't want a reference Logger.normal(this, "Can't send opennet ref because node disconnected on " + this); applyByteCounts(); unregisterRequestHandlerWithNode(); return;
noderef = rs.waitForOpennetNoderef(); } catch (WaitedTooLongForOpennetNoderefException e) { sendTerminal(DMT.createFNPOpennetCompletedTimeout(uid)); rs.ackOpennet(rs.successFrom()); return; finishOpennetNoRelayInner(om); return; finishOpennetNoRelayInner(om); return; finishOpennetRelay(noderef, om);
if(key instanceof NodeSSK) needsPubKey = m.getBoolean(DMT.NEED_PUB_KEY); RequestHandler rh = new RequestHandler(source, id, node, htl, key, tag, block, realTimeFlag, needsPubKey); rh.receivedBytes(m.receivedByteCount()); node.executor.execute(rh, "RequestHandler for UID "+id+" on "+node.getDarknetPortNumber());
@Override public void run() { freenet.support.Logger.OSThread.logPID(this); try { realRun(); //The last thing that realRun() does is register as a request-sender listener, so any exception here is the end. } catch(NotConnectedException e) { Logger.normal(this, "requestor gone, could not start request handler wait"); tag.handlerThrew(e); } catch(Throwable t) { Logger.error(this, "Caught " + t, t); tag.handlerThrew(t); } }
rs.ackOpennet(dataSource); applyByteCounts(); unregisterRequestHandlerWithNode(); return;
if(tag.hasSourceReallyRestarted()) { Logger.normal(this, "requestor is gone, can't send terminal message"); applyByteCounts(); unregisterRequestHandlerWithNode(); return;