Skip to content

Commit

Permalink
5.4.5 fix bugs and improve performance.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-X-Net committed Jul 23, 2023
1 parent 489a8f6 commit 0a20fe4
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 11 deletions.
3 changes: 2 additions & 1 deletion code/default/launcher/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,9 @@ def main():
module_init.xargs["allow_remote"] = 1

if os.getenv("NOT_MESS_SYSTEM", "0") != "0" or no_mess_system or config.no_mess_system:
xlog.info("start with no_mess_system, no CA will be imported to system.")
xlog.info("start with no_mess_system, no CA will be imported to system, not create desktop.")
module_init.xargs["no_mess_system"] = 1
update.should_create_desktop_shortcut = False

if os.path.isfile(running_file):
restart_from_except = True
Expand Down
3 changes: 2 additions & 1 deletion code/default/launcher/sys_platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@


if sys.platform.startswith("linux"):
if os.path.isfile("/system/bin/dalvikvm") or os.path.isfile("/system/bin/dalvikvm64"):
if os.path.isfile("/system/bin/dalvikvm") or os.path.isfile("/system/bin/dalvikvm64") or \
"android.googlesource.com" in sys.version:
xlog.info("This is Android")
has_desktop = False
platform = "android"
Expand Down
4 changes: 3 additions & 1 deletion code/default/launcher/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
root_path = os.path.abspath(os.path.join(current_path, os.pardir))
data_root = os.path.abspath(os.path.join(root_path, os.pardir, os.pardir, 'data'))

should_create_desktop_shortcut = True


def get_opener():
autoproxy = '127.0.0.1:8086'
Expand Down Expand Up @@ -368,7 +370,7 @@ def check_new_machine():
if sys.platform == "win32" and platform.release() == "XP":
notify_install_tcpz_for_winXp()

if sys_platform.has_desktop and os.getenv("XXNET_NO_MESS_SYSTEM", "0") == "0":
if sys_platform.has_desktop and should_create_desktop_shortcut:
xlog.info("generate desktop shortcut")
create_desktop_shortcut()

Expand Down
8 changes: 6 additions & 2 deletions code/default/lib/noarch/front_base/boringssl_wrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ def __init__(self, logger, ca_certs=None, cipher_suites=None, support_http2=True

cmd = b"ALL:!aPSK:!ECDSA+SHA1:!3DES"
bssl.BSSL_SSL_CTX_set_cipher_list(self.ctx, cmd)
bssl.BSSL_SSL_CTX_set_num_tickets(self.ctx, 0)

if support_http2:
alpn = b""
Expand All @@ -303,7 +302,12 @@ def __init__(self, logger, ca_certs=None, cipher_suites=None, support_http2=True
bssl.BSSL_SSL_CTX_set_verify_algorithm_prefs(self.ctx, cdata_ptr, len(algs))

bssl.BSSL_SSL_CTX_set_min_proto_version(self.ctx, 0x0303)
bssl.BSSL_SSL_CTX_set_permute_extensions(self.ctx, 1)

try:
bssl.BSSL_SSL_CTX_set_num_tickets(self.ctx, 0)
bssl.BSSL_SSL_CTX_set_permute_extensions(self.ctx, 1)
except:
self.logger.info("boringsssl not support permute extension")

bssl.SetCompression(self.ctx)

Expand Down
2 changes: 1 addition & 1 deletion code/default/lib/noarch/front_base/http_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def finish(self):


class HttpWorker(object):
max_payload = 128 * 1024
max_payload = 32 * 1024

def __init__(self, logger, ip_manager, config, ssl_sock, close_cb, retry_task_cb, idle_cb, log_debug_data):
self.logger = logger
Expand Down
2 changes: 2 additions & 0 deletions code/default/lib/noarch/front_base/http_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,8 @@ def close_all_worker(self, reason="close all worker"):

def log_debug_data(self, rtt, sent, received):
self.rtts.append(rtt)
if len(self.rtts) > 30:
self.rtts.pop(0)
self.total_sent += sent
self.total_received += received

Expand Down
2 changes: 1 addition & 1 deletion code/default/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.4.2
5.4.5
11 changes: 7 additions & 4 deletions code/default/x_tunnel/local/proxy_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ def start(self):
self.conn_list = {}
self.transfer_list = {}
self.last_send_time = time.time()
self.on_road_num = 0
self.last_receive_time = 0
self.traffic = 0

Expand Down Expand Up @@ -666,6 +665,7 @@ def normal_round_trip_worker(self, work_id):
if status == 521:
xlog.warn("X-tunnel server is down, try get new server.")
g.server_host = None
self.on_road_num -= 1
self.stop()
login_process()
return
Expand All @@ -676,10 +676,11 @@ def normal_round_trip_worker(self, work_id):
time.sleep(sleep_time)
continue

content_length = int(response.headers.get(b"Content-Length", b"0"))
recv_len = len(content)
if recv_len < 6:
xlog.warn("roundtrip time:%f transfer_no:%d send:%d recv:%d Head",
roundtrip_time, transfer_no, send_data_len, recv_len)
if recv_len < 6 or recv_len != content_length:
xlog.warn("roundtrip time:%f transfer_no:%d send:%d recv:%d Head:%d",
roundtrip_time, transfer_no, send_data_len, recv_len, content_length)
continue

try:
Expand All @@ -699,6 +700,7 @@ def normal_round_trip_worker(self, work_id):
if error_code == 1:
# no quota
xlog.warn("x_server error:no quota")
self.on_road_num -= 1
self.stop()
return
elif error_code == 2:
Expand All @@ -710,6 +712,7 @@ def normal_round_trip_worker(self, work_id):
# session not exist
if self.session_id == request_session_id:
xlog.warn("server session_id:%s not exist, reset session.", request_session_id)
self.on_road_num -= 1
self.reset()
return
else:
Expand Down

0 comments on commit 0a20fe4

Please sign in to comment.