On Mar 5, 2009, at 22:06, jaredj wrote:
This makes hook_reset_transaction a bit more useful by running it on
disconnections. It also ensures that hook_disconnect runs when the
client disconnects without QUITing.
---
lib/Qpsmtpd/SMTP.pm | 1 +
lib/Qpsmtpd/TcpServer.pm | 4 ++++
lib/Qpsmtpd/TcpServer/Prefork.pm | 5 +++++
3 files changed, 10 insertions(+), 0 deletions(-)
[...]
diff --git a/lib/Qpsmtpd/TcpServer.pm b/lib/Qpsmtpd/TcpServer.pm
index df9da9a..446870b 100644
--- a/lib/Qpsmtpd/TcpServer.pm
+++ b/lib/Qpsmtpd/TcpServer.pm
@@ -100,6 +100,10 @@ sub read_input {
alarm $timeout;
}
alarm(0);
+ return if $self->connection->notes('disconnected');
+ $self->reset_transaction;
+ $self->run_hooks('disconnect');
+ $self->connection->notes(disconnected => 1);
}
Shouldn't there be something similar in Qpsmtpd::PollServer? (Or
maybe put it in Qpsmtpd::SMTP to avoid the duplication).
- ask
--
http://develooper.com/ - http://askask.com/