From e9d5124a26d7d5901e48b0f4ae073c3f059dc684 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20B=C3=BCrgin?= Date: Mon, 14 Mar 2022 08:31:38 +0100 Subject: [PATCH] Increase connection timeout --- CHANGELOG.md | 8 ++++++++ src/lib.rs | 9 +++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64c9363..57dcffa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # SpamAssassin Milter changelog +## 0.3.1 (unreleased) + +### Fixed + +* The milter’s connection timeout duration has been increased substantially. The + previously used duration of five minutes turned out to be too short for some + slow SMTP conversations. + ## 0.3.0 (2022-03-08) In this release, the milter implementation has been replaced with the new diff --git a/src/lib.rs b/src/lib.rs index af23fd3..619457b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,7 +17,7 @@ mod error; pub use crate::config::{Config, ConfigBuilder}; use indymilter::IntoListener; -use std::{future::Future, io}; +use std::{future::Future, io, time::Duration}; /// The name of the SpamAssassin Milter application. pub const MILTER_NAME: &str = "SpamAssassin Milter"; @@ -56,7 +56,12 @@ pub async fn run( shutdown: impl Future, ) -> io::Result<()> { let callbacks = callbacks::make_callbacks(config); - let config = Default::default(); + + // Override default timeout, which is too short in practice. + let config = indymilter::Config { + connection_timeout: Duration::from_secs(7210), + ..Default::default() + }; indymilter::run(listener, callbacks, config, shutdown).await }