don't create user in response
This commit is contained in:
parent
490acdbd23
commit
771c8b205e
1 changed files with 15 additions and 15 deletions
30
oml/nodes.py
30
oml/nodes.py
|
@ -202,29 +202,29 @@ class Node(Thread):
|
||||||
|
|
||||||
def _send_response(self):
|
def _send_response(self):
|
||||||
with db.session():
|
with db.session():
|
||||||
u = user.models.User.get_or_create(self.user_id)
|
u = user.models.User.get(self.user_id)
|
||||||
if u.peered or u.queued:
|
if u and u.peered or u.queued:
|
||||||
if DEBUG_NODES:
|
if DEBUG_NODES:
|
||||||
logger.debug('go online peered=%s queued=%s %s (%s)', u.peered, u.queued, u.id, u.nickname)
|
logger.debug('go online peered=%s queued=%s %s (%s)', u.peered, u.queued, u.id, u.nickname)
|
||||||
try:
|
try:
|
||||||
self.online = self.can_connect()
|
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:
|
except:
|
||||||
if DEBUG_NODES:
|
if DEBUG_NODES:
|
||||||
logger.debug('failed to connect to %s', self.user_id)
|
logger.debug('failed to connect to %s', self.user_id)
|
||||||
self.online = False
|
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):
|
def trigger_status(self):
|
||||||
if self.online is not None:
|
if self.online is not None:
|
||||||
|
|
Loading…
Reference in a new issue