Closes the connection to the service.

 @see    Connection#disconnect

 @return [void]
429319
def disconnect
      if @connection.respond_to?(:actors)
        @connection.actors.each do |connection|
          connection.async.disconnect if connection.alive?
        end
      else
        @connection.async.disconnect if @connection.alive?
      end
    end
291439
public function disconnect()
    {
        if ( $this->state != self::STATE_NOT_CONNECTED )
        {
            $this->connection->sendData( 'QUIT' );
            $this->connection->getLine(); // discard
            $this->state = self::STATE_UPDATE;

            $this->connection->close();
            $this->connection = null;
            $this->state = self::STATE_NOT_CONNECTED;
        }
    }
1301795
public function disconnect()
    {
        if (!is_array($this->conn) || !count($this->conn)) {
            return;
        }

        foreach ($this->conn as $conn) {
            Connection::close($conn);
        }
    }
395942
def disconnect(self):
        
        # Stop the timer
        self.__stop_timer()

        # Unlock all publishers
        for event in self.__in_flight.values():
            event.set()

        # Disconnect from the server
        self.__mqtt.disconnect()

        # Stop the MQTT loop thread
        # Use a thread to avoid a dead lock in Paho
        thread = threading.Thread(target=self.__mqtt.loop_stop)
        thread.daemon = True
        thread.start()

        # Give it some time
        thread.join(4)
1149238
def close(scope):
    
    conn = scope.get('__connection__')
    conn.close(1)
    scope.define(__response__=conn.response)
    return True
984193
public function closeConnection()
    {
        if ($this->logged && $this->putLine($this->nextTag() . ' LOGOUT')) {
            $this->readReply();
        }

        $this->closeSocket();
    }
1081673
public function disconnect()
  {
    if($this->stream === null) return;

    $this->stream = null;

    if(is_resource($this->session))
    {
      @ssh2_disconnect($this->session);
    }

    TeamSpeak3_Helper_Signal::getInstance()->emit(strtolower($this->getAdapterType()) . "Disconnected");
  }
399202
def disconnect(self):
        
        cmd_response = self.__send_command(const.CMD_EXIT)
        if cmd_response.get('status'):
            self.is_connect = False
            if self.__sock:
                self.__sock.close()
            return True
        else:
            raise ZKErrorResponse("can't disconnect")
1223005
private function __disconnect()
    {
        if (is_null($this->memcache)) {
            return;
        }
        $this->memcache->close();
        $this->memcache = null;

        return true;
    }
927028
async def disconnect(self):
        
        if self._connection:
            log.debug('Closing model connection')
            await self._connection.close()
            self._connection = None
259573
def disconnect(self):
        
        try:
            self.socket.shutdown(1)

        # If its currently a socket, set it to None
        except AttributeError:
            self.socket = None
        except Exception:
            self.socket = None

        # Set the self.socket to None, no matter what.
        finally:
            self.socket = None
499544
public function disconnect()
    {
        // if stateful connection, end the toolkit job.
        if (!$this->isStateless()) {
            $this->PgmCall("OFF", NULL);
        }

        // if transport is a db, end the db connection.
        if (isset($this->db) && $this->db) {
            $this->db->disconnect($this->conn);
        }

        $this->conn = null;
    }
768078
def disconnect(self, connection):
        
        self.log.debug("Disconnecting %s" % connection)
        if connection in self._pending:
            pending_frame = self._pending[connection]
            self.store.requeue(pending_frame.headers.get(
                'destination'), pending_frame)
            del self._pending[connection]

        for dest in list(self._queues.keys()):
            if connection in self._queues[dest]:
                self._queues[dest].remove(connection)
            if not self._queues[dest]:
                # This won't trigger RuntimeError, since we're using keys()
                del self._queues[dest]
1223400
protected function disconnect()
    {
        // Initiate connection close. The WebSockets RFC recomends against
        // clients initiating the close handshake but we want to ensure the
        // connection is closed as soon as possible.
        $this->connection->startClose(
            Net_Notifier_WebSocket_Connection::CLOSE_GOING_AWAY,
            'Client sent message.'
        );

        // read server close frame
        $state = $this->connection->getState();

        $sec  = intval($this->timeout / 1000);
        $usec = ($this->timeout % 1000) * 1000;

        while ($state < Net_Notifier_WebSocket_Connection::STATE_CLOSED) {
            $read = array($this->socket->getRawSocket());

            $result = stream_select(
                $read,
                $write = null,
                $except = null,
                $sec,
                $usec
            );

            if ($result === 1) {
                $this->connection->read(self::READ_BUFFER_LENGTH);
            } else {
                // read timed out, just close the connection
                $this->connection->close();
            }

            $state = $this->connection->getState();
        }

        $this->connection = null;
    }
697365
def close &on_disconnect
      @heartbeat_timer.cancel if @heartbeat_timer
      @heartbeat_timer = nil
      if on_disconnect
        @closing = true
        @on_disconnect = proc{
          on_disconnect.call
          @closing = false
        }
      end

      callback{ |c|
        if c.channels.any?
          c.channels.each do |ch, mq|
            mq.close
          end
        else
          send Protocol::Connection::Close.new(:reply_code => 200,
                                               :reply_text => 'Goodbye',
                                               :class_id => 0,
                                               :method_id => 0)
        end
      }
    end
1292396
async def disconnect(self, abort=False):
        
        if self.state == 'connected':
            await self._send_packet(packet.Packet(packet.CLOSE))
            await self.queue.put(None)
            self.state = 'disconnecting'
            await self._trigger_event('disconnect', run_async=False)
            if self.current_transport == 'websocket':
                await self.ws.close()
            if not abort:
                await self.read_loop_task
            self.state = 'disconnected'
            try:
                client.connected_clients.remove(self)
            except ValueError:  # pragma: no cover
                pass
        self._reset()
509676
public function closeConnection () {
        if ( $this->transport->getSmtp()->isConnect()) {
            $this->transport->getSmtp()->rset();
            $this->transport->getSmtp()->disconnect();
        }
    }