user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 6/6] ds: drop write_set_watch field
Date: Mon,  3 Jun 2019 01:52:06 +0000	[thread overview]
Message-ID: <20190603015206.7871-7-e@80x24.org> (raw)
In-Reply-To: <20190603015206.7871-1-e@80x24.org>

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.
---
 lib/PublicInbox/DS.pm | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/lib/PublicInbox/DS.pm b/lib/PublicInbox/DS.pm
index 78210dd..6b04e76 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) {
-- 
EW


  parent reply	other threads:[~2019-06-03  1:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-03  1:52 [PATCH 0/6] ds: less is more Eric Wong
2019-06-03  1:52 ` [PATCH 1/6] ds: drop more unused subs Eric Wong
2019-06-03  1:52 ` [PATCH 2/6] ds: add a note about planned future changes Eric Wong
2019-06-03  1:52 ` [PATCH 3/6] ds: drop set_writer_func support Eric Wong
2019-06-03  1:52 ` [PATCH 4/6] ds: drop checks for invalid descriptors Eric Wong
2019-06-03  1:52 ` [PATCH 5/6] ds: drop unused EVENT: label in epoll code path Eric Wong
2019-06-03  1:52 ` Eric Wong [this message]
2019-06-03  9:03 ` [PATCH 7/6] ds: remove PLCMap and per-socket PostLoopCallback Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190603015206.7871-7-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).