Skip to content

Commit

Permalink
Refactor sync.client.conncect & sync.server.start
Browse files Browse the repository at this point in the history
Reopen ThreadLoop if  stopped previously analogous to init
Fixes FreeOpcUa#1364
  • Loading branch information
miki5799 committed Nov 23, 2023
1 parent a6fe064 commit b80ffac
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions asyncua/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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())
Expand Down

0 comments on commit b80ffac

Please sign in to comment.