#include <ServerConnection.h>
Inheritance diagram for GNE::ServerConnection:
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 > |
|
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. |
|
Intializes this class. Note that you won't create a ServerConnection directly. The ServerConnectionListener does that for you.
|
|
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. |
|
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. |