[svn:qpsmtpd] rev 445 - in branches/high_perf: lib plugins

[email protected] 22 Jun 2005 18:25:16 -0000
Newsgroups perl.cvs.qpsmtpd
Message-ID <[email protected]>
Author: msergeant
Date: Wed Jun 22 11:25:16 2005
New Revision: 445

Modified:
   branches/high_perf/lib/Qpsmtpd.pm
   branches/high_perf/plugins/check_earlytalker
Log:
Push enable/disable read call into lib/Qpsmtpd.pm


Modified: branches/high_perf/lib/Qpsmtpd.pm
==============================================================================
--- branches/high_perf/lib/Qpsmtpd.pm	(original)
+++ branches/high_perf/lib/Qpsmtpd.pm	Wed Jun 22 11:25:16 2005
@@ -220,6 +220,7 @@ sub run_hooks {
       @r = $self->run_hook($hook, $code, @_);
       next unless @r;
       if ($r[0] == CONTINUATION) {
+        $self->disable_read() if $self->isa('Danga::Client');
         $self->{_continuation} = [$hook, [@_], @local_hooks];
       }
       last unless $r[0] == DECLINED;
@@ -233,6 +234,7 @@ sub run_hooks {
 sub finish_continuation {
   my ($self) = @_;
   die "No continuation in progress" unless $self->{_continuation};
+  $self->enable_read() if $self->isa('Danga::Client');
   my $todo = $self->{_continuation};
   $self->{_continuation} = undef;
   my $hook = shift @$todo || die "No hook in the continuation";
@@ -242,6 +244,7 @@ sub finish_continuation {
     my $code = shift @$todo;
     @r = $self->run_hook($hook, $code, @$args);
     if ($r[0] == CONTINUATION) {
+      $self->disable_read() if $self->isa('Danga::Client');
       $self->{_continuation} = [$hook, $args, @$todo];
       return @r;
     }
@@ -250,6 +253,7 @@ sub finish_continuation {
   $r[0] = DECLINED if not defined $r[0];
   my $responder = $hook . "_respond";
   if (my $meth = $self->can($responder)) {
+    warn("continuation finished on $self\n");
     return $meth->($self, @r, @$args);
   }
   die "No ${hook}_respond method";

Modified: branches/high_perf/plugins/check_earlytalker
==============================================================================
--- branches/high_perf/plugins/check_earlytalker	(original)
+++ branches/high_perf/plugins/check_earlytalker	Wed Jun 22 11:25:16 2005
@@ -61,26 +61,21 @@ sub register {
   $self->register_hook('connect', 'connect_post_handler');
   $self->register_hook('mail', 'mail_handler')
     if $self->{_args}->{'defer-reject'};
-  warn("check_earlytalker registered\n");
   1;
 }
 
 sub connect_handler {
   my ($self, $transaction) = @_;
   
-  warn("check early talker");
   my $qp = $self->qp;
   my $conn = $qp->connection;
   $qp->AddTimer($self->{_args}{'wait'}, sub { read_now($qp, $conn) });
-  $qp->disable_read();
   return CONTINUATION;
 }
 
 sub read_now {
   my ($qp, $conn) = @_;
   
-  warn("read now");
-  $qp->enable_read();
   if (my $data = $qp->read(1024)) {
     if (length($$data)) {
       $qp->log(LOGNOTICE, 'remote host started talking before we said hello');