Struct miltr_server::Server
source · pub struct Server<'m, M: Milter> { /* private fields */ }Expand description
The entry point to host a milter server
Implementations§
source§impl<'m, M: Milter> Server<'m, M>
impl<'m, M: Milter> Server<'m, M>
sourcepub fn new(
milter: &'m mut M,
quit_on_abort: bool,
max_buffer_size: usize
) -> Self
pub fn new( milter: &'m mut M, quit_on_abort: bool, max_buffer_size: usize ) -> Self
Create a new Server to handle connections
sourcepub fn default_postfix(milter: &'m mut M) -> Self
pub fn default_postfix(milter: &'m mut M) -> Self
Create a server with defaults working with postfix.
The main difference is treating the call to abort like a call to
quit. See this comment as a source in the postfix docs
AFAIK, originally there where three use cases individual methods:
- Abort
The current smtp client that is connected to the milter client has finished. Next mail arrives. - Quit
The current smtp client that was connected to the milter client has quit it’s connection and the milter client will now quit this connection. - Quit NC
The current smtp client that was connected to the milter client has quit it’s connection but the milter client would like to re-use this connection for someone else.
Different implementation mix them up, making e.g. postfix just always opening up a new connection for every milter conversation.
sourcepub async fn handle_connection<RW: AsyncRead + AsyncWrite + Unpin + Send>(
&mut self,
socket: RW
) -> Result<(), Error<M::Error>>
pub async fn handle_connection<RW: AsyncRead + AsyncWrite + Unpin + Send>( &mut self, socket: RW ) -> Result<(), Error<M::Error>>
Handle a single milter connection.
§Arguments
- milter: the object implementing [
crate::server::Milter]. It’s methods will be called at the appropriate times.
§Errors
This basically errors for three cases: Io Problems, Codec Problems and problems returned by the milter implementation.
Have a look at [enum@crate::server::Error] for more information.
Trait Implementations§
Auto Trait Implementations§
impl<'m, M> RefUnwindSafe for Server<'m, M>where
M: RefUnwindSafe,
impl<'m, M> Send for Server<'m, M>
impl<'m, M> Sync for Server<'m, M>where
M: Sync,
impl<'m, M> Unpin for Server<'m, M>
impl<'m, M> !UnwindSafe for Server<'m, M>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more