- $fh->write($$bref);
- unless ($http->{closed}) { # PublicInbox::DS sets this
- if ($http->{write_buf_size}) {
- $self->watch_read(0);
- $http->write(restart_read_cb($self));
+ $fh->write($$bref); # may call $http->close
+
+ if ($http->{sock}) { # !closed
+ if ($http->{wbuf}) {
+ # HTTP client could not keep up, so
+ # stop reading and buffering.
+ $self->watch(0);
+
+ # Tell the HTTP socket to restart us
+ # when HTTP client is done draining
+ # $http->{wbuf}:
+ $http->enqueue_restart_pass;