+ my $forward = $self->{forward};
+
+ # limit our own running time for fairness with other
+ # clients and to avoid buffering too much:
+ my $buf = eval {
+ local $/ = \8192;
+ $forward->getline;
+ } if $forward;
+
+ if (defined $buf) {
+ # may close in PublicInbox::DS::write
+ if ($self->{alive} == 2) {
+ chunked_write($self, $buf);
+ } else {
+ identity_write($self, $buf);
+ }
+
+ if ($self->{sock}) {
+ # autovivify wbuf
+ my $new_size = push(@{$self->{wbuf}}, \&getline_pull);
+
+ # wbuf may be populated by {chunked,identity}_write()
+ # above, no need to rearm if so:
+ $self->requeue if $new_size == 1;
+ return; # likely
+ }
+ } elsif ($@) {
+ err($self, "response ->getline error: $@");
+ $self->close;
+ }
+ # avoid recursion
+ if (delete $self->{forward}) {
+ eval { $forward->close };
+ if ($@) {
+ err($self, "response ->close error: $@");
+ $self->close; # idempotent
+ }
+ }
+ response_done($self, delete $self->{alive});
+}