litex_term: improve connection setup

This commit is contained in:
Lasse Dalegaard 2023-03-14 10:48:19 +01:00
parent 38282effd4
commit fe714f8fe7
1 changed files with 6 additions and 2 deletions

View File

@ -144,11 +144,15 @@ class JTAGUART:
self.alive = True self.alive = True
self.jtag2tcp_thread = threading.Thread(target=self.jtag2tcp, daemon=True) self.jtag2tcp_thread = threading.Thread(target=self.jtag2tcp, daemon=True)
self.jtag2tcp_thread.start() self.jtag2tcp_thread.start()
time.sleep(0.5)
self.pty2tcp_thread = threading.Thread(target=self.pty2tcp, daemon=True) self.pty2tcp_thread = threading.Thread(target=self.pty2tcp, daemon=True)
self.tcp2pty_thread = threading.Thread(target=self.tcp2pty, daemon=True) self.tcp2pty_thread = threading.Thread(target=self.tcp2pty, daemon=True)
self.tcp = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.tcp = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
for _ in range(0, 50):
try:
self.tcp.connect(("localhost", self.port)) self.tcp.connect(("localhost", self.port))
break
except ConnectionRefusedError:
time.sleep(0.1)
self.pty2tcp_thread.start() self.pty2tcp_thread.start()
self.tcp2pty_thread.start() self.tcp2pty_thread.start()