Commit c959a57a authored by JoCutajar's avatar JoCutajar
Browse files

LMTP will actually reuse the transport :)

parent 44a67a52
......@@ -60,6 +60,7 @@ dependencies = [
[[package]]
name = "async-smtp"
version = "0.4.3"
source = "git+https://github.com/BrightOpen/async-smtp.git#d3df60bd0b608fc4934de364297b7f5c5e8520e6"
dependencies = [
"async-native-tls",
"async-std",
......
......@@ -28,8 +28,7 @@ async-tls = "0.10"
async-trait = { git = "https://github.com/BrightOpen/async-trait.git", branch = "master" }
[dependencies.async-smtp]
#git = "https://github.com/BrightOpen/async-smtp.git"
path = "/home/debian/Documents/Projects/async-smtp"
git = "https://github.com/BrightOpen/async-smtp.git"
branch = "master"
features = ["native-tls-vendored"]
version = "0.4.3"
......@@ -7,6 +7,7 @@ use crate::net::*;
use async_smtp::prelude::{
EmailAddress, Envelope, MailDataStream, SmtpClient, SmtpTransport, Transport,
};
use async_smtp::smtp::ConnectionReuseParameters;
use samotop_core::common::*;
use samotop_core::model::mail::DispatchError;
use samotop_core::model::mail::DispatchResult;
......@@ -29,7 +30,11 @@ pub mod variant {
impl Config<variant::TcpLmtpDispatch> {
pub fn tcp_lmtp_dispatch(address: String) -> Result<Self> {
let variant = variant::TcpLmtpDispatch {
transport: Arc::new(SmtpClient::new(&address)?.connect_with(conn())),
transport: Arc::new(
SmtpClient::new(&address)?
.connection_reuse(ConnectionReuseParameters::ReuseUnlimited)
.connect_with(conn()),
),
};
Ok(Self { variant, address })
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment