示例#1
0
def connected_timeout(dummy: int) -> None:
    active_ssid: Optional[str]
    active_ssid = nm.get_active_ssid(modemgr.get_state_device("CONNECTED"))
    log.debug("connected_timeout comparing {} to {}".format(
        connection, active_ssid))
    if connection != active_ssid:
        log.warning("Connection lost on timeout")
        dev = modemgr.get_state_device("CONNECTED")
        set_state("CONNECTING", candidate_connections(dev))

    if modemgr.get_mode() == modemgr.MULTI_MODE:
        wpa.check_wpa(modemgr.get_ap_device().Interface)

        active_ssid = nm.get_active_ssid(modemgr.get_state_device("HOTSPOT"))
        if not active_ssid:
            log.warning("Hotspot lost on timeout")
            set_state("HOTSPOT")

        defroute_devname: Optional[str] = routemgr.defroute_dev()
        ap_dev: NetworkManager.Device = modemgr.get_ap_device()
        link_dev: NetworkManager.Device = modemgr.get_link_device()
        if defroute_devname == nm.device_name(ap_dev):
            # default route is bad. Disconnect link and count on state
            # processing to restore
            log.error("AP is holding default route while CONNECTED, kicking")
            nm.disconnect(link_dev)
示例#2
0
def connected_timeout():
    log.debug("states: Calling nm.get_active_ssid()")
    if connection != nm.get_active_ssid(modemgr.get_state_device('CONNECTED')):
        log.warning("Connection lost on timeout")
        set_state('HOTSPOT')

    if modemgr.get_mode() == modemgr.MULTI_MODE:
        wpa.check_wpa(modemgr.get_ap_device().Interface)
示例#3
0
def hotspot_timeout(dummy: int) -> None:
    if iwscan.ap_conn_count() == 0 or modemgr.get_mode() != "single":
        log.debug("Periodic connection attempt")

        dev = modemgr.get_state_device("CONNECTED")
        conn_list: List[str] = candidate_connections(dev)
        if conn_list:
            set_state("CONNECTING", conn_list)
        else:
            log.info("No candidates - skipping CONNECTING scan")
    else:
        log.info("AP active - skipping CONNECTING scan")

    wpa.check_wpa(modemgr.get_ap_device().Interface)
示例#4
0
def hotspot_timeout():
    if iwscan.ap_conn_count() == 0 or modemgr.get_mode() != 'single':
        log.debug('Periodic connection attempt')

        dev = modemgr.get_state_device('CONNECTED')
        conn_list = candidate_connections(dev)
        if conn_list:
            set_state('CONNECTING', conn_list)
        else:
            log.info('No candidates - skipping CONNECTING scan')
    else:
        log.info('AP active - skipping CONNECTING scan')

    wpa.check_wpa(modemgr.get_ap_device().Interface)