mirror of
https://github.com/xcat2/confluent.git
synced 2026-04-12 20:01:30 +00:00
Clean up busy loop and other oddity with vcenter console
Fix it so that common conditions do not trigger trace logs and busy loops.
This commit is contained in:
@@ -38,8 +38,11 @@ class VmConsole(conapi.Console):
|
||||
self.socket = None
|
||||
|
||||
def connect(self, callback):
|
||||
try:
|
||||
self.socket = socket.create_connection((self.host, self.port))
|
||||
except Exception:
|
||||
callback(conapi.ConsoleEvent.Disconnect)
|
||||
self.connected = True
|
||||
self.socket = socket.create_connection((self.host, self.port))
|
||||
self.datacallback = callback
|
||||
self.recvr = eventlet.spawn(self.recvdata)
|
||||
|
||||
@@ -56,8 +59,8 @@ class VmConsole(conapi.Console):
|
||||
try:
|
||||
pendingdata = self.socket.recv(1024)
|
||||
except Exception as e:
|
||||
pendingdata = ''
|
||||
if pendingdata == '':
|
||||
pendingdata = b''
|
||||
if pendingdata == b'':
|
||||
self.connected = False
|
||||
self.datacallback(conapi.ConsoleEvent.Disconnect)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user