Closes channel and socket if still open.
179227
private function close()
    {
        if (null !== $this->pipe && $this->pipe->isOpen()) {
            $this->pipe->close();
        }

        if (is_resource($this->socket)) {
            fclose($this->socket);
        }

        $this->thread = null;
        $this->channel = null;
    }
1258892
def close(self, close_socket=False):
        
        self._bm.stop_socket(self._conn_key)
        if close_socket:
            self._bm.close()
        time.sleep(1)
        self._depth_cache = None
199
def end(self, close_fileobj=True):
        """"""
        log.debug("in TftpContext.end - closing socket")
        self.sock.close()
        if close_fileobj and self.fileobj is not None and not self.fileobj.closed:
            log.debug("self.fileobj is open - closing")
            self.fileobj.close()
1270740
@Override
  public void close() throws IOException
  {
    SocketChannel channel = _channel;
    _channel = null;

    if (channel != null)
      channel.close();
  }
1362335
public static void closeConnection( Channel channel ) throws IOException {

		if( channel != null ) {
			if( channel.isOpen())
				channel.close();

			if( channel.getConnection().isOpen())
				channel.getConnection().close();
		}
	}
165356
def _do_close(self):
        
        AMQP_LOGGER.debug('Closed channel #%d' % self.channel_id)
        self.is_open = False
        del self.connection.channels[self.channel_id]
        self.channel_id = self.connection = None
        self.callbacks = {}
313125
public static void close(Socket socket) {
        if (socket == null) {
            return;
        }
        try {
            socket.close();
        } catch (IOException e) {
            Logger.getLogger(IOUtil.class).finest("closeResource failed", e);
        }
    }
474240
def CloseExecSocket(self, tid=None):
    """"""
    response = self._SendToExecSocketRaw('__kill__', tid)
    if response != '__kill_ack__':
      logging.warning('May not have succeeded in closing socket, make sure '
                      'using execsocks().')
461306
public void close() throws IOException {
        for (;;) {
            int state = this.state;
            if (isClosed(state)) {
                return;
            }
            // Once a close operation happens, the channel is considered shutdown.
            if (casState(state, state | STATE_ALL_MASK)) {
                break;
            }
        }
        int res = close(fd);
        if (res < 0) {
            throw newIOException("close", res);
        }
    }
824549
public void close() {
        if (connected) {
            try {
                transport.close();
                socket.close();
            }
            catch (IOException ex) {
                logger.warn("Could not close socket", ex);
            }
            connected = false;
        }
    }
1233190
def close(self):
        
        keys = set(self._conns.keys())
        for key in keys:
            self.stop_socket(key)

        self._conns = {}
282233
function close() {
        $this->_error_log('closing socket ' . $this->sock);
        $this->_connection_closed = true;
        fclose($this->sock);
    }
44769
function onClose() {
    if (!channel._websocket) return

    channel._websocket = null

    channel.emit("close")
    cb(new Error("closed"))
  }
284134
private void closeChannel() {
        // TODO: race condition between this and the setChannel method.
        Channel c;
        synchronized (channelLock) {
            c = channel;
            channel = null;
            absoluteRemoteFs = null;
            isUnix = null;
        }
        if (c != null) {
            try {
                c.close();
            } catch (IOException e) {
                logger.log(Level.SEVERE, "Failed to terminate channel to " + getDisplayName(), e);
            }
            for (ComputerListener cl : ComputerListener.all())
                cl.onOffline(this, offlineCause);
        }
    }
130923
@Override
    public void close() throws IOException {
        if(UndertowLogger.REQUEST_IO_LOGGER.isTraceEnabled()) {
            UndertowLogger.REQUEST_IO_LOGGER.tracef(new ClosedChannelException(), "Channel %s is being closed", this);
        }
        safeClose(channel);
        if(readData != null) {
            readData.close();
            readData = null;
        }
        closeSubChannels();
    }
671880
def close(self):
        
        # If we aren't already closed ask for server to close
        if not self.is_closed():
            self._closing = True
            # Let the ChannelActor do the actual close operations.
            # It will do the work on CloseOK
            self.sender.send_Close(
                0, 'Channel closed by application', 0, 0)
            try:
                yield from self.synchroniser.wait(spec.ChannelCloseOK)
            except AMQPError:
                # For example if both sides want to close or the connection
                # is closed.
                pass
        else:
            if self._closing:
                log.warn("Called `close` on already closing channel...")
1081095
def close_socket(sock):
    ''''''
    if sock:
        try:
            sock.shutdown(socket.SHUT_RDWR)
        except Exception:
            pass
        try:
            sock.close()
        except Exception:
            pass