From 740d274818d7af9c50c8609a05860817e6aa9680 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 24 Jun 2019 02:52:02 +0000 Subject: ds: get rid of {closed} field Merely checking the presence of the {sock} field is enough, and having multiple sources of truth increases confusion and the likelyhood of bugs. --- lib/PublicInbox/HTTP.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/PublicInbox/HTTP.pm') diff --git a/lib/PublicInbox/HTTP.pm b/lib/PublicInbox/HTTP.pm index 45bf23ec..dff59286 100644 --- a/lib/PublicInbox/HTTP.pm +++ b/lib/PublicInbox/HTTP.pm @@ -33,7 +33,7 @@ sub process_pipelineq () { $pipet = undef; $pipelineq = []; foreach (@$q) { - next if $_->{closed}; + next unless $_->{sock}; rbuf_process($_); } } @@ -70,7 +70,7 @@ sub event_step { # called by PublicInbox::DS my $wbuf = $self->{wbuf}; if (@$wbuf) { $self->write(undef); - return if $self->{closed} || scalar(@$wbuf); + return if !$self->{sock} || scalar(@$wbuf); } # only read more requests if we've drained the write buffer, # otherwise we can be buffering infinitely w/o backpressure @@ -266,7 +266,7 @@ sub getline_cb ($$$) { my $buf = eval { $forward->getline }; if (defined $buf) { $write->($buf); # may close in PublicInbox::DS::write - unless ($self->{closed}) { + if ($self->{sock}) { my $next = $self->{pull}; if (scalar @{$self->{wbuf}}) { $self->write($next); @@ -322,7 +322,7 @@ sub response_write { use constant MSG_MORE => ($^O eq 'linux') ? 0x8000 : 0; sub more ($$) { my $self = $_[0]; - return if $self->{closed}; + return unless $self->{sock}; if (MSG_MORE && !scalar(@{$self->{wbuf}})) { my $n = send($self->{sock}, $_[1], MSG_MORE); if (defined $n) { -- cgit v1.2.3-24-ge0c7