]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/DS.pm
git: fix asynchronous batching for deep pipelines
[public-inbox.git] / lib / PublicInbox / DS.pm
index fee31e3d132ab675ff11a9e16c9e623ddce8d1d3..e4629e97acc461aaa2debbe1687db8f0aecab796 100644 (file)
@@ -126,12 +126,11 @@ sub add_uniq_timer { # ($name, $secs, $coderef, @args) = @_;
 
 # caller sets return value to $Epoll
 sub _InitPoller () {
-       if (PublicInbox::Syscall::epoll_defined())  {
+       if (defined $PublicInbox::Syscall::SYS_epoll_create)  {
                my $fd = epoll_create();
                die "epoll_create: $!" if $fd < 0;
                open($ep_io, '+<&=', $fd) or return;
-               my $fl = fcntl($ep_io, F_GETFD, 0);
-               fcntl($ep_io, F_SETFD, $fl | FD_CLOEXEC);
+               fcntl($ep_io, F_SETFD, FD_CLOEXEC);
                $fd;
        } else {
                my $cls;
@@ -648,8 +647,8 @@ sub shutdn ($) {
     }
 }
 
-sub zflush {} # overridden by NNTPdeflate and IMAPdeflate
-
+sub dflush {} # overridden by DSdeflate
+sub compressed {} # overridden by DSdeflate
 sub long_response_done {} # overridden by Net::NNTP
 
 sub long_step {
@@ -660,8 +659,8 @@ sub long_step {
        if ($@ || !$self->{sock}) { # something bad happened...
                delete $self->{long_cb};
                my $elapsed = now() - $t0;
-               $@ and $self->err("%s during long response[$fd] - %0.6f",
-                                   $@, $elapsed);
+               $@ and warn("$@ during long response[$fd] - ",
+                               sprintf('%0.6f', $elapsed),"\n");
                $self->out(" deferred[$fd] aborted - %0.6f", $elapsed);
                $self->close;
        } elsif ($more) { # $self->{wbuf}:
@@ -682,13 +681,13 @@ sub requeue_once {
        my ($self) = @_;
        # COMPRESS users all share the same DEFLATE context.
        # Flush it here to ensure clients don't see each other's data
-       $self->zflush;
+       $self->dflush;
 
        # no recursion, schedule another call ASAP,
        # but only after all pending writes are done.
        # autovivify wbuf.  wbuf may be populated by $cb,
        # no need to rearm if so: (push returns new size of array)
-       requeue($self) if push(@{$self->{wbuf}}, \&long_step) == 1;
+       $self->requeue if push(@{$self->{wbuf}}, \&long_step) == 1;
 }
 
 sub long_response ($$;@) {