diff --git a/hbd/client/main.py b/hbd/client/main.py index cfce61f..ea3f230 100644 --- a/hbd/client/main.py +++ b/hbd/client/main.py @@ -172,9 +172,8 @@ class HeartbeatProtocol(asyncio.DatagramProtocol): self.logger.error(f"Error processing datagram: {e}", exc_info=True) def error_received(self, exc): - """Handle protocol errors.""" - self.logger.warning(f"Protocol error on {self.connection.addr}: {exc} — dropping connection") - self.connection._dead = True + """Handle protocol errors — close transport so the heartbeat sender retries.""" + self.logger.warning(f"Protocol error on {self.connection.addr}: {exc} — will retry") self.connection.close() diff --git a/scripts/hbc_mini.py b/scripts/hbc_mini.py index be64c91..60fc3f7 100755 --- a/scripts/hbc_mini.py +++ b/scripts/hbc_mini.py @@ -797,8 +797,7 @@ class _HeartbeatProtocol(asyncio.DatagramProtocol): self._log.error("datagram error: %s", e) def error_received(self, exc): - self._log.warning("protocol error on %s: %s — dropping connection", self._conn.addr, exc) - self._conn._dead = True + self._log.warning("protocol error on %s: %s — will retry", self._conn.addr, exc) self._conn.close()