+ if (defined $self->{cb}) {
+ # this may call async_pass when headers are done
+ $self->{cb}->($self->{arg});
+ } elsif (my $sock = $self->{sock}) {
+ # $http may be undef if discarding body output from cgit on 404
+ my $http = $self->{http} or return $self->close;
+ # $self->{sock} is a read pipe for git-http-backend or cgit
+ # and 65536 is the default Linux pipe size
+ my $r = sysread($sock, my $buf, 65536);
+ if ($r) {
+ $self->{ofh}->write($buf); # may call $http->close
+ # let other clients get some work done, too
+ return if $http->{sock}; # !closed
+
+ # else: fall through to close below...
+ } elsif (!defined $r && $! == EAGAIN) {
+ return; # EPOLLIN means we'll be notified
+ }
+
+ # Done! Error handling will happen in $self->{ofh}->close
+ # called by end_obj->event_step handler
+ delete $http->{forward};
+ $self->close; # queues end_obj->event_step to be called
+ } # else { # we may've been requeued but closed by $http