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)
|
logger.debug('PEER %s IS UNKNOWN SEND 403', user_id)
|
||||||
response_status = (403, 'UNKNOWN USER')
|
response_status = (403, 'UNKNOWN USER')
|
||||||
content = {}
|
content = {}
|
||||||
else:
|
#else:
|
||||||
logger.debug('RESPONSE %s: %s', action, content)
|
# logger.debug('RESPONSE %s: %s', action, content)
|
||||||
self.write_response(response_status, content)
|
self.write_response(response_status, content)
|
||||||
|
|
||||||
def write_response(self, response_status, content):
|
def write_response(self, response_status, content):
|
||||||
|
|
|
@ -35,6 +35,7 @@ ENCODING='base64'
|
||||||
|
|
||||||
class Node(Thread):
|
class Node(Thread):
|
||||||
_running = True
|
_running = True
|
||||||
|
_pulling = False
|
||||||
host = None
|
host = None
|
||||||
local = None
|
local = None
|
||||||
online = False
|
online = False
|
||||||
|
@ -64,8 +65,10 @@ class Node(Thread):
|
||||||
elif action == 'ping':
|
elif action == 'ping':
|
||||||
self.online = self.can_connect()
|
self.online = self.can_connect()
|
||||||
elif action == 'pull':
|
elif action == 'pull':
|
||||||
|
self._pulling = True
|
||||||
self.online = self.can_connect()
|
self.online = self.can_connect()
|
||||||
self.pullChanges()
|
self.pullChanges()
|
||||||
|
self._pulling = False
|
||||||
else:
|
else:
|
||||||
logger.debug('unknown action %s', action)
|
logger.debug('unknown action %s', action)
|
||||||
|
|
||||||
|
@ -75,6 +78,7 @@ class Node(Thread):
|
||||||
#return Thread.join(self)
|
#return Thread.join(self)
|
||||||
|
|
||||||
def pull(self):
|
def pull(self):
|
||||||
|
if not self._pulling:
|
||||||
self._q.put('pull')
|
self._q.put('pull')
|
||||||
|
|
||||||
def ping(self):
|
def ping(self):
|
||||||
|
|
Loading…
Reference in a new issue