Main Page   Modules   Namespace List   Class Hierarchy   Compound List   Namespace Members   Compound Members   Related Pages  

GNE::ServerConnection Class Reference
[Internal Classes]

#include <ServerConnection.h>

Inheritance diagram for GNE::ServerConnection:

GNE::Connection GNE::Thread List of all members.

Public Types

typedef SmartPtr< ServerConnection > sptr
typedef WeakPtr< ServerConnection > wptr

Public Member Functions

virtual ~ServerConnection ()
 Destructs this ServerConnection object.

void start ()
 Starts the connection process.


Static Public Member Functions

sptr create (const ConnectionParams &p, NLsocket rsocket, const SmartPtr< ServerConnectionListener > &creator)
 Intializes this class.


Protected Member Functions

 ServerConnection ()
 We need information gained from setThisPointer to initialize, so the real work is done in the init method, which should be called right after constructon and setThisPointer has been called.

void init (const ConnectionParams &p, NLsocket rsocket, const SmartPtr< ServerConnectionListener > &creator)
void run ()
void shutDown ()
 Makes a request that this thread should shutdown.


Friends

class boost::weak_ptr< Thread >
class boost::shared_ptr< Thread >
class boost::weak_ptr< Connection >
class boost::shared_ptr< Connection >

Detailed Description

A GNE "internal" class. Users will use this class, but probably only as its base class -- a Connection. This class is created by ServerConnectionListener when incoming connections are comming in.


Constructor & Destructor Documentation

GNE::ServerConnection::~ServerConnection  )  [virtual]
 

Destructs this ServerConnection object.

The user need not worry about the fact that ServerConnection is a thread (in the sense that the user never need to call detach or join), to do a proper cleanup.


Member Function Documentation

ServerConnection::sptr GNE::ServerConnection::create const ConnectionParams p,
NLsocket  rsocket,
const SmartPtr< ServerConnectionListener > &  creator
[static]
 

Intializes this class.

Note that you won't create a ServerConnection directly. The ServerConnectionListener does that for you.

Parameters:
rsocket2 the reliable socket received from the accept command.
creator the ServerConnectionListener that created us, so that we may call its onListenFailure event. This strong pointer will be released after the connection finished, as to not worry about cycles.
See also:
ServerConnectionListener

void GNE::ServerConnection::run  )  [protected, virtual]
 

If an error occurs:

Before onNewConn: ServerConnectionListener::onListenFailure() is called.

During onNewConn: Only onNewConn is called and is reponsible for catching the exception and cleaning up anything it has done. onDisconnect will NOT be called, but onListenFailure will be.

After onNewConn: onFailure then onDisconnect.

After onNewConn is called successfully, then ServerConnectionListener::onListenSuccess is called.

Implements GNE::Thread.

void GNE::ServerConnection::shutDown  )  [protected, virtual]
 

Makes a request that this thread should shutdown.

Tells this thread to shutdown, if it is in an infinite loop. You will probably want to call join right after calling this to wait for the shutdown to complete which is dependant on the thread you are shutting down.

This function is virtual if the thread needs any additional actions to notify itself to shutdown, for example if it is waiting for some event on a ConditionVariable.

You will want to call this function from the override to make sure that shutdown is set to true.

This function is safe to call multiple times, but you cannot undo a shutdown once it has been called.

Reimplemented from GNE::Thread.


The documentation for this class was generated from the following files:
Generated on Fri Aug 22 13:40:06 2003 for GNE by doxygen1.3