Clear and release all control sockets
486396
synchronized void clearInstance() {
		for (ServerSocket next : myControlSockets) {
			ourLog.info("Releasing control port: {}", next.getLocalPort());
			try {
				next.close();
			} catch (IOException theE) {
				// ignore
			}
		}
		myControlSockets.clear();
		myCurrentControlSocketPort = null;
	}
1082097
def shutdown(self):
        

        super(UDPTendrilManager, self).shutdown()

        # Reset the socket and socket event
        self._sock = None
        self._sock_event.clear()
606451
public function destroy()
    {
        // Avoid repeated calls.
        if ($this->_status === self::STATUS_CLOSED) {
            return;
        }
        // Remove event listener.
        Worker::$globalEvent->del($this->_socket, EventInterface::EV_READ);
        Worker::$globalEvent->del($this->_socket, EventInterface::EV_WRITE);

        // Close socket.
        set_error_handler(function(){});
        fclose($this->_socket);
        restore_error_handler();

        $this->_status = self::STATUS_CLOSED;
        // Try to emit onClose callback.
        if ($this->onClose) {
            try {
                call_user_func($this->onClose, $this);
            } catch (\Exception $e) {
                Worker::log($e);
                exit(250);
            } catch (\Error $e) {
                Worker::log($e);
                exit(250);
            }
        }
        // Try to emit protocol::onClose
        if ($this->protocol && method_exists($this->protocol, 'onClose')) {
            try {
                call_user_func(array($this->protocol, 'onClose'), $this);
            } catch (\Exception $e) {
                Worker::log($e);
                exit(250);
            } catch (\Error $e) {
                Worker::log($e);
                exit(250);
            }
        }
        $this->_sendBuffer = $this->_recvBuffer = '';
        if ($this->_status === self::STATUS_CLOSED) {
            // Cleaning up the callback to avoid memory leaks.
            $this->onMessage = $this->onClose = $this->onError = $this->onBufferFull = $this->onBufferDrain = null;
            // Remove from worker->connections.
            if ($this->worker) {
                unset($this->worker->connections[$this->_id]);
            }
            unset(static::$connections[$this->_id]);
        }
    }
995822
def clear_all_events(self):
        """"""
        self.lock.acquire()
        self.event_dict.clear()
        self.lock.release()
714413
def clear(self):
        """"""
        for key in self.conn.keys():
            self.conn.delete(key)
877757
def clear_to_reset(self, config_vars):
        """"""

        super(RemoteBridgeState, self).clear_to_reset(config_vars)
        self.status = BRIDGE_STATUS.IDLE
        self.error = 0
344754
public void destroy()
    {
        for (Socket socket : sockets) {
            destroySocket(socket);
        }
        sockets.clear();

        for (Selector selector : selectors) {
            context.close(selector);
        }
        selectors.clear();

        // Only terminate context if we are on the main thread
        if (isMain()) {
            context.term();
        }
    }
929564
async def clear(self):
        """"""
        for session in list(self.values()):
            if session.state != STATE_CLOSED:
                await session._remote_closed()

        self.sessions.clear()
        super(SessionManager, self).clear()
572812
def shutdown(self):
        """"""
        self.stop_all_periodic_tasks()
        for channel in self._bcm_sockets:
            log.debug("Closing bcm socket for channel {}".format(channel))
            bcm_socket = self._bcm_sockets[channel]
            bcm_socket.close()
        log.debug("Closing raw can socket")
        self.socket.close()
892359
def clear(self):
        
        self.io.seek(0)
        self.io.truncate()
        for item in self.monitors:
            item[2] = 0
1344213
def close_socket(self):
        ''''''
        log.debug("Closing socket")
        if self.sock:
            try:
                self.sock.close()
            except:
                pass

            self.sock = None
719521
def delete(self):
        '''  '''
        self.down()
        fcntl.ioctl(ifconfig.sockfd, SIOCBRDELBR, self.name)
        return self
916730
function (threadId) {
        Multiplexer.connections[threadId] && Multiplexer.connections[threadId].release();
        delete Multiplexer.connections[threadId];
    }
2113
void cleanup() throws IOException {
    serverSocket.close();
    try {
      downlink.close();
    } catch (InterruptedException ie) {
      Thread.currentThread().interrupt();
    }      
  }
1096811
def disconnect(self):
    """"""
    if self.sock is not None:
      try:
        self.sock.close()
      except socket.error:
        pass
      finally:
        self.sock = None
268632
def _on_fork(cls):
        
        cls._cls_idle_socketpairs = []
        while cls._cls_all_sockets:
            cls._cls_all_sockets.pop().close()
310852
def clear_port_stats(self):
        
        stat = IxeStat(self)
        stat.ix_set_default()
        stat.enableValidStats = True
        stat.ix_set()
        stat.write()