From 0ae93ce525f07a24d164ede4f5616d2c97a38bba Mon Sep 17 00:00:00 2001 From: Srlion Date: Tue, 8 Oct 2024 14:24:59 +0300 Subject: [PATCH] Fix issue where connection state showed as connected without an active connection (regression from #4ceeeab) --- src/conn/mod.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/conn/mod.rs b/src/conn/mod.rs index 65df051..6b38bc7 100644 --- a/src/conn/mod.rs +++ b/src/conn/mod.rs @@ -117,7 +117,8 @@ impl Conn { return Ok(()); } - let mut inner_conn = self.inner.lock().await.take(); + let mut inner_conn_mutex = self.inner.lock().await; + let mut inner_conn = inner_conn_mutex.take(); if let Some(conn) = inner_conn.take() { // let's gracefully close the connection if there is any @@ -131,7 +132,7 @@ impl Conn { match MySqlConnection::connect_with(connect_opts).await { Ok(conn) => { - inner_conn.replace(conn); + inner_conn_mutex.replace(conn); } Err(e) => { self.set_state(State::Error);