Commit 62d24f17 authored by Benziane Chakib's avatar Benziane Chakib
Browse files

added exponential timeout when trying to reconnect if authentication error

parent 14a7bbcd
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@ import signal
import threading
import socket
from time import sleep
from math import exp

try:
    import daemon
@@ -66,6 +67,7 @@ def run_node(options):
        logging.info('Connected to server %s' % options['address'])

    def authentication():
        timeout = 1
        login = options['login'].replace('$HOSTNAME', socket.gethostname())
        while node.manager.is_running():
            try:
@@ -74,6 +76,9 @@ def run_node(options):
                logging.critical('Authentication error: %s' % error)
                sleep(2)
            else:
                timeout += 0.1
                print exp(timeout)
                sleep(exp(timeout))
                logging.info('Authenticated to server')
                break