Skip to content

Commit

Permalink
Updated connect_sessionless and connect_socket
Browse files Browse the repository at this point in the history
to start new thread if necessary
  • Loading branch information
miki5799 committed Dec 12, 2023
1 parent 5846fea commit 8dab330
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 @@ -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:
Expand All @@ -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:
Expand Down

0 comments on commit 8dab330

Please sign in to comment.