refresh ports status
        Args:
          only_closed - check status only for closed ports
431147
def refresh(self, only_closed=False):
        
        if only_closed:
            opened = filter(self.__check_port, self.__closed)
            self.__closed = self.__closed.difference(opened)
            self.__ports = self.__ports.union(opened)
        else:
            ports = self.__closed.union(self.__ports)
            self.__ports = set(filter(self.__check_port, ports))
            self.__closed = ports.difference(self.__ports)
141759
async def check_ping_timeout(self):
        
        if self.closed:
            raise exceptions.SocketIsClosedError()
        if time.time() - self.last_ping > self.server.ping_interval + 5:
            self.server.logger.info('%s: Client is gone, closing socket',
                                    self.sid)
            # Passing abort=False here will cause close() to write a
            # CLOSE packet. This has the effect of updating half-open sockets
            # to their correct state of disconnected
            await self.close(wait=False, abort=False)
            return False
        return True
1037815
async def reopen(self):
        
        res = await self.connection('POST', 'tournaments/{}/matches/{}/reopen'.format(self._tournament_id, self._id))
        self._refresh_from_json(res)
1286926
async def _tcp_on_closed(self):
        """"""
        LOGGER.warning('Not connected to statsd, connecting in %s seconds',
                       self._tcp_reconnect_sleep)
        await asyncio.sleep(self._tcp_reconnect_sleep)
        self._sock = self._tcp_socket()
1214937
function close_tunnel(status) {

        // Ignore if already closed
        if (tunnel.state === Guacamole.Tunnel.State.CLOSED)
            return;

        // If connection closed abnormally, signal error.
        if (status.code !== Guacamole.Status.Code.SUCCESS && tunnel.onerror)
            tunnel.onerror(status);

        // Mark as closed
        tunnel.setState(Guacamole.Tunnel.State.CLOSED);

        socket.close();

    }
1059342
def _on_close(self, socket):
        
        self.logger.debug('Connection closed.')

        for subscription in self.subscriptions.values():
            if subscription.state == 'subscribed':
                subscription.state = 'connection_pending'
310852
def clear_port_stats(self):
        
        stat = IxeStat(self)
        stat.ix_set_default()
        stat.enableValidStats = True
        stat.ix_set()
        stat.write()
191723
def _splpy_all_ports_ready(callable_):
    """"""
    if hasattr(type(callable_), 'all_ports_ready'):
        try:
            return callable_.all_ports_ready()
        except:
            ei = sys.exc_info()
            if streamsx._streams._runtime._call_exit(callable_, ei):
                return None
            raise e1[1]
    return None
233013
def refresh(self):
        
        if not self._client:
            return
        current_containers = self._client.containers(all=True)
        self.clear()
        for container in current_containers:
            container_names = container.get('Names')
            if container_names:
                c_id = container['Id']
                self.update((name[1:], c_id)
                            for name in container_names)
85640
def _work(self):
        """"""
        if self._refresh_cache:
            # Inconsistent cache might cause exceptions. For example,
            # if a port has been removed, it will be known in the next
            # loop. Using the old switch port can cause exceptions.
            LOG.debug("Refreshing os_win caches...")
            self._utils.update_cache()
            self._refresh_cache = False

        if self._bound_ports or self._unbound_ports:
            eventlet.spawn_n(self._notify_plugin_on_port_updates)

        # notify plugin about port deltas
        if self._added_ports:
            LOG.debug("Agent loop has new devices!")
            self._treat_devices_added()

        if self._removed_ports:
            LOG.debug("Agent loop has lost devices...")
            self._treat_devices_removed()
371625
def get_connection_status(self, connection_id):
        
        with self._connections_lock:
            try:
                connection_info = self._connections[connection_id]
                return connection_info.status
            except KeyError:
                return None
538213
def record_udp_port(self, port):
        

        if port not in self._used_udp_ports:
            self._used_udp_ports.add(port)
1089288
def update_status sig=0
      pid_int = Integer("#{ @pid }")
      begin
        Process::kill sig, pid_int
        true
      rescue Errno::ESRCH
        false
      end
    end
667839
def refresh_db(force=False, **kwargs):
    '''
    
    '''
    # Remove rtag file to keep multiple refreshes from happening in pkg states
    salt.utils.pkg.clear_rtag(__opts__)
    pkgin = _check_pkgin()

    if pkgin:
        cmd = [pkgin, 'up']
        if force:
            cmd.insert(1, '-f')
        call = __salt__['cmd.run_all'](cmd, output_loglevel='trace')

        if call['retcode'] != 0:
            comment = ''
            if 'stderr' in call:
                comment += call['stderr']

            raise CommandExecutionError(comment)

    return True
1141617
def flush_and_refresh(self, index):
        
        self.client.indices.flush(wait_if_ongoing=True, index=index)
        self.client.indices.refresh(index=index)
        self.client.cluster.health(
            wait_for_status='yellow', request_timeout=30)
        return True
369677
def port_is_used(port, host='127.0.0.1'):
    
    unused = _can_bind(port, host) and _refuses_connection(port, host)
    return not unused
738933
def flush(self):
        # type: () -> None
        
        if self._closed:
            raise IOError('tried to flush closed connection')
        assert self._parentout is not None
        self._parentout.flush()