protected class KRPC.ReplyWaiter extends SimpleTimer2.TimedEvent
_state, DEFAULT_FUZZ| Constructor and Description |
|---|
ReplyWaiter(MsgID mID,
NodeInfo nInfo,
Runnable onReply,
Runnable onTimeout)Either wait on this object with a timeout, or use non-null Runnables. |
| Modifier and Type | Method and Description |
|---|---|
int | getReplyCode()If nonzero, we got a reply, and getReplyObject() may contain something. |
Object | getReplyObject()Should contain null if getReplyCode is REPLY_PONG. |
Object | getSentObject()The object stored with setSentObject(). |
NodeInfo | getSentTo()The destination the packet was sent to. |
void | gotReply(int code,
Object o)Will notify this and run onReply. |
void | networkFail()Will notify this but not run onReply or onTimeout, or remove from _sentQueries, or call
heardFrom(). |
void | setSentObject(Object o)Only used for get_peers, to save the Info Hash. |
void | timeReached()Timer callback on timeout. |
cancel, forceReschedule, reschedule, reschedule, run, schedule, setFuzz, setPool, toStringpublic ReplyWaiter(MsgID mID, NodeInfo nInfo, Runnable onReply, Runnable onTimeout)
onReply - must be fast, otherwise set to null and wait on this UNUSEDonTimeout - must be fast, otherwise set to null and wait on this UNUSEDpublic int getReplyCode()
public Object getReplyObject()
public Object getSentObject()
public NodeInfo getSentTo()
public void gotReply(int code,
Object o)public void networkFail()
public void setSentObject(Object o)
public void timeReached()
timeReached in class SimpleTimer2.TimedEvent