fix inital peering

This commit is contained in:
j 2016-02-10 19:31:51 +05:30
parent 3cde05b9ba
commit ea9de0f311

View file

@ -78,10 +78,10 @@ class NodeServer(ThreadingMixIn, TLSTCPServer):
def api_call(action, user_id, args):
with db.session():
u = user.models.User.get(user_id)
if action in ('pullChanges', ) and not u.peered and u.pending == 'sent':
if u and action in ('pullChanges', ) and not u.peered and u.pending == 'sent':
u.update_peering(True)
state.nodes.queue('add', user.id, True)
trigger_event('peering.accept', user.json())
state.nodes.queue('add', u.id, True)
trigger_event('peering.accept', u.json())
if action in (
'requestPeering', 'acceptPeering', 'rejectPeering',
'removePeering', 'cancelPeering'