peer pending clients on pullChanges
This commit is contained in:
parent
aac0a069d2
commit
142f3bcc6e
1 changed files with 5 additions and 0 deletions
|
@ -25,6 +25,7 @@ import db
|
||||||
import settings
|
import settings
|
||||||
import state
|
import state
|
||||||
import user
|
import user
|
||||||
|
from websocket import trigger_event
|
||||||
|
|
||||||
from . import nodeapi
|
from . import nodeapi
|
||||||
from .sslsocket import fileobject
|
from .sslsocket import fileobject
|
||||||
|
@ -77,6 +78,10 @@ class NodeServer(ThreadingMixIn, TLSTCPServer):
|
||||||
def api_call(action, user_id, args):
|
def api_call(action, user_id, args):
|
||||||
with db.session():
|
with db.session():
|
||||||
u = user.models.User.get(user_id)
|
u = user.models.User.get(user_id)
|
||||||
|
if 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())
|
||||||
if action in (
|
if action in (
|
||||||
'requestPeering', 'acceptPeering', 'rejectPeering',
|
'requestPeering', 'acceptPeering', 'rejectPeering',
|
||||||
'removePeering', 'cancelPeering'
|
'removePeering', 'cancelPeering'
|
||||||
|
|
Loading…
Reference in a new issue