user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 0/6] ds: less is more
@ 2019-06-03  1:52  7% Eric Wong
  2019-06-03  1:52  5% ` [PATCH 3/6] ds: drop set_writer_func support Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2019-06-03  1:52 UTC (permalink / raw)
  To: meta

What's better than Free Software? Freedom FROM software!

Eric Wong (6):
  ds: drop more unused subs
  ds: add a note about planned future changes
  ds: drop set_writer_func support
  ds: drop checks for invalid descriptors
  ds: drop unused EVENT: label in epoll code path
  ds: drop write_set_watch field

 lib/PublicInbox/DS.pm        | 83 +++++-------------------------------
 lib/PublicInbox/EvCleanup.pm |  2 +-
 2 files changed, 12 insertions(+), 73 deletions(-)

-- 
EW

^ permalink raw reply	[relevance 7%]

* [PATCH 3/6] ds: drop set_writer_func support
  2019-06-03  1:52  7% [PATCH 0/6] ds: less is more Eric Wong
@ 2019-06-03  1:52  5% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2019-06-03  1:52 UTC (permalink / raw)
  To: meta

This is not used by perlbal for OpenSSL support, either;
and it does not appear to be the right layer for doing
write translations anyways (IO::Socket::SSL uses `tie').
---
 lib/PublicInbox/DS.pm | 21 ++-------------------
 1 file changed, 2 insertions(+), 19 deletions(-)

diff --git a/lib/PublicInbox/DS.pm b/lib/PublicInbox/DS.pm
index 3b0cbe6..b2c4b44 100644
--- a/lib/PublicInbox/DS.pm
+++ b/lib/PublicInbox/DS.pm
@@ -33,7 +33,6 @@ use fields ('sock',              # underlying socket
             '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.)
-            'writer_func',       # subref which does writing.  must return bytes written (or undef) and set $! on errors
             );
 
 use Errno  qw(EINPROGRESS EWOULDBLOCK EISCONN ENOTSOCK
@@ -629,18 +628,6 @@ sub sock {
     return $self->{sock};
 }
 
-=head2 C<< $obj->set_writer_func( CODEREF ) >>
-
-Sets a function to use instead of C<syswrite()> when writing data to the socket.
-
-=cut
-sub set_writer_func {
-   my PublicInbox::DS $self = shift;
-   my $wtr = shift;
-   Carp::croak("Not a subref") unless !defined $wtr || UNIVERSAL::isa($wtr, "CODE");
-   $self->{writer_func} = $wtr;
-}
-
 =head2 C<< $obj->write( $data ) >>
 
 Write the specified data to the underlying handle.  I<data> may be scalar,
@@ -710,12 +697,8 @@ sub write {
         }
 
         my $to_write = $len - $self->{write_buf_offset};
-        my $written;
-        if (my $wtr = $self->{writer_func}) {
-            $written = $wtr->($bref, $to_write, $self->{write_buf_offset});
-        } else {
-            $written = syswrite($self->{sock}, $$bref, $to_write, $self->{write_buf_offset});
-        }
+        my $written = syswrite($self->{sock}, $$bref, $to_write,
+                               $self->{write_buf_offset});
 
         if (! defined $written) {
             if ($! == EPIPE) {
-- 
EW


^ permalink raw reply related	[relevance 5%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2019-06-03  1:52  7% [PATCH 0/6] ds: less is more Eric Wong
2019-06-03  1:52  5% ` [PATCH 3/6] ds: drop set_writer_func support Eric Wong

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).