diff --git a/lib/Qpsmtpd/Connection.pm b/lib/Qpsmtpd/Connection.pm index ceac262..f14e23b 100644 --- a/lib/Qpsmtpd/Connection.pm +++ b/lib/Qpsmtpd/Connection.pm @@ -108,6 +108,12 @@ sub notes { $self->{_notes}->{$key}; } +sub reset { + my $self = shift; + $self->{_notes} = undef; + $self = $self->new; +} + 1; __END__ diff --git a/lib/Qpsmtpd/TcpServer.pm b/lib/Qpsmtpd/TcpServer.pm index 8a1dbd5..abf29d2 100644 --- a/lib/Qpsmtpd/TcpServer.pm +++ b/lib/Qpsmtpd/TcpServer.pm @@ -118,6 +118,7 @@ sub disconnect { $self->log(LOGINFO,"click, disconnecting"); $self->SUPER::disconnect(@_); $self->run_hooks("post-connection"); + $self->connection->reset; exit; } diff --git a/lib/Qpsmtpd/TcpServer/Prefork.pm b/lib/Qpsmtpd/TcpServer/Prefork.pm index cd2dac5..7caae1c 100644 --- a/lib/Qpsmtpd/TcpServer/Prefork.pm +++ b/lib/Qpsmtpd/TcpServer/Prefork.pm @@ -59,6 +59,7 @@ sub disconnect { $self->log(LOGINFO,"click, disconnecting"); $self->SUPER::disconnect(@_); $self->run_hooks("post-connection"); + $self->connection->reset; die "disconnect_tcpserver"; } diff --git a/qpsmtpd b/qpsmtpd index b65517f..b11a489 100755 --- a/qpsmtpd +++ b/qpsmtpd @@ -23,6 +23,7 @@ $qpsmtpd->load_plugins(); $qpsmtpd->start_connection(); $qpsmtpd->run(); $qpsmtpd->run_hooks("post-connection"); +$qpsmtpd->connection->reset; __END__ diff --git a/qpsmtpd-forkserver b/qpsmtpd-forkserver index d2e7aee..30c32d0 100755 --- a/qpsmtpd-forkserver +++ b/qpsmtpd-forkserver @@ -312,6 +312,7 @@ while (1) { $qpsmtpd->run(); $qpsmtpd->run_hooks("post-connection"); + $qpsmtpd->connection->reset; exit; # child leaves } } diff --git a/qpsmtpd-prefork b/qpsmtpd-prefork index 75daa17..5cbca17 100755 --- a/qpsmtpd-prefork +++ b/qpsmtpd-prefork @@ -616,6 +616,7 @@ sub qpsmtpd_session { ); $qpsmtpd->run(); $qpsmtpd->run_hooks("post-connection"); + $qpsmtpd->connection->reset; }; if ($@ !~ /^(disconnect_tcpserver|died while reading from STDIN)/) { warn("$@");