in src/dubbo/registry/zookeeper/kazoo_transport.py [0:0]
def __call__(self, state: KazooState):
"""
Handle state changes and notify the listener.
This method is called with the current state of the KazooClient, converts it to an internal
state representation, and notifies all registered listeners.
:param state: The current state of the KazooClient.
:type state: KazooState
"""
if state == KazooState.CONNECTED:
state = StateListener.State.CONNECTED
elif state == KazooState.LOST:
state = StateListener.State.LOST
elif state == KazooState.SUSPENDED:
state = StateListener.State.SUSPENDED
# Notify all listeners
for listener in self._listeners:
listener.state_changed(state)