diff options
author | Quentin Dufour <quentin@deuxfleurs.fr> | 2022-06-15 18:40:39 +0200 |
---|---|---|
committer | Quentin Dufour <quentin@deuxfleurs.fr> | 2022-06-15 18:40:39 +0200 |
commit | 6b5b53916efb4897643172fdf461291b4effcf48 (patch) | |
tree | 9030270809e8b2fd56bc91b19d82915ea8c85641 /src/service.rs | |
parent | 2bbcb119c437a3d8ba5d747f76898faa5ad32d93 (diff) | |
parent | 0700e27127e4644dbd323b9a22d994209143fa2a (diff) | |
download | aerogramme-6b5b53916efb4897643172fdf461291b4effcf48.tar.gz aerogramme-6b5b53916efb4897643172fdf461291b4effcf48.zip |
Add LMTP support
Diffstat (limited to 'src/service.rs')
-rw-r--r-- | src/service.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/service.rs b/src/service.rs index f99ba7a..ce272a3 100644 --- a/src/service.rs +++ b/src/service.rs @@ -9,15 +9,15 @@ use futures::future::BoxFuture; use futures::future::FutureExt; use tower::Service; -use crate::mailstore::Mailstore; use crate::session; +use crate::LoginProvider; pub struct Instance { - pub mailstore: Arc<Mailstore>, + login_provider: Arc<dyn LoginProvider + Send + Sync>, } impl Instance { - pub fn new(mailstore: Arc<Mailstore>) -> Self { - Self { mailstore } + pub fn new(login_provider: Arc<dyn LoginProvider + Send + Sync>) -> Self { + Self { login_provider } } } impl<'a> Service<&'a AddrStream> for Instance { @@ -31,8 +31,8 @@ impl<'a> Service<&'a AddrStream> for Instance { fn call(&mut self, addr: &'a AddrStream) -> Self::Future { tracing::info!(remote_addr = %addr.remote_addr, local_addr = %addr.local_addr, "accept"); - let ms = self.mailstore.clone(); - async { Ok(Connection::new(ms)) }.boxed() + let lp = self.login_provider.clone(); + async { Ok(Connection::new(lp)) }.boxed() } } @@ -40,9 +40,9 @@ pub struct Connection { session: session::Manager, } impl Connection { - pub fn new(mailstore: Arc<Mailstore>) -> Self { + pub fn new(login_provider: Arc<dyn LoginProvider + Send + Sync>) -> Self { Self { - session: session::Manager::new(mailstore), + session: session::Manager::new(login_provider), } } } |