forest-net
an overlay networks for large-scale virtual worlds
|
Class to aid in handling repeated control packets. More...
#include <RepeatHandler.h>
Public Member Functions | |
RepeatHandler (int) | |
Constructor for RepeatHandler. More... | |
~RepeatHandler () | |
Destructor for RepeatHandler. More... | |
int | find (fAdr_t, int64_t) |
Look for a saved packet with a given peer address and sequence number. More... | |
bool | saveReq (int, fAdr_t, int64_t, int64_t) |
Save a copy of a received request packet. More... | |
int | saveRep (int, fAdr_t, int64_t) |
Match a reply to a saved request and update. More... | |
int | expired (int64_t) |
Check for an expired packet and delete it. More... | |
Private Attributes | |
int | n |
HashMap< Pair< fAdr_t, int64_t > , int, Hash::s32s64 > * | pmap |
maps seqNum->(pktx,repCount) | |
Dheap< int64_t > * | deadlines |
heap of packets waiting on replies | |
Class to aid in handling repeated control packets.
Definition at line 28 of file RepeatHandler.h.
forest::RepeatHandler::RepeatHandler | ( | int | size) |
Constructor for RepeatHandler.
Definition at line 14 of file RepeatHandler.cpp.
forest::RepeatHandler::~RepeatHandler | ( | ) |
Destructor for RepeatHandler.
Definition at line 20 of file RepeatHandler.cpp.
int forest::RepeatHandler::expired | ( | int64_t | now) |
Check for an expired packet and delete it.
now | is the current time |
Definition at line 81 of file RepeatHandler.cpp.
int forest::RepeatHandler::find | ( | fAdr_t | peerAdr, |
int64_t | seqNum | ||
) |
Look for a saved packet with a given peer address and sequence number.
peerAdr | is the peer address for the packet |
seqNum | is the packet's sequence number |
Definition at line 27 of file RepeatHandler.cpp.
int forest::RepeatHandler::saveRep | ( | int | cx, |
fAdr_t | peerAdr, | ||
int64_t | seqNum | ||
) |
Match a reply to a saved request and update.
The request packet's index is removed from the saved entry and replaced with the reply packet's index.
cx | is the packet index for the reply packet corresponding to a saved request packet |
peerAdr | is the Forest address of the sender of the original request |
seqNum | is the sequence number assigned to the reply |
Definition at line 65 of file RepeatHandler.cpp.
bool forest::RepeatHandler::saveReq | ( | int | cx, |
fAdr_t | peerAdr, | ||
int64_t | seqNum, | ||
int64_t | now | ||
) |
Save a copy of a received request packet.
cx | is a copy of a received request packet |
peerAdr | is the Forest address of the sender |
seqNum | is the sequence number assigned to the packet |
now | is the current time |
Definition at line 40 of file RepeatHandler.cpp.