Module tox::toxcore::timeout
[−]
[src]
Managing requests IDs and timeouts.
Peers are to be timed out when they do not show any activity before running into a timeout.
Timeout data to store:
- Instant (when was the last interaction with given peer)
- request ID (from PingReq, GetNodes, ..other?)
- PK (unique identifier of a peer)
- does it really need to be stored? can't it be a reference to PK stored somewhere else? it's "just" 32 bytes, but still
- can it be replaced by futures?
By what storage needs to be accessed:
- timeout, based on Instant::elapsed() < Duration::from_secs(TIMEOUT);
- sorting according to increasing timeout?
- multiple storages according to what the timeout is for?
- Request ID: remove NodeTimeout from the queue if IDs match and spawn TimeoutFuture
How it is supposed to work
Storage for timeouts
- store
NodeTimeoutinVecDeque- separate queues for each
PacketKindrequest
- separate queues for each
- append new timeouts at the end of the queue
front()to check if first timeout is to be triggeredpop_front()to remove timeout from queue if it's past it
Dependant behaviour
- Once it's past the
NodeTimeout, remove it from both queue and:
Timeout future
Possibly create a new TimoutFuture for each known node – future is
created to trigger GetNodes requests.
Structs
| NodeTimeout |
A DHT node's associated timeout info. |
| TimeoutQueue |
Store & manage timeout data. |
Enums
| NodeState |
Enum stating whether we consider responsiveness of given DHT node
as |
Constants
| BAD_TIME |
Number of seconds after which DHT node is considered to be |
| PING_TIMEOUT |
Number of seconds to reach ping timeout. DHT node has to respond to a
|
| RESPONSE_CHECK |
Number of seconds between each time that a DHT node needs to be checked
for responsiveness by sending to it a |
| UNRESPONSIVE_TIME |
Number of seconds after which DHT node is considered to be |