about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-06-02 03:39:37 +0000
committerEric Wong <e@80x24.org>2019-06-02 05:23:22 +0000
commitb36456a92e15436bef97247b6ef7d8e5c72ebbe4 (patch)
treed277af944af0a1ad191d6b0486fef2996146c15d
parent1b0d40108f0b2791f4fdf8e602558e5f1a9da4a2 (diff)
downloadpublic-inbox-b36456a92e15436bef97247b6ef7d8e5c72ebbe4.tar.gz
We never enable write watches ourselves for HTTP and NNTP,
and only enable the write watch with EvCleanup because it's
an "always on" watch.
-rw-r--r--lib/PublicInbox/DS.pm14
1 files changed, 1 insertions, 13 deletions
diff --git a/lib/PublicInbox/DS.pm b/lib/PublicInbox/DS.pm
index 78210ddc..6b04e768 100644
--- a/lib/PublicInbox/DS.pm
+++ b/lib/PublicInbox/DS.pm
@@ -30,7 +30,6 @@ use fields ('sock',              # underlying socket
             'write_buf',         # arrayref of scalars, scalarrefs, or coderefs to write
             'write_buf_offset',  # offset into first array of write_buf to start writing at
             'write_buf_size',    # total length of data in all write_buf items
-            'write_set_watch',   # bool: true if we internally set watch_write rather than by a subclass
             'closed',            # bool: socket is closed
             'event_watch',       # bitmask of events the client is interested in (POLLIN,OUT,etc.)
             );
@@ -690,7 +689,6 @@ sub write {
                     push @{$self->{write_buf}}, $bref;
                     $self->{write_buf_size} += $len;
                 }
-                $self->{write_set_watch} = 1 unless $self->{event_watch} & POLLOUT;
                 $self->watch_write(1);
                 return 0;
             } elsif ($! == ECONNRESET) {
@@ -717,11 +715,7 @@ sub write {
             DebugLevel >= 2 && $self->debugmsg("Wrote ALL %d bytes to %d (nq=%d)",
                                                $written, $self->{fd}, $need_queue);
             $self->{write_buf_offset} = 0;
-
-            if ($self->{write_set_watch}) {
-                $self->watch_write(0);
-                $self->{write_set_watch} = 0;
-            }
+            $self->watch_write(0);
 
             # this was our only write, so we can return immediately
             # since we avoided incrementing the buffer size or
@@ -739,7 +733,6 @@ sub write {
 
 sub on_incomplete_write {
     my PublicInbox::DS $self = shift;
-    $self->{write_set_watch} = 1 unless $self->{event_watch} & POLLOUT;
     $self->watch_write(1);
 }
 
@@ -858,11 +851,6 @@ sub watch_write {
     $event &= ~POLLOUT if ! $val;
     $event |=  POLLOUT if   $val;
 
-    if ($val && caller ne __PACKAGE__) {
-        # A subclass registered interest, it's now responsible for this.
-        $self->{write_set_watch} = 0;
-    }
-
     # If it changed, set it
     if ($event != $self->{event_watch}) {
         if ($HaveKQueue) {