From b171da35f5527377d70de1d9ad4b88badbe4ca2e Mon Sep 17 00:00:00 2001 From: Kyle Huey Date: Mon, 29 Jan 2018 03:05:16 -0800 Subject: [PATCH] Add an `is_desynchronized` on tokio_postgres::Connection. --- tokio-postgres/src/lib.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tokio-postgres/src/lib.rs b/tokio-postgres/src/lib.rs index de42e1b4..e63bfe0f 100644 --- a/tokio-postgres/src/lib.rs +++ b/tokio-postgres/src/lib.rs @@ -1136,6 +1136,15 @@ impl Connection { pub fn parameter(&self, param: &str) -> Option<&str> { self.0.parameters.get(param).map(|s| &**s) } + + /// Returns whether or not the stream has been desynchronized due to an + /// error in the communication channel with the server. + /// + /// If this has occurred, all further queries will immediately return an + /// error. + pub fn is_desynchronized(&self) -> bool { + self.0.desynchronized + } } /// A stream of asynchronous Postgres notifications.