Main Page | Class Hierarchy | Class List | File List | Class Members

Manager Class Reference

#include <main.h>

Collaboration diagram for Manager:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Manager (PINDEX _loopCount)
 ~Manager ()
void StartGarbageCollection ()
PSafePtr< TCPConnectionGetConnectionWithLock (const PString &token, PSafetyMode mode=PSafeReadOnly)
void RemoveNode (PString &token)
void WaitForIncoming ()
PString ProcessMessagesName ()
void AppendRunning (PSafePtr< TCPConnection > conn, PString id)
void AppendDead (PSafePtr< TCPConnection > conn)
void RemoveGarbageCollector ()
void QuitNow ()
void StopIncomingConnections ()
void GetListConnectedNodes (PStringArray &nodes)
BOOL IsTerminating ()
void OnReleased (TCPConnection &connection)

Protected Member Functions

void CollectGarbage ()
virtual void GarbageMain (PThread &, INT)

Protected Attributes

Manager::ConnectionDict connectionsActive
PThread * garbageCollector
PSyncPoint garbageExit
PTCPSocket listener
PAtomicInteger bogusCount
PAtomicInteger connectionCount
PINDEX loopCount
BOOL terminateNow
TCPConnectionList availableTCPConnections

Classes

class  ConnectionDict

Detailed Description

This handles the list of known connections, and waits for new incoming connections. It will process the commands "list" and "quitnow", to provide additional functionality for remote nodes


Constructor & Destructor Documentation

Manager::Manager PINDEX  _loopCount  ) 
 

Constructor

Manager::~Manager  ) 
 

Destructor


Member Function Documentation

void Manager::AppendDead PSafePtr< TCPConnection conn  ) 
 

Append this connction to connectionsActive. We do not know what label to use on this connection, so we have to make up a label. We label it immediately as bogus, call manager.RemoveNode(), and let the garbage collector kill it

void Manager::AppendRunning PSafePtr< TCPConnection conn,
PString  id
 

Append this connction to connectionsActive, cause it is a valid and running TCPConnection

void Manager::CollectGarbage  )  [protected]
 

The method which does the garbage collection

void Manager::GarbageMain PThread &  ,
INT 
[protected, virtual]
 

This contains the 1 second delay loop, and calls to CollectGarbage

PSafePtr<TCPConnection> Manager::GetConnectionWithLock const PString &  token,
PSafetyMode  mode = PSafeReadOnly
[inline]
 

Find a connection that uses the specified token. This searches the list of TCPConnections for the connection that contains the token as provided

Parameters:
token  Token to identify connection
mode  Mode of access

void Manager::GetListConnectedNodes PStringArray &  nodes  ) 
 

Retrieve the list of connected nodes - which is the keys they are using to identify themselves

BOOL Manager::IsTerminating  )  [inline]
 

Report if we are terminating

void Manager::OnReleased TCPConnection connection  ) 
 

Callback for removing a connection from the list of active connections

PString Manager::ProcessMessagesName  ) 
 

Return a nnew unique name to be assigned to each neew process messages thread for a connection

void Manager::QuitNow  ) 
 

Cause a shutdown of the whole thing

void Manager::RemoveGarbageCollector  ) 
 

Remove and terminate the garbage collector thread

void Manager::RemoveNode PString &  token  ) 
 

Remove the connection with the specified token

void Manager::StartGarbageCollection  ) 
 

start the garbage collection thread now

void Manager::StopIncomingConnections  ) 
 

StopAll incoming connect requests, by closing the socket on port 5000

void Manager::WaitForIncoming  ) 
 

Wait for incoming connections here. On receiving a connection, act on it.


Member Data Documentation

TCPConnectionList Manager::availableTCPConnections [protected]
 

A class that manages the list of available TCPConnection threads

PAtomicInteger Manager::bogusCount [protected]
 

The integer used to create unique id's for the dead TCPConnections

PAtomicInteger Manager::connectionCount [protected]
 

The count of all threads that have beeen spawned to process messages

Manager::ConnectionDict Manager::connectionsActive [protected]
 

The thread safe list of connections that we manage

PThread* Manager::garbageCollector [protected]
 

The thread which runs every second to look for TCPConnections to delete

PSyncPoint Manager::garbageExit [protected]
 

The syncpoint that flags when we exit, and is used to time the 1 second gaps between cleaning

PTCPSocket Manager::listener [protected]
 

The socket that we listen for incoming connections on

PINDEX Manager::loopCount [protected]
 

The number of connection requests to fully process. The default of 0 means infinite

BOOL Manager::terminateNow [protected]
 

A flag that is set wwhen we (the manager) are told to terminate and die


The documentation for this class was generated from the following files:
Generated on Sun Jan 29 19:49:42 2006 for SSServer, or Sofa Switch Server by  doxygen 1.4.4