def __init__(self, url, auth, cred, connect_params, app_factory, *app_args, **app_kwargs): self.auth = auth self.cred = cred self._do_auth = bool(auth and cred) self._auth_reconnect = False SimpleAppClientFactory.__init__(self, url, connect_params, app_factory, *app_args, **app_kwargs) if self._do_auth: self.set_app_auth_args(self.auth.get_auth_args(self.cred, None))
def clientConnectionLost(self, connector, reason): log.debug('clientConnectionLost(%r, %r) [%r]', connector, reason, self._auth_reconnect) if self._auth_reconnect: self._auth_reconnect = False connector.connect() else: if self._do_auth: # update the auth args in case we'll want to re-connect... self.set_app_auth_args(self.auth.get_auth_args(self.cred, None)) SimpleAppClientFactory.clientConnectionLost(self, connector, reason)