Public Types | |
enum | Status { NotStarted, AcceptingConnections, Paused, ShuttingDown, Stopped, Indeterminate } |
Public Member Functions | |
CServerCollection () | |
Creates an empty collection. | |
CServerCollection (const CServerCollection &rhs) | |
~CServerCollection () override | |
CServerCollection & | operator= (const CServerCollection &rhs) |
void | AddServer (IServerControl *pServer) |
Adds an instance of IServerControl to the collection and takes ownership of the instance; it will be deleted when the collection is destroyed. | |
void | AddServer (IServerControl &server) |
Adds an instance of IServerControl to the collection and does not take ownership of the instance. | |
void | RemoveServers () |
Removes all instances from the collection and destroys those instances that the collection owns. | |
void | Start () override |
void | StartAcceptingConnections () override |
void | StopAcceptingConnections () override |
void | BeginShutdown () override |
Starts the shutdown process and returns immediately. | |
void | WaitForShutdownToComplete () override |
Initiates a shutdown (if one isn't already in progresss) and then waits for it to complete. Does not return until the shutdown has completed. | |
bool | WaitForShutdownToComplete (Milliseconds timeout) override |
Initiates a shutdown (if one isn't already in progresss) and then waits for the supplied number of milliseconds for it to complete. Returns true if the shutdown completed successfully before the timeout expired and false if it didn't. Note that EACH server in the collection is given the timeout to shutdown. The timeout does NOT apply to the collection as a whole. | |
void | ForceShutdown () override |
If a shutdown is hung due to sockets still being active then you can force a shutdown to complete by calling this function. Note: USE WITH CARE!!! The usual usage pattern is to call WaitForShutdownToComplete() with a timeout and if that fails then to call ForceShutdown() to allow the object in question to be destroyed (in general the object would call WaitForShutdownToComplete() in its destructor and hang there!). | |
Status | GetStatus () const override |
Returns the status of the server. | |
bool | WaitForShutdownToComplete (Milliseconds timeout, IServerShutdownCallback &callback, void *pUserData=nullptr) |
Initiates a shutdown (if one isn't already in progresss) and then waits for the supplied number of milliseconds for it to complete. Returns true if the shutdown completed successfully before the timeout expired and false if it didn't. Note that EACH server in the collection is given the timeout to shutdown. The timeout does NOT apply to the collection as a whole. Note that you are called back for each server that is shutting down via the supplied callback interface. | |
Static Public Member Functions | |
static JetByteTools::Core::_tstring | GetStatusAsString (Status status) |
enum Status [inherited] |
Creates an empty collection.
CServerCollection | ( | const CServerCollection & | rhs | ) |
~CServerCollection | ( | ) | [override] |
CServerCollection& operator= | ( | const CServerCollection & | rhs | ) |
void AddServer | ( | IServerControl * | pServer | ) |
Adds an instance of IServerControl to the collection and takes ownership of the instance; it will be deleted when the collection is destroyed.
void AddServer | ( | IServerControl & | server | ) |
Adds an instance of IServerControl to the collection and does not take ownership of the instance.
void RemoveServers | ( | ) |
Removes all instances from the collection and destroys those instances that the collection owns.
void Start | ( | ) | [override, virtual] |
Implements IServerControl.
void StartAcceptingConnections | ( | ) | [override, virtual] |
Implements IServerControl.
void StopAcceptingConnections | ( | ) | [override, virtual] |
Implements IServerControl.
void BeginShutdown | ( | ) | [override, virtual] |
void WaitForShutdownToComplete | ( | ) | [override, virtual] |
Initiates a shutdown (if one isn't already in progresss) and then waits for it to complete. Does not return until the shutdown has completed.
Implements IServerControl.
bool WaitForShutdownToComplete | ( | Milliseconds | timeout | ) | [override, virtual] |
Initiates a shutdown (if one isn't already in progresss) and then waits for the supplied number of milliseconds for it to complete. Returns true if the shutdown completed successfully before the timeout expired and false if it didn't. Note that EACH server in the collection is given the timeout to shutdown. The timeout does NOT apply to the collection as a whole.
Implements IServerControl.
void ForceShutdown | ( | ) | [override, virtual] |
If a shutdown is hung due to sockets still being active then you can force a shutdown to complete by calling this function. Note: USE WITH CARE!!! The usual usage pattern is to call WaitForShutdownToComplete() with a timeout and if that fails then to call ForceShutdown() to allow the object in question to be destroyed (in general the object would call WaitForShutdownToComplete() in its destructor and hang there!).
Implements IServerControl.
IServerControl::Status GetStatus | ( | ) | const [override, virtual] |
bool WaitForShutdownToComplete | ( | Milliseconds | timeout, | |
IServerShutdownCallback & | callback, | |||
void * | pUserData = nullptr | |||
) |
Initiates a shutdown (if one isn't already in progresss) and then waits for the supplied number of milliseconds for it to complete. Returns true if the shutdown completed successfully before the timeout expired and false if it didn't. Note that EACH server in the collection is given the timeout to shutdown. The timeout does NOT apply to the collection as a whole. Note that you are called back for each server that is shutting down via the supplied callback interface.
_tstring GetStatusAsString | ( | Status | status | ) | [static, inherited] |