Danga::Socket->Reset() deletes all timers. Idle SMTP connections do not time out anymore. The attached patch restores the timers.
Thank you, Radu Greab
=== qpsmtpd-async ================================================================== --- qpsmtpd-async (revision 119) +++ qpsmtpd-async (local) @@ -45,8 +45,8 @@ $USER = "smtpd" if $USER eq "root"; my $PAUSED = 0; my $NUMACCEPT = 20; -my $ACCEPT_RSET = Danga::Socket->AddTimer(30, \&reset_num_accept); -my $PID_FILE = ''; +my $PID_FILE = ''; +my $ACCEPT_RSET; my $DETACH; # daemonize on startup # make sure we don't spend forever doing accept() @@ -177,6 +177,8 @@ fileno($SERVER) => \&accept_handler, ); + $ACCEPT_RSET = Danga::Socket->AddTimer(30, \&reset_num_accept); + $plugin_loader->run_hooks('post-fork'); Qpsmtpd::PollServer->EventLoop(); @@ -380,7 +382,7 @@ # So double the number we accept next time. $NUMACCEPT *= 2; $NUMACCEPT = ACCEPT_MAX if $NUMACCEPT > ACCEPT_MAX; - $ACCEPT_RSET->cancel; + $ACCEPT_RSET->cancel if defined $ACCEPT_RSET; $ACCEPT_RSET = Danga::Socket->AddTimer(30, \&reset_num_accept); } === lib/Danga/TimeoutSocket.pm ================================================================== --- lib/Danga/TimeoutSocket.pm (revision 119) +++ lib/Danga/TimeoutSocket.pm (local) @@ -25,6 +25,11 @@ sub max_idle_time { 0 } sub max_connect_time { 0 } +sub Reset { + Danga::Socket->Reset; + Danga::Socket->AddTimer(15, \&_do_cleanup); +} + sub _do_cleanup { my $now = time;