diff options
author | Eric Wong <e@80x24.org> | 2019-06-15 17:38:42 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-06-15 17:38:42 +0000 |
commit | 3b508de80a200e9a32adbdc437434339187dde88 (patch) | |
tree | 04047182cf27ef92f7ec22c1dad0724fcb8b0ba3 /lib/PublicInbox/HTTP.pm | |
parent | 2cc052a06358ee293574d2d8aaa8c38c1a1026d7 (diff) | |
parent | b1fca235b174d4e3df674fd301e7bfba222a9e97 (diff) | |
download | public-inbox-3b508de80a200e9a32adbdc437434339187dde88.tar.gz |
* origin/ds: ds: stop caring about event flags set by epoll/poll/kqueue ds: do not distinguish between POLLHUP and POLLERR ds: remove read method, here, too nntp: use sysread to append to existing buffer ds: remove steal_socket method ds: remove {fd} field ds: reduce Errno imports and drop ->close reason ds: cleanup Errno imports and favor constant comparisons ds: simplify write buffer accounting
Diffstat (limited to 'lib/PublicInbox/HTTP.pm')
-rw-r--r-- | lib/PublicInbox/HTTP.pm | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/lib/PublicInbox/HTTP.pm b/lib/PublicInbox/HTTP.pm index 977614b4..4fbc34ee 100644 --- a/lib/PublicInbox/HTTP.pm +++ b/lib/PublicInbox/HTTP.pm @@ -260,7 +260,7 @@ sub getline_cb ($$$) { $write->($buf); # may close in PublicInbox::DS::write unless ($self->{closed}) { my $next = $self->{pull}; - if ($self->{write_buf_size}) { + if (scalar @{$self->{wbuf}}) { $self->write($next); } else { PublicInbox::EvCleanup::asap($next); @@ -315,7 +315,7 @@ use constant MSG_MORE => ($^O eq 'linux') ? 0x8000 : 0; sub more ($$) { my $self = $_[0]; return if $self->{closed}; - if (MSG_MORE && !$self->{write_buf_size}) { + if (MSG_MORE && !scalar(@{$self->{wbuf}})) { my $n = send($self->{sock}, $_[1], MSG_MORE); if (defined $n) { my $nlen = length($_[1]) - $n; @@ -466,11 +466,6 @@ sub quit { $self->close; } -# callbacks for PublicInbox::DS - -sub event_hup { $_[0]->close } -sub event_err { $_[0]->close } - sub close { my $self = shift; my $forward = $self->{forward}; @@ -487,7 +482,7 @@ sub close { # for graceful shutdown in PublicInbox::Daemon: sub busy () { my ($self) = @_; - ($self->{rbuf} ne '' || $self->{env} || $self->{write_buf_size}); + ($self->{rbuf} ne '' || $self->{env} || scalar(@{$self->{wbuf}})); } 1; |