remove double peering issues

This commit is contained in:
j 2019-01-19 16:40:06 +05:30
parent 1adbcc3d0b
commit 9344b84d86

View file

@ -154,15 +154,12 @@ class User(db.Model):
if username: if username:
self.info['username'] = username self.info['username'] = username
self.update_name() self.update_name()
# FIXME: need to set peered to False to not trigger changelog event
# before other side receives acceptPeering request
self.peered = False
self.save()
if not was_peering: if not was_peering:
add_record('addpeer', self.id, self.nickname) add_record('addpeer', self.id, self.nickname)
if 'index' not in self.info: if 'index' not in self.info:
self.info['index'] = max([ self.info['index'] = max([
u.info.get('index', -1) for u in User.query.filter_by(peered=True) u.info.get('index', -1) for u in User.query.filter_by(peered=True)
if u.id != self.id
] + [0]) + 1 ] + [0]) + 1
self.peered = True self.peered = True
self.save() self.save()