Gnutella::PacketProcessing::PongCache Class Reference

#include <PongCache.h> [code]

Inherits QObject.

Inheritance diagram for Gnutella::PacketProcessing::PongCache:

Inheritance graph
[legend]
Collaboration diagram for Gnutella::PacketProcessing::PongCache:

Collaboration graph
[legend]
List of all members.

Detailed Description

Todo:
Move the member definitons to the cpp.

Use EMA for Daily Uptimes: An exponential moving average (EMA) is actually a specific type of weighted moving average. It uses a constant (a smoothing factor) between 0 and 1 in the following manner: the current closing price (C) multiplied by the smoothing constant (S) added to the product of the previous day's exponential moving average value (PEMA) and 1 minus the smoothing factor, or: Today's EMA = S*C + (1 - S)*PEMA

Definition at line 58 of file PongCache.h.

Public Types

typedef PacketProcessor::Sessions Paths

Public Member Functions

 PongCache (PacketProcessor *pp, LocalPeer *)
 ~PongCache ()
void addSession (PacketSession *session)
void removeSession (PacketSession *session)
void cachePong (const Pong &, PacketSession *)
void sendCachedPongs (const Ping &, PacketSession *session)
Paths pingRoutePaths (const Ping &)

Private Types

typedef QPair< Pong, PacketSession * > PongInfo
typedef QQueue< PongInfo * > PongForwardQueue
typedef QMap< PacketSession *,
SessionData * > 
Sessions
enum  Constants {
  MinimalPingInterval = 1000,
  PongExpirationTime = 10000,
  MaximalPongHops = 5,
  PongsPerHops = 1
}

Private Slots

void refreshCache ()

Private Member Functions

 PongCache (const PongCache &)
PongCacheoperator= (const PongCache &)

Private Attributes

LocalPeerlocalPeer
PacketProcessorpacketProcessor
SlotAllocatorslotAllocator
Ping directPing
Pong directPong
Pong hostPong
QTimer pingTimer
PongForwardQueue pongForwardQueue [MaximalPongHops]
PongForwardQueue cachedPongForwardQueue [MaximalPongHops]
Sessions sessions

Classes

struct  SessionData


Member Typedef Documentation

typedef PacketProcessor::Sessions Gnutella::PacketProcessing::PongCache::Paths
 

Definition at line 64 of file PongCache.h.

typedef QQueue<PongInfo *> Gnutella::PacketProcessing::PongCache::PongForwardQueue [private]
 

Definition at line 109 of file PongCache.h.

typedef QPair<Pong, PacketSession *> Gnutella::PacketProcessing::PongCache::PongInfo [private]
 

Definition at line 108 of file PongCache.h.

typedef QMap<PacketSession *, SessionData *> Gnutella::PacketProcessing::PongCache::Sessions [private]
 

Definition at line 110 of file PongCache.h.


Member Enumeration Documentation

enum Gnutella::PacketProcessing::PongCache::Constants [private]
 

Enumerator:
MinimalPingInterval 
PongExpirationTime 
MaximalPongHops 
PongsPerHops 

Definition at line 81 of file PongCache.h.


Constructor & Destructor Documentation

Gnutella::PacketProcessing::PongCache::PongCache const PongCache  )  [private]
 

PongCache::PongCache PacketProcessor pp,
LocalPeer
 

Definition at line 55 of file PongCache.cpp.

PongCache::~PongCache  ) 
 

Todo:
Clear cache.

Definition at line 115 of file PongCache.cpp.


Member Function Documentation

void PongCache::addSession PacketSession session  ) 
 

Definition at line 119 of file PongCache.cpp.

void PongCache::cachePong const Pong pong,
PacketSession session
 

Todo:
Split the function into parts.

Maybe implement the direct ping/pong as over the filter mechanism?

Definition at line 215 of file PongCache.cpp.

PongCache& Gnutella::PacketProcessing::PongCache::operator= const PongCache  )  [private]
 

PongCache::Paths PongCache::pingRoutePaths const Ping  ) 
 

Definition at line 197 of file PongCache.cpp.

void PongCache::refreshCache  )  [private, slot]
 

Definition at line 237 of file PongCache.cpp.

void PongCache::removeSession PacketSession session  ) 
 

Definition at line 126 of file PongCache.cpp.

void PongCache::sendCachedPongs const Ping ping,
PacketSession session
 

Todo:
Split in smaller functions!
Todo:
iterate over the cached pongs and directly move them

Definition at line 136 of file PongCache.cpp.


Member Data Documentation

PongForwardQueue Gnutella::PacketProcessing::PongCache::cachedPongForwardQueue[MaximalPongHops] [private]
 

Definition at line 113 of file PongCache.h.

Ping Gnutella::PacketProcessing::PongCache::directPing [private]
 

Definition at line 103 of file PongCache.h.

Pong Gnutella::PacketProcessing::PongCache::directPong [private]
 

Definition at line 104 of file PongCache.h.

Pong Gnutella::PacketProcessing::PongCache::hostPong [private]
 

Definition at line 105 of file PongCache.h.

LocalPeer* Gnutella::PacketProcessing::PongCache::localPeer [private]
 

Definition at line 99 of file PongCache.h.

PacketProcessor* Gnutella::PacketProcessing::PongCache::packetProcessor [private]
 

Definition at line 100 of file PongCache.h.

QTimer Gnutella::PacketProcessing::PongCache::pingTimer [private]
 

Definition at line 106 of file PongCache.h.

PongForwardQueue Gnutella::PacketProcessing::PongCache::pongForwardQueue[MaximalPongHops] [private]
 

Definition at line 112 of file PongCache.h.

Sessions Gnutella::PacketProcessing::PongCache::sessions [private]
 

Definition at line 114 of file PongCache.h.

SlotAllocator* Gnutella::PacketProcessing::PongCache::slotAllocator [private]
 

Definition at line 101 of file PongCache.h.


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