From cf6bfc63692143a199c4981bcdb153e3e0c35ab7 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Thu, 11 Aug 2022 01:57:12 -0400 Subject: [PATCH] bugfix --- appPublic/port_forward.py | 22 +++++++++++++++++++++- appPublic/version.py | 11 ----------- setup.py | 14 ++++++++------ 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/appPublic/port_forward.py b/appPublic/port_forward.py index 3157d98..739f309 100644 --- a/appPublic/port_forward.py +++ b/appPublic/port_forward.py @@ -11,6 +11,18 @@ except ImportError: class ForwardServer(SocketServer.ThreadingTCPServer): daemon_threads = True allow_reuse_address = True + server_ready = False + ready_callback = None + def service_actions(self): + super().service_actions() + if not self.server_ready: + self.server_ready = True + if self.ready_callback: + self.ready_callback() + + def shutdown(self): + self.server_ready = False + super().shutdown() g_verbose = True def verbose(s): @@ -82,6 +94,11 @@ class SSHPortForward: self.ssh_user = ssh_user self.ssh_password = ssh_password self.running = False + self._ready = False + + def service_ready(self): + print('servie ready .....') + self._ready = True def run(self): if self.running: @@ -97,13 +114,16 @@ class SSHPortForward: self.ssh_password) self.transport = self.ssh.get_transport() + class MyForwardServer(ForwardServer): + ready_callback = self.service_ready + class SubHandler(Handler): chain_host = socket.gethostbyname(self.remote_host) chain_port = self.remote_port local_port = self.local_port ssh_transport = self.transport - self.forward_server = ForwardServer((socket.gethostbyname('localhost'), self.local_port), SubHandler) + self.forward_server = MyForwardServer((socket.gethostbyname('localhost'), self.local_port), SubHandler) self.forward_server.serve_forever() print('forward ....') diff --git a/appPublic/version.py b/appPublic/version.py index 38077ef..340fb0d 100644 --- a/appPublic/version.py +++ b/appPublic/version.py @@ -1,12 +1 @@ -# initial version -# __version__ = '5.1.12' -# add country name Chinese English convert functions -# __version__ = '5.1.13' -# replace cryptography with rsa module, because ONLY using rsa modulde in cryptography and cryptography not easy to compile for ios -# __version__ = '5.1.14' -# keep 5.1.14 version's change -# __version__ = '5.1.15' -# keep 5.1.14 version's change -# __version__ = '5.1.16' -# add ssh port forward function __version__ = '5.1.17' diff --git a/setup.py b/setup.py index 6f45d33..86ee60e 100755 --- a/setup.py +++ b/setup.py @@ -6,12 +6,14 @@ try: except ImportError: from distutils.core import setup -# usage: -# python setup.py bdist_wininst generate a window executable file -# python setup.py bdist_egg generate a egg file -# Release information about eway +with open('appPublic/version.py', 'r') as f: + x = f.read() + y = x[x.index("'")+1:] + z = y[:y.index("'")] + version = z +with open("README.md", "r") as fh: + long_description = fh.read() -version = __version__ name = "appPublic" description = "appPublic" author = "yumoqing" @@ -37,7 +39,7 @@ setup( keywords = [ ], url="https://github.com/yumoqing/appPublic", - long_description=description, + long_description=long_description, long_description_content_type="text/markdown", classifiers = [ 'Operating System :: OS Independent',