예제 #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()
예제 #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()
예제 #3
0
파일: updates.py 프로젝트: pritunl/pritunl
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)
예제 #4
0
파일: updates.py 프로젝트: zyd915/pritunl
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)