Close the connection and end the asynchronous task
176001
function closeConnection(errMsg) {
		if (ftp) {
			ftp.raw.quit(function(err, res) {
				if (err) {
					grunt.log.error(err);
					done(false);
				}
				ftp.destroy();
				grunt.log.ok("FTP connection closed!");
				done();
			});
		} else if (errMsg) {
			grunt.log.warn(errMsg);
			done(false);
		} else {
			done();
		}
	}
770559
def stop(self):
        """"""
        self._stop_thread.set()
        # f you want to close the connection in a timely fashion,
        # call shutdown() before close().
        with self._lock:  # Receive thread might use the socket
            self.receive_socket.shutdown(socket.SHUT_RDWR)
            self.receive_socket.close()

        self.send_socket.shutdown(socket.SHUT_RDWR)
        self.send_socket.close()
1028581
def close(self, timeout: int = 5) -> None:
        
        if self._read_task is not None and not self._read_task.cancelled():
            self._read_task.cancel()

        return super().close(timeout)
1126501
def _close_connection(self):
        """"""
        if (self._mode == PROP_MODE_SERIAL):
            self._serial.close()
        elif (self._mode == PROP_MODE_TCP):
            self._socket.close()
        elif (self._mode == PROP_MODE_FILE):
            self._file.close()
760402
def close_connection(self):
        ""
        if self._is_connected:
            self._is_connected = False
            self._command_parser.close_when_done()
10037
async def destroy_async(self):
        
        try:
            await self.lock_async()
            _logger.debug("Unlocked connection %r to close.", self.container_id)
            await self._close_async()
        except asyncio.TimeoutError:
            _logger.debug(
                "Connection %r timed out while waiting for lock acquisition on destroy. Destroying anyway.",
                self.container_id)
            await self._close_async()
        finally:
            self.release_async()
        uamqp._Platform.deinitialize()
1024393
@Beta(SinceVersion.V1_1_0)
    public void close() {
        httpClient.dispatcher().executorService().shutdown();
        httpClient.connectionPool().evictAll();
        synchronized (httpClient.connectionPool()) {
            httpClient.connectionPool().notifyAll();
        }
        synchronized (AsyncTimeout.class) {
            AsyncTimeout.class.notifyAll();
        }
    }
1278901
def close(self):
        """"""
        if not self.is_running:
            return

        self._state = CLOSED
        self.logger.debug('closing connection(s)')

        while True:
            try:
                conn = self._connections.get(block=False)
            except Empty:
                break

            conn.close_stream()

        self.on_close.send(self)
407104
async def close_async(self, context, reason):
        
        logger.info("Connection closed (reason {}, id {}, offset {}, sq_number {})".format(
            reason,
            context.partition_id,
            context.offset,
            context.sequence_number))
436541
async def stop(self):
        """"""

        if self._rpc_task is not None:
            self._rpc_task.cancel()

        try:
            await self._rpc_task
        except asyncio.CancelledError:
            pass

        self._rpc_task = None
607049
def shutdown(self):
        
        self._handlertask.cancel()

        if self._timeout_handler:
            self._timeout_handler.cancel()
        self._transport = None
        self._stream_reader = None
        self._stream_writer.close()
        for i, task in self.tasks.items():
            task.cancel()
        self._stream_writer = None
        logger.info("close connection with {}".format(
            self._remote_host
        ))
580959
@Override
    public void close() {
        try {
            // Prevent new tasks being submitted
            shutdown();
        } catch (final SecurityException e) {
            // Ignore for now (caught again if shutdownNow() fails)
        }
        boolean terminated = false;
        try {
            // Await termination of any running tasks
            terminated = awaitTermination(2500, TimeUnit.MILLISECONDS);
        } catch (final InterruptedException e) {
            interruptionChecker.interrupt();
        }
        if (!terminated) {
            try {
                // Interrupt all the threads to terminate them, if awaitTermination() timed out
                shutdownNow();
            } catch (final SecurityException e) {
                throw ClassGraphException.newClassGraphException("Could not shut down ExecutorService -- need "
                        + "java.lang.RuntimePermission(\"modifyThread\"), "
                        + "or the security manager's checkAccess method denies access", e);
            }
        }
    }
998814
async def close(self):
        
        push_connection = self.pubsub.push_connection
        self.status = self.statusType.closed
        if push_connection:
            push_connection.event('connection_lost').unbind(
                self._connection_lost
            )
            await self.pubsub.close()
962608
async def close(self):
        
        if self._server:
            self._server.close()
            self._server = None
            coro = self._close_connections()
            if coro:
                await coro
            self.logger.debug('%s closed', self)
            self.event('stop').fire()
993882
def Close(self):
		
		if self.connection is not None:
			try:
				self.connection.commit()
				self.connection.close()
				self.connection = None
			except Exception, e:
				pass
136742
protected void close() {
        _state = State.DISCONNECTED;

        shutdown();

        // remove the connection from map
        NetMgr.getInstance().dropConnection(InetSocketAddress.createUnresolved(_remoteHost, _port));

        // notify all the pending requests in the timeout map
        notifyAllPendingSenders("Channel closed, connection closing.");
    }
648712
def close(self):
        """"""
        try:
            if self.connection is None:
                return
            while self.nextset():
                pass
        finally:
            self.connection = None
            self._result = None