pub fn is_connection_lost(msg: &str) -> boolExpand description
Classify an error message as one where the underlying connection is no
longer usable and the caller should recycle it. Used to decide whether
the crate::engine::Engine should be torn down and reinitialized
before the next call.
Covers two distinct failure modes:
-
Transport-level disappearance — OS broken-pipe / reset / refused plus the generic end-of-file and “connection closed” responses the
PostgreSQLclient produces whenhyperdcrashes or is killed mid-transaction. -
Wire-protocol desync — the
hyper-clientlayer marks a connectiondesynchronizedwhen its bounded drain exhausts thePOST_ERROR_DRAIN_CAPbudget without reachingReadyForQueryor hits an I/O error mid-drain. Subsequent operations on that connection fast-fail with anErrorKind::Connectionwhose message contains"desynchronized". The socket is technically still open but the wire state is corrupt and the only valid recovery is the same as #1: discard the connection and reconnect. Recognizing the signal here is what makes the mcp server’s auto-reconnect path kick in for that case instead of returning the drain-poisoned error to callers forever.