2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-22 01:22:00 +00:00

Avoid potential endless recursion

If we are detaching, skip reattach in scenario
that leads to infinite recursion.
This commit is contained in:
Jarrod Johnson 2024-10-10 16:22:58 -04:00
parent b05b36484b
commit 81b57d5db6

View File

@ -705,10 +705,13 @@ class ProxyConsole(object):
if not util.cert_matches(self.managerinfo['fingerprint'],
remote.getpeercert(binary_form=True)):
raise Exception('Invalid peer certificate')
except Exception:
except Exception as e:
if _tracelog:
_tracelog.log(traceback.format_exc(), ltype=log.DataTypes.event,
event=log.Events.stacktrace)
eventlet.sleep(3)
if self.clisession:
self.clisession.detach()
self.clisession.detach(False)
self.detachsession(None)
return
tlvdata.recv(remote)
@ -835,7 +838,7 @@ class ConsoleSession(object):
self._evt = None
self.reghdl = None
def detach(self):
def detach(self, reattach=True):
"""Handler for the console handler to detach so it can reattach,
currently to facilitate changing from one collective.manager to
another
@ -843,9 +846,10 @@ class ConsoleSession(object):
:return:
"""
self.conshdl.detachsession(self)
self.connect_session()
self.conshdl.attachsession(self)
self.write = self.conshdl.write
if reattach:
self.connect_session()
self.conshdl.attachsession(self)
self.write = self.conshdl.write
def got_data(self, data):
"""Receive data from console and buffer