fix: synchronous pool shutdowns being arbitrarily delayed (#1041)

Previously, the connection pool thread did not drop its upgraded `Arc` pool reference while sleeping until the next idle duration check. This causes a drop of the `SmtpTransport` to not shut down any connections until said thread wakes up again (since it still holds a reference to the pool), which can take up to 60s with default settings. In practice, this means that connections will most likely not be properly closed before the program exists, (since the `SmtpTransport` is most likely dropped when the program shuts down) which violates the SMTP specification which states that:
> The sender MUST NOT intentionally close the channel until it sends a QUIT command, and it SHOULD wait until it receives the reply (even if there was an error response to a command).
This commit is contained in:
Popax21
2025-02-07 08:29:06 +01:00
committed by GitHub
parent 891dd521ab
commit 795bedae76

View File

@@ -109,6 +109,7 @@ impl Pool {
}
}
drop(pool);
thread::sleep(idle_timeout);
}
})