diff --git a/src/conn/mod.rs b/src/conn/mod.rs index 436afff6..f1f64cb0 100644 --- a/src/conn/mod.rs +++ b/src/conn/mod.rs @@ -1032,7 +1032,7 @@ impl Conn { pub async fn get_binlog_stream(mut self, request: BinlogRequest<'_>) -> Result { // We'll disconnect this connection from a pool before requesting the binlog. - self.inner.pool = None; + self.inner.pool.take().map(|pool| pool.cancel_connection()); self.request_binlog(request).await?; Ok(BinlogStream::new(self)) diff --git a/src/conn/pool/mod.rs b/src/conn/pool/mod.rs index ffbc2b89..55a34d59 100644 --- a/src/conn/pool/mod.rs +++ b/src/conn/pool/mod.rs @@ -221,7 +221,7 @@ impl Pool { /// /// Decreases the exist counter since a broken or dropped connection should not count towards /// the total. - fn cancel_connection(&self) { + pub(super) fn cancel_connection(&self) { let mut exchange = self.inner.exchange.lock().unwrap(); exchange.exist -= 1; // we just enabled the creation of a new connection!