don't create user in response

This commit is contained in:
j 2016-03-01 17:08:58 +05:30
parent 490acdbd23
commit 771c8b205e
1 changed files with 15 additions and 15 deletions

View File

@ -202,29 +202,29 @@ class Node(Thread):
def _send_response(self):
with db.session():
u = user.models.User.get_or_create(self.user_id)
if u.peered or u.queued:
u = user.models.User.get(self.user_id)
if u and u.peered or u.queued:
if DEBUG_NODES:
logger.debug('go online peered=%s queued=%s %s (%s)', u.peered, u.queued, u.id, u.nickname)
try:
self.online = self.can_connect()
if self.online:
if DEBUG_NODES:
logger.debug('connected to %s', self.url)
if u.queued:
if DEBUG_NODES:
logger.debug('queued peering event pending=%s peered=%s', u.pending, u.peered)
if u.pending == 'sent':
self.peering('requestPeering')
elif u.pending == '' and u.peered:
self.peering('acceptPeering')
else:
#fixme, what about cancel/reject peering here?
self.peering('removePeering')
except:
if DEBUG_NODES:
logger.debug('failed to connect to %s', self.user_id)
self.online = False
if self.online:
if DEBUG_NODES:
logger.debug('connected to %s', self.url)
if u.queued:
if DEBUG_NODES:
logger.debug('queued peering event pending=%s peered=%s', u.pending, u.peered)
if u.pending == 'sent':
self.peering('requestPeering')
elif u.pending == '' and u.peered:
self.peering('acceptPeering')
else:
#fixme, what about cancel/reject peering here?
self.peering('removePeering')
def trigger_status(self):
if self.online is not None: