From b80ffac53291a45d5239e7476580d0eeac0af738 Mon Sep 17 00:00:00 2001 From: "Hailu, Mikael" Date: Thu, 23 Nov 2023 14:58:02 +0100 Subject: [PATCH 1/4] Refactor sync.client.conncect & sync.server.start Reopen ThreadLoop if stopped previously analogous to init Fixes #1364 --- asyncua/sync.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/asyncua/sync.py b/asyncua/sync.py index 63993f594..9f334839c 100644 --- a/asyncua/sync.py +++ b/asyncua/sync.py @@ -249,9 +249,12 @@ def application_uri(self): def application_uri(self, value): self.aio_obj.application_uri = value - @syncmethod def connect(self) -> None: - pass + if not self.tloop.is_alive(): + self.tloop = ThreadLoop() + self.tloop.start() + self.close_tloop = True + self.tloop.post(self.aio_obj.connect()) def disconnect(self) -> None: try: @@ -592,9 +595,12 @@ def register_namespace(self, url): def get_namespace_array(self): pass - @syncmethod def start(self): - pass + if not self.tloop.is_alive(): + self.tloop = ThreadLoop() + self.tloop.start() + self.close_tloop = True + self.tloop.post(self.aio_obj.start()) def stop(self): self.tloop.post(self.aio_obj.stop()) From 5846fea346856c5a1f016565c93dc0fb8e10ef13 Mon Sep 17 00:00:00 2001 From: "Hailu, Mikael" Date: Mon, 11 Dec 2023 14:12:46 +0100 Subject: [PATCH 2/4] Include Fork note in setup.py --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 2a22e7f2b..e2e4b206d 100644 --- a/setup.py +++ b/setup.py @@ -14,12 +14,12 @@ setup( name="asyncua", version="1.0.5", - description="Pure Python OPC-UA client and server library", + description="Pure Python OPC-UA client and server library\nATTENTION: This is a fork of the original project", long_description=long_description, long_description_content_type='text/markdown', author="Olivier Roulet-Dubonnet", author_email="olivier.roulet@gmail.com", - url='http://freeopcua.github.io/', + url='http://freeopcua.github.io/\nLink to the fork: https://github.com/miki5799/opcua-asyncio/tree/master', packages=find_packages(exclude=["tests"]), provides=["asyncua"], license="GNU Lesser General Public License v3 or later", From 8dab330ff659915e3e90f0ff883b77f7f29b2bd7 Mon Sep 17 00:00:00 2001 From: "Hailu, Mikael" Date: Tue, 12 Dec 2023 18:18:52 +0100 Subject: [PATCH 3/4] Updated connect_sessionless and connect_socket to start new thread if necessary --- asyncua/sync.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/asyncua/sync.py b/asyncua/sync.py index 9f334839c..b8cde51f5 100644 --- a/asyncua/sync.py +++ b/asyncua/sync.py @@ -263,9 +263,12 @@ def disconnect(self) -> None: if self.close_tloop: self.tloop.stop() - @syncmethod def connect_sessionless(self) -> None: - pass + if not self.tloop.is_alive(): + self.tloop = ThreadLoop() + self.tloop.start() + self.close_tloop = True + self.tloop.post(self.aio_obj.connect_sessionless()) def disconnect_sessionless(self) -> None: try: @@ -274,9 +277,12 @@ def disconnect_sessionless(self) -> None: if self.close_tloop: self.tloop.stop() - @syncmethod def connect_socket(self) -> None: - pass + if not self.tloop.is_alive(): + self.tloop = ThreadLoop() + self.tloop.start() + self.close_tloop = True + self.tloop.post(self.aio_obj.connect_sessionless()) def disconnect_socket(self) -> None: try: From 7be113de5f3f26f97791e5f308872b006aee4beb Mon Sep 17 00:00:00 2001 From: "Hailu, Mikael" Date: Thu, 21 Dec 2023 00:55:35 +0100 Subject: [PATCH 4/4] Revert "Include Fork note in setup.py" This reverts commit 5846fea346856c5a1f016565c93dc0fb8e10ef13. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index eb735a2e5..acab2613b 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ long_description_content_type='text/markdown', author="Olivier Roulet-Dubonnet", author_email="olivier.roulet@gmail.com", - url='http://freeopcua.github.io/\nLink to the fork: https://github.com/miki5799/opcua-asyncio/tree/master', + url='http://freeopcua.github.io/', packages=find_packages(exclude=["tests"]), provides=["asyncua"], license="GNU Lesser General Public License v3 or later",