dont queue pull if pull is running
This commit is contained in:
parent
5f46a68c01
commit
0def130b4a
2 changed files with 7 additions and 3 deletions
|
@ -221,8 +221,8 @@ class Handler(http.server.SimpleHTTPRequestHandler):
|
|||
logger.debug('PEER %s IS UNKNOWN SEND 403', user_id)
|
||||
response_status = (403, 'UNKNOWN USER')
|
||||
content = {}
|
||||
else:
|
||||
logger.debug('RESPONSE %s: %s', action, content)
|
||||
#else:
|
||||
# logger.debug('RESPONSE %s: %s', action, content)
|
||||
self.write_response(response_status, content)
|
||||
|
||||
def write_response(self, response_status, content):
|
||||
|
|
|
@ -35,6 +35,7 @@ ENCODING='base64'
|
|||
|
||||
class Node(Thread):
|
||||
_running = True
|
||||
_pulling = False
|
||||
host = None
|
||||
local = None
|
||||
online = False
|
||||
|
@ -64,8 +65,10 @@ class Node(Thread):
|
|||
elif action == 'ping':
|
||||
self.online = self.can_connect()
|
||||
elif action == 'pull':
|
||||
self._pulling = True
|
||||
self.online = self.can_connect()
|
||||
self.pullChanges()
|
||||
self._pulling = False
|
||||
else:
|
||||
logger.debug('unknown action %s', action)
|
||||
|
||||
|
@ -75,6 +78,7 @@ class Node(Thread):
|
|||
#return Thread.join(self)
|
||||
|
||||
def pull(self):
|
||||
if not self._pulling:
|
||||
self._q.put('pull')
|
||||
|
||||
def ping(self):
|
||||
|
|
Loading…
Reference in a new issue