From 8026f8a6f9a9ad48b16df7b436e75af686129385 Mon Sep 17 00:00:00 2001 From: lemon <961222258@qq.com> Date: Sat, 15 Feb 2020 22:37:13 +0800 Subject: [PATCH] 新增转移终端优化方案3 --- core/core.py | 9 ++++----- core/monitor.py | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/core/core.py b/core/core.py index 01f98e8..cdad8bc 100644 --- a/core/core.py +++ b/core/core.py @@ -56,15 +56,14 @@ def connect_success(sock): monitor._socket.quit() # 旧的断开 monitor._temp_socket = None # 清除临时变量 - monitor.bind(sock) - monitor._init_server_() - + monitor.bind(sock) # 替换Sock + monitor.initialize() # 发送初始化消息 monitor._socket.new_server_func = functools.partial( control_server.get_ws_address, monitor._name, sock.ws_url - ) - monitor._socket.server_replace = server_replace + ) # 设置获取新服务器的函数 + monitor._socket.server_replace = server_replace # 设置开启新服务器的逻辑 def run(): diff --git a/core/monitor.py b/core/monitor.py index 4bc73b9..f37f4cf 100644 --- a/core/monitor.py +++ b/core/monitor.py @@ -116,7 +116,7 @@ class Monitor(callback.CallBack): } return payload - def _init_server_(self): + def initialize(self): payload = { "data": tostr({ 'online': self.members(), -- libgit2 0.24.0