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.
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. 2. 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. 3. 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::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 crate::Error
for more information.