public final class RequestSender extends BaseSender implements PrioRunnable
BaseSender.DOdontDecrementHTLThisTime, gotMessages, hasForwarded, htl, lastMessage, lastNode, nodesRoutedTo, origHTL, rejectOverloads, routeAttempts, startTime| Constructor and Description |
|---|
RequestSender(Key key,
DSAPublicKey pubKey,
short htl,
long uid,
RequestTag tag,
Node n,
PeerNode source,
boolean offersOnly,
boolean canWriteClientCache,
boolean canWriteDatastore,
boolean realTimeFlag)
RequestSender constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
abortedDownstreamTransfers() |
void |
addListener(RequestSenderListener l) |
protected Message |
createDataRequest() |
long |
fetchTimeout() |
protected void |
forwardRejectedOverload()
Forward RejectedOverload to the request originator
|
protected long |
getAcceptedTimeout() |
byte[] |
getHeaders() |
short |
getHTL() |
PartiallyReceivedBlock |
getPRB() |
int |
getPriority() |
SSKBlock |
getSSKBlock() |
int |
getStatus() |
int |
getTotalReceivedBytes() |
int |
getTotalSentBytes() |
protected void |
handleAcceptedRejectedTimeout(PeerNode next,
UIDTag origTag) |
protected boolean |
isInsert() |
boolean |
isLocalRequestSearch() |
boolean |
isTransferCoalesced() |
protected MessageFilter |
makeAcceptedRejectedFilter(PeerNode next,
long acceptedTimeout,
UIDTag tag)
Construct a filter to wait the specified time for accepted or rejected.
|
protected void |
onAccepted(PeerNode next) |
protected void |
onAccepted(PeerNode next,
boolean forked,
short htl)
If we handled a timeout, and forked, we need to know the original HTL.
|
void |
receivedBytes(int x) |
protected void |
routeRequests()
Route requests.
|
void |
run() |
void |
sentBytes(int x)
Sent some bytes.
|
void |
sentPayload(int x)
Sent payload - only include the number of bytes of actual payload i.e.
|
void |
setTransferCoalesced() |
void |
start() |
PeerNode |
successFrom() |
protected void |
timedOutWhileWaiting(double load)
We timed out while waiting for a slot from any node.
|
java.lang.String |
toString() |
PeerNode |
transferringFrom() |
boolean |
transferStarted() |
byte[] |
waitForOpennetNoderef() |
short |
waitUntilStatusChange(short mask)
Wait until either the transfer has started, we receive a
RejectedOverload, or we get a terminal status code.
|
calculateTimeout, calculateTimeout, getLongSlotWaiterTimeout, getShortSlotWaiterTimeout, hopsForFatalTimeoutWaitingForPeer, ignoreLowBackoff, innerRouteRequests, innerRouteRequestsNew, innerRouteRequestsOld, isAccepted, routedLast, sourceForRouting, timeSinceSentpublic RequestSender(Key key, DSAPublicKey pubKey, short htl, long uid, RequestTag tag, Node n, PeerNode source, boolean offersOnly, boolean canWriteClientCache, boolean canWriteDatastore, boolean realTimeFlag)
key - The key to request. Its public key should have been looked up
already; RequestSender will not look it up.realTimeFlag - If enabled,public java.lang.String toString()
toString in class java.lang.Objectpublic void start()
public void run()
run in interface java.lang.Runnableprotected void routeRequests()
routeRequests in class BaseSenderprotected MessageFilter makeAcceptedRejectedFilter(PeerNode next, long acceptedTimeout, UIDTag tag)
BaseSendermakeAcceptedRejectedFilter in class BaseSendernext - The peer we are waiting for a response from.acceptedTimeout - The time to wait.tag - Use the UID from this tag. Some requests may change the tag
after some hops, and if e.g. waiting for confirmation after a timeout,
we need to use the old tag.protected Message createDataRequest()
createDataRequest in class BaseSenderprotected void forwardRejectedOverload()
forwardRejectedOverload in class BaseSenderpublic PartiallyReceivedBlock getPRB()
public boolean transferStarted()
public short waitUntilStatusChange(short mask)
mask - Bitmask indicating what NOT to wait for i.e. the situation when this function
exited last time (see WAIT_ constants above). Bits can also be set true even though they
were not valid, to indicate that the caller doesn't care about that bit.
If zero, function will throw an IllegalArgumentException.public byte[] waitForOpennetNoderef()
throws freenet.node.OpennetManager.WaitedTooLongForOpennetNoderefException
freenet.node.OpennetManager.WaitedTooLongForOpennetNoderefExceptionpublic PeerNode successFrom()
public byte[] getHeaders()
public int getStatus()
public short getHTL()
public SSKBlock getSSKBlock()
public void sentBytes(int x)
ByteCountersentBytes in interface ByteCounterpublic int getTotalSentBytes()
public void receivedBytes(int x)
receivedBytes in interface ByteCounterpublic int getTotalReceivedBytes()
public void sentPayload(int x)
ByteCountersentPayload in interface ByteCounterx - Number of bytes sentpublic boolean isLocalRequestSearch()
public void addListener(RequestSenderListener l)
public int getPriority()
getPriority in interface PrioRunnablepublic PeerNode transferringFrom()
public boolean abortedDownstreamTransfers()
public long fetchTimeout()
public void setTransferCoalesced()
public boolean isTransferCoalesced()
protected void onAccepted(PeerNode next)
onAccepted in class BaseSenderprotected void onAccepted(PeerNode next, boolean forked, short htl)
protected long getAcceptedTimeout()
getAcceptedTimeout in class BaseSenderprotected void timedOutWhileWaiting(double load)
BaseSendertimedOutWhileWaiting in class BaseSenderload - The proportion of requests getting timed out, on average,
across the nodes we are waiting for. This is used to decide how long the
RecentlyFailed should be for.protected boolean isInsert()
isInsert in class BaseSenderprotected void handleAcceptedRejectedTimeout(PeerNode next, UIDTag origTag)
handleAcceptedRejectedTimeout in class BaseSender