From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id C0A561F97E for ; Mon, 3 Jun 2019 01:52:07 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 3/6] ds: drop set_writer_func support Date: Mon, 3 Jun 2019 01:52:03 +0000 Message-Id: <20190603015206.7871-4-e@80x24.org> In-Reply-To: <20190603015206.7871-1-e@80x24.org> References: <20190603015206.7871-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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 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 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