2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-25 02:52:07 +00:00

Catch OpenBMC disconnects and handle them better

This commit is contained in:
Jarrod Johnson 2024-10-28 09:41:38 -04:00
parent 008c1308b4
commit a298ef8d74

View File

@ -124,7 +124,10 @@ class TsmConsole(conapi.Console):
def recvdata(self):
while self.connected:
pendingdata = self.ws.recv()
try:
pendingdata = self.ws.recv()
except websocket.WebSocketConnectionClosedException:
pendingdata = ''
if pendingdata == '':
self.datacallback(conapi.ConsoleEvent.Disconnect)
return
@ -153,7 +156,10 @@ class TsmConsole(conapi.Console):
return
def write(self, data):
self.ws.send(data)
try:
self.ws.send(data)
except websocket.WebSocketConnectionClosedException:
self.datacallback(conapi.ConsoleEvent.Disconnect)
def close(self):
if self.recvr: