Skip to content

Commit

Permalink
Fix issue where connection state showed as connected without an activ…
Browse files Browse the repository at this point in the history
…e connection (regression from #4ceeeab)
  • Loading branch information
Srlion committed Oct 8, 2024
1 parent c12d703 commit 0ae93ce
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/conn/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand Down

0 comments on commit 0ae93ce

Please sign in to comment.