public class SSKInsertSender extends BaseSender implements PrioRunnable, AnyInsertSender, ByteCounter
dontDecrementHTLThisTime, gotMessages, hasForwarded, htl, lastMessage, lastNode, nodesRoutedTo, origHTL, rejectOverloads, routeAttempts
Modifier and Type | Method and Description |
---|---|
protected Message |
createDataRequest() |
protected void |
forwardRejectedOverload()
Forward RejectedOverload to the request originator.
|
protected long |
getAcceptedTimeout() |
SSKBlock |
getBlock() |
byte[] |
getData() |
byte[] |
getHeaders() |
short |
getHTL() |
int |
getPriority() |
byte[] |
getPubkeyHash() |
PeerNode[] |
getRoutedTo() |
int |
getStatus() |
java.lang.String |
getStatusString() |
static java.lang.String |
getStatusString(int status) |
int |
getTotalReceivedBytes() |
int |
getTotalSentBytes() |
long |
getUID() |
protected void |
handleAcceptedRejectedTimeout(PeerNode next,
UIDTag tag) |
boolean |
hasCollided() |
boolean |
hasRecentlyCollided() |
protected long |
ignoreLowBackoff() |
protected boolean |
isAccepted(Message msg) |
protected boolean |
isInsert() |
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) |
void |
receivedBytes(int x) |
protected void |
routeRequests()
The main route requests loop.
|
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.
|
boolean |
sentRequest() |
protected PeerNode |
sourceForRouting() |
protected void |
timedOutWhileWaiting(double load)
We timed out while waiting for a slot from any node.
|
java.lang.String |
toString() |
calculateTimeout, calculateTimeout, getLongSlotWaiterTimeout, getShortSlotWaiterTimeout, hopsForFatalTimeoutWaitingForPeer, innerRouteRequests, innerRouteRequestsNew, innerRouteRequestsOld, routedLast, timeSinceSent
public void run()
run
in interface java.lang.Runnable
protected void routeRequests()
BaseSender
routeRequests
in class BaseSender
protected void handleAcceptedRejectedTimeout(PeerNode next, UIDTag tag)
handleAcceptedRejectedTimeout
in class BaseSender
protected MessageFilter makeAcceptedRejectedFilter(PeerNode next, long acceptedTimeout, UIDTag tag)
BaseSender
makeAcceptedRejectedFilter
in class BaseSender
next
- 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 void forwardRejectedOverload()
forwardRejectedOverload
in class BaseSender
public int getStatus()
getStatus
in interface AnyInsertSender
public short getHTL()
getHTL
in interface AnyInsertSender
public java.lang.String getStatusString()
getStatusString
in interface AnyInsertSender
public static java.lang.String getStatusString(int status)
public boolean sentRequest()
sentRequest
in interface AnyInsertSender
public boolean hasRecentlyCollided()
public boolean hasCollided()
public byte[] getPubkeyHash()
public byte[] getHeaders()
public byte[] getData()
public SSKBlock getBlock()
public long getUID()
getUID
in interface AnyInsertSender
public void sentBytes(int x)
ByteCounter
sentBytes
in interface ByteCounter
public int getTotalSentBytes()
public void receivedBytes(int x)
receivedBytes
in interface ByteCounter
public int getTotalReceivedBytes()
public void sentPayload(int x)
ByteCounter
sentPayload
in interface ByteCounter
x
- Number of bytes sentpublic int getPriority()
getPriority
in interface PrioRunnable
public java.lang.String toString()
toString
in class java.lang.Object
public PeerNode[] getRoutedTo()
protected Message createDataRequest()
createDataRequest
in class BaseSender
protected long getAcceptedTimeout()
getAcceptedTimeout
in class BaseSender
protected void timedOutWhileWaiting(double load)
BaseSender
timedOutWhileWaiting
in class BaseSender
load
- 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 isAccepted(Message msg)
isAccepted
in class BaseSender
protected void onAccepted(PeerNode next)
onAccepted
in class BaseSender
protected boolean isInsert()
isInsert
in class BaseSender
protected PeerNode sourceForRouting()
sourceForRouting
in class BaseSender
protected long ignoreLowBackoff()
ignoreLowBackoff
in class BaseSender