Ensure appropriate connections.
972517
def maintainConnections(self, force=False):
        
        now = time.perf_counter()
        if now < self.nextCheck and not force:
            return False
        self.nextCheck = now + (self.config.RETRY_TIMEOUT_NOT_RESTRICTED
                                if self.isKeySharing
                                else self.config.RETRY_TIMEOUT_RESTRICTED)
        missing = self.connectToMissing()
        self.retryDisconnected(exclude=missing)
        logger.trace("{} next check for retries in {:.2f} seconds"
                     .format(self, self.nextCheck - now))
        return True
436933
private void handleConnection(Address address, Connection connection, Throwable error, CompletableFuture<Connection> future) {
    if (open) {
      if (error == null) {
        setupConnection(address, connection, future);
      } else {
        LOGGER.debug("{} - Failed to connect! Reason: {}", id, error);
        connect(future);
      }
    }
  }
1188738
def _do_connect(self):
        """"""
        _, self._protocol = yield from self._loop.create_connection(
            lambda: SnapcastProtocol(self._callbacks), self._host, self._port)
1121273
def connection(connection, without_connection_test):
    """"""
    database.set_connection(connection=connection)

    if not without_connection_test:
        test_connection(connection)
369903
def _ensureRequired(self):
        

        for configName, configDict in self.configs.items():
            if configDict['required']:
                if getattr(self._config, configName) is None:
                    raise MissingConfigurationException(configName)
1185686
def verify_state(self):
        """"""
        if self.state == CONNECTING:
            self.state = OPEN

            self.conn.on_open(self.conn_info)
887412
def _prepare_connection(**kwargs):
    '''
    
    '''
    init_args = {}
    fun_kwargs = {}
    netmiko_kwargs = __salt__['config.get']('netmiko', {})
    netmiko_kwargs.update(kwargs)  # merge the CLI args with the opts/pillar
    netmiko_init_args, _, _, netmiko_defaults = inspect.getargspec(BaseConnection.__init__)
    check_self = netmiko_init_args.pop(0)
    for karg, warg in six.iteritems(netmiko_kwargs):
        if karg not in netmiko_init_args:
            if warg is not None:
                fun_kwargs[karg] = warg
            continue
        if warg is not None:
            init_args[karg] = warg
    conn = ConnectHandler(**init_args)
    return conn, fun_kwargs
494415
def ensure_packages(packages):
    """"""
    required = filter_installed_packages(packages)
    if required:
        apt_install(required, fatal=True)
1120818
def _validate_conn(self, conn):
        
        super(HTTPSConnectionPool, self)._validate_conn(conn)

        # Force connect early to allow us to validate the connection.
        if not getattr(conn, 'sock', None):  # AppEngine might not have  `.sock`
            conn.connect()

        if not conn.is_verified:
            warnings.warn((
                'Unverified HTTPS request is being made. '
                'Adding certificate verification is strongly advised. See: '
                'https://urllib3.readthedocs.org/en/latest/security.html'),
                InsecureRequestWarning)
297011
def _handle_connect(self, sid, namespace):
        """"""
        namespace = namespace or '/'
        self.manager.connect(sid, namespace)
        if self.always_connect:
            self._send_packet(sid, packet.Packet(packet.CONNECT,
                                                 namespace=namespace))
        fail_reason = None
        try:
            success = self._trigger_event('connect', namespace, sid,
                                          self.environ[sid])
        except exceptions.ConnectionRefusedError as exc:
            fail_reason = exc.error_args
            success = False

        if success is False:
            if self.always_connect:
                self.manager.pre_disconnect(sid, namespace)
                self._send_packet(sid, packet.Packet(
                    packet.DISCONNECT, data=fail_reason, namespace=namespace))
            self.manager.disconnect(sid, namespace)
            if not self.always_connect:
                self._send_packet(sid, packet.Packet(
                    packet.ERROR, data=fail_reason, namespace=namespace))
            if sid in self.environ:  # pragma: no cover
                del self.environ[sid]
            return False
        elif not self.always_connect:
            self._send_packet(sid, packet.Packet(packet.CONNECT,
                                                 namespace=namespace))
1308022
def ensure_hbounds(self):
        """"""
        self.cursor.x = min(max(0, self.cursor.x), self.columns - 1)
547534
@Override
    public boolean ensureConnected () throws SmbException {
        try {
            return super.connect(this.transportContext.getConfig().getResponseTimeout());
        }
        catch ( TransportException te ) {
            throw new SmbException("Failed to connect: " + this.address, te);
        }

    }
624609
def make_connection(self, transport, address):
        """"""
        self.connected = True
        self.transport = transport
        self.connection_made(address)
106312
def connection_made(self, address):
        """"""
        self._proxy = PickleProxy(self.loop, self)
        for d in self._proxy_deferreds:
            d.callback(self._proxy)
533892
def ensure_data():
    '''
    
    '''
    if not os.path.exists(GARUDA_DIR):
        os.makedirs(GARUDA_DIR)
    Path(f'{GARUDA_DIR}/__init__.py').touch()
594212
def connect(*args, **kwargs):
    """"""
    from .connections import Connection
    conn = Connection(*args, **kwargs)
    yield conn.connect()
    raise gen.Return(conn)
114454
def connection_made(self, transport):
        """"""
        self.log.info('Connection established to AVR')
        self.transport = transport

        #self.transport.set_write_buffer_limits(0)
        limit_low, limit_high = self.transport.get_write_buffer_limits()
        self.log.debug('Write buffer limits %d to %d', limit_low, limit_high)

        self.command('ECH1')
        self.refresh_core()