/** * @method : SockServer::remove_client * @param : * > client : Socket object. * @desc : * remove client object pointed by 'client' from list of clients. */ void SockServer::remove_client(Socket* client) { if (! client) { return; } lock_client(); if (client == _clients) { _clients = _clients->_next; if (_clients) { _clients->_prev = NULL; } } else { if (client->_prev) { client->_prev->_next = client->_next; } if (client->_next) { client->_next->_prev = client->_prev; } } client->_next = NULL; client->_prev = NULL; unlock_client(); }
void remove_client(struct client_struct *client) { int res; /* lock client */ lock_client(client); client->status=NOTIFYFS_CLIENTSTATUS_DOWN; /* unlock client do not destroy it yet, this is done when the client really disconnects from socket */ unlock_client(client); }
/** * @method : SockServer::add_client * @param : * > client : socket object. * @desc : add client object to list of clients. */ void SockServer::add_client(Socket* client) { if (!client) { return; } lock_client(); if (!_clients) { _clients = client; } else { Socket* p = _clients; while (p->_next) { p = p->_next; } p->_next = client; client->_prev = p; } unlock_client(); }