diff --git a/tanner/reporting/hpfeeds.py b/tanner/reporting/hpfeeds.py index ec6d3395..2254a17c 100644 --- a/tanner/reporting/hpfeeds.py +++ b/tanner/reporting/hpfeeds.py @@ -173,6 +173,8 @@ def tryconnect(self): if not self.connected: raise Disconnect() + else: + logger.warning("Trying to connect, but already connected!") def close_old(self): if self.s: @@ -227,9 +229,12 @@ def publish(self, chaninfo, data): self.send(msgpublish(self.ident, c, data)) except Disconnect: logger.info("Disconnected from broker (in publish).") + self.connected = False if self.reconnect: self.tryconnect() else: + logger.info("Do not reconnect, aborting.") + self.close_old() raise def close(self): @@ -241,6 +246,6 @@ def close(self): def new(host=None, port=10000, ident=None, secret=None, reconnect=True): try: - return HPC(host, port, ident, secret, reconnect) + return HPC(host, port, ident, secret, reconnect=reconnect) except Exception: raise