Skip to content

Commit

Permalink
5.6.0 merge connection send/recv threads into one.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-X-Net committed Aug 21, 2023
1 parent cdf4aa3 commit 02858bb
Show file tree
Hide file tree
Showing 10 changed files with 362 additions and 249 deletions.
4 changes: 3 additions & 1 deletion code/default/launcher/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ def main():
else:
restart_from_except = False

update.start()
# put update before start all modules, generate uuid for x-tunnel.

module_init.start_all_auto()
web_control.start(allow_remote)

Expand All @@ -164,7 +167,6 @@ def main():
import webbrowser
webbrowser.open("http://localhost:%s/" % host_port)

update.start()
if has_desktop:
download_modules.start_download()
update_from_github.cleanup()
Expand Down
1 change: 1 addition & 0 deletions code/default/launcher/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ def update_check_loop():


def start():
get_uuid()
p = threading.Thread(target=update_check_loop, name="check_update")
p.daemon = True
p.start()
Expand Down
37 changes: 37 additions & 0 deletions code/default/lib/noarch/selectors2.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,43 @@ def modify(self, fileobj, events, data=None):

return key

def register_event(self, fileobj, event, data):
try:
key = self._fd_to_key[self._fileobj_lookup(fileobj)]
except KeyError:
# not registered any event before, register
return self.register(fileobj, event, data)

if key.events & event:
# event already registered
return
else:
events = (key.events | event)
self.unregister(fileobj)
self.register(fileobj, events, data)

def unregister_event(self, fileobj, event):
# Return None if fileobj is removed or not exists

try:
key = self._fd_to_key[self._fileobj_lookup(fileobj)]
except KeyError:
# not exists
return

if not key.events & event:
# this event is not registered
return key

if key.events == event:
self.unregister(fileobj)
return
else:
events = (key.events & ~(event))
data = key.data
self.unregister(fileobj)
return self.register(fileobj, events, data)

def select(self, timeout=None):
""" Perform the actual selection until some monitored file objects
are ready or the timeout expires. """
Expand Down
1 change: 1 addition & 0 deletions code/default/lib/noarch/simple_http_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,7 @@ def check_listen_port_or_reset(self):

self.logger.warn("Listen %s:%d check failed", ip, port)
self.shutdown()
time.sleep(3)
self.start()
return

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.5.13
5.6.0
Loading

0 comments on commit 02858bb

Please sign in to comment.