Restore timers on reset
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@859 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
parent
640eadea50
commit
31a498cfd7
@ -25,6 +25,11 @@ sub new {
|
||||
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;
|
||||
|
||||
|
@ -45,8 +45,8 @@ my $USER = (getpwuid $>)[0]; # user to suid to
|
||||
$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 @@ sub spawn_child {
|
||||
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 @@ sub accept_handler {
|
||||
# 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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user