Put the client in the to-be-disconnected list.

        This allows the client data structures to be present while the
        disconnect handler is invoked, but still recognize the fact that the
        client is soon going away.
171145
def pre_disconnect(self, sid, namespace):
        
        if namespace not in self.pending_disconnect:
            self.pending_disconnect[namespace] = []
        self.pending_disconnect[namespace].append(sid)
1277045
public void disconnect(Destination d) throws KNXLinkClosedException
	{
		if (detached)
			throw new KNXIllegalStateException("TL detached");
		if (d.getState() != Destination.DESTROYED
			&& d.getState() != Destination.DISCONNECTED)
			disconnectIndicate(getProxy(d), true);
	}
275049
def _log_disconnect(self):
        
        if self.logged:
            self.server.stats.connectionClosed()
            self.logged = False
105437
def disconnect(self, receiver):
        
        if receiver not in self.receivers.keys():
            raise Exception("No receiver %s was registered" % receiver)
        self.receivers[receiver].disconnect()
        del(self.receivers[receiver])
        self.__log.debug("Receiver %s disconnected" % receiver)
53760
def disconnect(self):
        
        if self.ibConn is not None:
            self.log.info("[DISCONNECT FROM IB]")
            self.ibConn.disconnect()
            self._disconnected_by_user = True
55173
def shutdown(self):
        '''
        
        '''
        for item in self.clients:
            client, address = item
            client.close()
            self.clients.remove(item)
203036
@Override
    public synchronized void disconnect() {
        if (connectSession != null) {
            logger.debug("Disconnecting client connection.");
            connectSession.disconnect();
            connectSession = null;
        }
    }
1071325
def _on_disconnect(self, result):
        

        success, _, context = self._parse_return(result)

        callback = context['callback']
        connection_id = context['connection_id']
        handle = context['handle']

        callback(connection_id, self.id, success, "No reason given")
        self._remove_connection(handle)
717782
def disconnect(self, chassis_list):
        
        self._check_session()
        if not isinstance(chassis_list, (list, tuple, set, dict, frozenset)):
            chassis_list = (chassis_list,)

        if len(chassis_list) == 1:
            self._rest.delete_request('connections', chassis_list[0])
        else:
            params = {chassis: True for chassis in chassis_list}
            params['action'] = 'disconnect'
            self._rest.post_request('connections', None, params)
1324890
def on_close(self):
        
        print 'Connection closed.'
        self.remove_client()
        
        client_count = len(self.get_clients().keys())
        new_client_message = '1 client disconnected, now we have %d %s!' % (client_count, 'client' if client_count <= 1 else 'clients')
        self.broadcast(new_client_message)
1009408
function disconnectBody() {
        var key;
        self.loggingOut = true;
        offersPending = {};
        acceptancePending = {};
        self.disconnecting = true;
        closedChannel = self.webSocket;

        if( stillAliveTimer ) {
           clearTimeout(stillAliveTimer);
           stillAliveTimer = null;
        }

        if (self.webSocketConnected) {
            if (!preallocatedSocketIo) {
                self.webSocket.close();
            }
            self.webSocketConnected = false;
        }
        self.hangupAll();
        if (roomOccupantListener) {
            for (key in lastLoggedInList) {
                if (lastLoggedInList.hasOwnProperty(key)) {
                    roomOccupantListener(key, {}, false);
                }
            }
        }
        lastLoggedInList = {};
        self.emitEvent("roomOccupant", {});
        self.roomData = {};
        self.roomJoin = {};
        self.loggingOut = false;
        self.myEasyrtcid = null;
        self.disconnecting = false;
        oldConfig = {};
    }
824936
def disconnect(self):
        

        if self.connection_receive:
            self.connection_receive.close()
        if self.connection_respond:
            self.connection_respond.close()
        if self.connection_send:
            self.connection_send.close()
1028528
public void disconnect() {
        Presence unavailablePresence = null;
        if (isAuthenticated()) {
            unavailablePresence = new Presence(Presence.Type.unavailable);
        }
        try {
            disconnect(unavailablePresence);
        }
        catch (NotConnectedException e) {
            LOGGER.log(Level.FINEST, "Connection is already disconnected", e);
        }
    }
1266740
def _handle_disconnect(self, sid, namespace):
        """"""
        namespace = namespace or '/'
        if namespace == '/':
            namespace_list = list(self.manager.get_namespaces())
        else:
            namespace_list = [namespace]
        for n in namespace_list:
            if n != '/' and self.manager.is_connected(sid, n):
                self._trigger_event('disconnect', n, sid)
                self.manager.disconnect(sid, n)
        if namespace == '/' and self.manager.is_connected(sid, namespace):
            self._trigger_event('disconnect', '/', sid)
            self.manager.disconnect(sid, '/')
101957
def my_on_connect(client):
    
    client.send('You connected from %s\n' % client.addrport())
    if CLIENTS:
        client.send('Also connected are:\n')
        for neighbor in CLIENTS:
            client.send('%s\n' % neighbor.addrport())
    else:
        client.send('Sadly, you are alone.\n')
    CLIENTS.append(client)
259445
async def disconnect_message(self, message, context):
        

        conn_string = message.get('connection_string')
        client_id = context.user_data

        await self.disconnect(client_id, conn_string)
469682
def connectionLost(self, reason=protocol.connectionDone):
        
        self.connected = 0

        for pending in self._queue.values():
            pending.errback(reason)
        self._queue.clear()

        if self._stopped:
            result = self if reason.check(error.ConnectionDone) else reason
            self._stopped.callback(result)
            self._stopped = None
        else:
            reason.raiseException()