Exemple #1
0
def setup_public_ip():
    utils.sync_public_ip()
    if not settings.local.public_ip:
        thread = threading.Thread(target=utils.sync_public_ip,
                                  kwargs={'attempts': 5})
        thread.daemon = True
        thread.start()
Exemple #2
0
def setup_public_ip():
    utils.sync_public_ip()
    if not settings.local.public_ip:
        thread = threading.Thread(target=utils.sync_public_ip,
            kwargs={'attempts': 5})
        thread.daemon = True
        thread.start()
Exemple #3
0
def _check_updates():
    while True:
        if not settings.app.update_check_rate:
            yield interrupter_sleep(30)
            continue

        try:
            url = settings.app.notification_server
            if settings.app.dedicated:
                url = settings.app.dedicated + '/notification'

            request = urllib2.Request(
                url + '/%s' % settings.local.version_int)
            response = urllib2.urlopen(request, timeout=60)
            data = json.load(response)

            settings.local.notification = str(data.get('message', ''))
            settings.local.www_state = str(data.get('www', OK))
            settings.local.vpn_state = str(data.get('vpn', OK))
        except:
            logger.exception('Failed to check notifications', 'runners')

        utils.sync_public_ip()

        yield interrupter_sleep(settings.app.update_check_rate)
Exemple #4
0
def _check_updates():
    while True:
        if not settings.app.update_check_rate:
            yield interrupter_sleep(30)
            continue

        try:
            request = urllib2.Request(settings.app.notification_server +
                                      '/%s' % settings.local.version_int)
            response = urllib2.urlopen(request, timeout=60)
            data = json.load(response)

            settings.local.notification = str(data.get('message', ''))
            settings.local.www_state = str(data.get('www', OK))
            settings.local.vpn_state = str(data.get('vpn', OK))
        except:
            logger.exception('Failed to check notifications', 'runners')

        utils.sync_public_ip()

        yield interrupter_sleep(settings.app.update_check_rate)