Example #1
0
void AsyncServerSocket::destroy() {
  stopAccepting();
  for (auto s : pendingCloseSockets_) {
    closeNoInt(s);
  }
  // Then call DelayedDestruction::destroy() to take care of
  // whether or not we need immediate or delayed destruction
  DelayedDestruction::destroy();
}
Example #2
0
void ScarabServer::shutdown() {
    // shut down the accept thread.
    stopAccepting();
    if(acceptThread) {
        acceptThread->cancel();
    }
    if(tempClient) {
        delete tempClient;
        tempClient = NULL;
    }
    // disconnect every client.
    for(int i = 0; i < numberOfConnectedClients; i++) {
        disconnectClient(i);
    }
    if(listening) {
        scarab_session_close(listeningSocket);
        listening = false;
        listeningSocket = NULL;
    }
}