Skip to content

Commit 76418b8

Browse files
author
Travis-L-R
committed
Reorganising connect method calls for when connectNow is false
1 parent 3be73b4 commit 76418b8

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

meshtastic/tcp_interface.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@ def __init__(
3636

3737
self.socket: Optional[socket.socket] = None
3838

39-
if connectNow:
40-
self.myConnect()
41-
else:
42-
self.socket = None
43-
4439
super().__init__(debugOut=debugOut, noProto=noProto, connectNow=connectNow, noNodes=noNodes, timeout=timeout)
4540

4641
def __repr__(self):
@@ -65,8 +60,13 @@ def _socket_shutdown(self) -> None:
6560
if self.socket is not None:
6661
self.socket.shutdown(socket.SHUT_RDWR)
6762

63+
def connect(self) -> None:
64+
"""Connect the interface"""
65+
self.myConnect()
66+
super().connect()
67+
6868
def myConnect(self) -> None:
69-
"""Connect to socket"""
69+
"""Connect to socket (without attempting to start the interface's receive thread"""
7070
logger.debug(f"Connecting to {self.hostname}") # type: ignore[str-bytes-safe]
7171
server_address = (self.hostname, self.portNumber)
7272
self.socket = socket.create_connection(server_address)

0 commit comments

Comments
 (0)