clientlist.cpp File Reference

Implementation of ClientList class. More...

#include <hn/hnprec.h>
#include "clientlist.h"
#include "parser.h"
#include "ed2k.h"
#include "clientext.h"
#include "downloadlist.h"
#include <hn/ssocket.h>
#include <boost/lambda/bind.hpp>
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/multi_index/key_extractors.hpp>

Go to the source code of this file.


Namespaces

namespace  Detail

Typedefs

typedef CList::nth_index<
ID_Client >::type 
CMap
typedef CList::nth_index<
ID_Id >::type 
IDMap
typedef CList::nth_index<
ID_Hash >::type 
HashMap
typedef CMap::iterator CIter
typedef IDMap::iterator IIter
typedef HashMap::iterator HashIter

Enumerations

enum  Ed2k_Constants {
  UDP_BUFSIZE = 1024, QUEUE_UPDATE_TIME = 10000, UDP_REASK_INTERVAL = 10*60*1000, QUEUE_DROPTIME = 60*60*1000,
  CONNECT_TIMEOUT = 15000
}
enum  { ID_Client, ID_Id, ID_Hash }
 Different index ID's. More...

Functions

 IMPLEMENT_EVENT_TABLE (ClientList, ClientList *, ClientList::ClientListEvt)
bool scoreComp (const Client *const x, const Client *const y)

Variables

const std::string TRACE_CLIENT = "Ed2kClient"
const std::string TRACE_SECIDENT = "Ed2kClient::SecIdent"
const std::string TRACE_DEADSRC = "ED2KClient::DeadSource"
const std::string TRACE_CLIST = "Ed2k::ClientList"
const std::string TRACE_SRCEXCH = "ED2KClient::SourceExchange"

Detailed Description

Implementation of ClientList class.

Definition in file clientlist.cpp.


Typedef Documentation

typedef CList::nth_index<ID_Client>::type Detail::CMap
 

Definition at line 97 of file clientlist.cpp.

typedef CList::nth_index<ID_Id>::type Detail::IDMap
 

Definition at line 98 of file clientlist.cpp.

typedef CList::nth_index<ID_Hash>::type Detail::HashMap
 

Definition at line 99 of file clientlist.cpp.

typedef CMap::iterator Detail::CIter
 

Definition at line 100 of file clientlist.cpp.

typedef IDMap::iterator Detail::IIter
 

Definition at line 101 of file clientlist.cpp.

typedef MIDownloadList::nth_index< ID_Hash >::type::iterator Detail::HashIter
 

Definition at line 102 of file clientlist.cpp.


Enumeration Type Documentation

enum Ed2k_Constants
 

Enumeration values:
UDP_BUFSIZE  Size of the udp listener's input buffer size; UDP packets exceeding this size will be truncated.

Since the UDP buffer is reused for new packets (and not reallocated), changing this shouldn't have any effect on performance.

QUEUE_UPDATE_TIME  How often to recalculate the queue scores and resort the queue.

Since this is rather time-consuming operation if the queue is big, this is done on regular intervals.

UDP_REASK_INTERVAL  When previous UDP attempt timeouts, how long to wait until next try?
QUEUE_DROPTIME  How long we keep clients in queue who haven't performed any kind of reask.

CONNECT_TIMEOUT  Specifies the TCP connection attempt timeout.

Definition at line 33 of file clientlist.cpp.

anonymous enum
 

Different index ID's.

Enumeration values:
ID_Client 
ID_Id 
ID_Hash 

Definition at line 96 of file clientlist.cpp.


Function Documentation

IMPLEMENT_EVENT_TABLE ClientList  ,
ClientList ,
ClientList::ClientListEvt 
 

bool scoreComp const Client *const   x,
const Client *const   y
 

Definition at line 427 of file clientlist.cpp.

References Client::getScore().

Referenced by ClientList::updateQueue().


Variable Documentation

const std::string TRACE_CLIENT = "Ed2kClient"
 

Definition at line 69 of file clientlist.cpp.

const std::string TRACE_SECIDENT = "Ed2kClient::SecIdent"
 

Definition at line 70 of file clientlist.cpp.

Referenced by ClientList::exit(), Client::onPacket(), Client::sendSignature(), and Client::verifyIdent().

const std::string TRACE_DEADSRC = "ED2KClient::DeadSource"
 

Definition at line 71 of file clientlist.cpp.

Referenced by Client::establishConnection(), Client::onPacket(), Client::onSocketEvent(), Client::sendNextChunk(), and Client::startUpload().

const std::string TRACE_CLIST = "Ed2k::ClientList"
 

Definition at line 72 of file clientlist.cpp.

Referenced by ClientList::exit(), ClientList::onIdChange(), ClientList::onServerEvent(), ClientList::removeClient(), ClientList::startNextUpload(), and ClientList::updateQueue().

const std::string TRACE_SRCEXCH = "ED2KClient::SourceExchange"
 

Definition at line 73 of file clientlist.cpp.

Referenced by DownloadList::init(), and Client::onPacket().