forest-net
an overlay networks for large-scale virtual worlds
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator
forest::RepeatHandler Class Reference

Class to aid in handling repeated control packets. More...

#include <RepeatHandler.h>

Collaboration diagram for forest::RepeatHandler:

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
 

Detailed Description

Class to aid in handling repeated control packets.

Definition at line 28 of file RepeatHandler.h.

Constructor & Destructor Documentation

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.

Member Function Documentation

int forest::RepeatHandler::expired ( int64_t  now)

Check for an expired packet and delete it.

Parameters
nowis the current time
Returns
the packet index of the oldest expired packet, or 0 if there is no expired packet

Definition at line 81 of file RepeatHandler.cpp.

Here is the caller graph for this function:

int forest::RepeatHandler::find ( fAdr_t  peerAdr,
int64_t  seqNum 
)

Look for a saved packet with a given peer address and sequence number.

Parameters
peerAdris the peer address for the packet
seqNumis the packet's sequence number
Returns
the packet index for the packet, or 0 if no match;

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.

Parameters
cxis the packet index for the reply packet corresponding to a saved request packet
peerAdris the Forest address of the sender of the original request
seqNumis the sequence number assigned to the reply
Returns
the index associated with the saved copy of the original request, or 0 if no matching request was found

Definition at line 65 of file RepeatHandler.cpp.

Here is the caller graph for this function:

bool forest::RepeatHandler::saveReq ( int  cx,
fAdr_t  peerAdr,
int64_t  seqNum,
int64_t  now 
)

Save a copy of a received request packet.

Parameters
cxis a copy of a received request packet
peerAdris the Forest address of the sender
seqNumis the sequence number assigned to the packet
nowis the current time
Returns
true on success, false on failure

Definition at line 40 of file RepeatHandler.cpp.

Here is the caller graph for this function:


The documentation for this class was generated from the following files: