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-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 6E83F1F9FD for ; Mon, 22 Feb 2021 11:22:59 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 01/10] lei_auth: rename {nrd} field to {net} for clarity Date: Mon, 22 Feb 2021 08:22:50 -0300 Message-Id: <20210222112259.32402-1-e@80x24.org> In-Reply-To: <20210222112155.32231-1-e@80x24.org> References: <20210222112155.32231-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: We're authing for both reads and writes, this makes it clear that we support both NetReader and NetWriter. --- lib/PublicInbox/LeiAuth.pm | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/PublicInbox/LeiAuth.pm b/lib/PublicInbox/LeiAuth.pm index bf0110ed..c70d8e8f 100644 --- a/lib/PublicInbox/LeiAuth.pm +++ b/lib/PublicInbox/LeiAuth.pm @@ -10,22 +10,22 @@ use parent qw(PublicInbox::IPC); use PublicInbox::PktOp qw(pkt_do); use PublicInbox::NetReader; -sub nrd_merge { - my ($lei, $nrd_new) = @_; +sub net_merge { + my ($lei, $net_new) = @_; if ($lei->{pkt_op_p}) { # from lei_convert worker - pkt_do($lei->{pkt_op_p}, 'nrd_merge', $nrd_new); + pkt_do($lei->{pkt_op_p}, 'net_merge', $net_new); } else { # single lei-daemon consumer my $self = $lei->{auth} or return; # client disconnected - my $nrd = $self->{nrd}; - %$nrd = (%$nrd, %$nrd_new); + my $net = $self->{net}; + %$net = (%$net, %$net_new); } } sub do_auth { # called via wq_io_do my ($self) = @_; - my ($lei, $nrd) = @$self{qw(lei nrd)}; - $nrd->imap_common_init($lei); - nrd_merge($lei, $nrd); # tell lei-daemon updated auth info + my ($lei, $net) = @$self{qw(lei net)}; + $net->imap_common_init($lei); + net_merge($lei, $net); # tell lei-daemon updated auth info } sub do_finish_auth { # dwaitpid callback @@ -44,7 +44,7 @@ sub auth_start { my ($self, $lei, $post_auth_cb, @args) = @_; $lei->_lei_cfg(1); # workers may need to read config my $op = $lei->workers_start($self, 'auth', 1, { - 'nrd_merge' => [ \&nrd_merge, $lei ], + 'net_merge' => [ \&net_merge, $lei ], '' => [ \&auth_eof, $lei, $post_auth_cb, @args ], }); $self->wq_io_do('do_auth', []); @@ -63,8 +63,8 @@ sub ipc_atfork_child { } sub new { - my ($cls, $nrd) = @_; # nrd may be NetReader or descendant (NetWriter) - bless { nrd => $nrd }, $cls; + my ($cls, $net) = @_; # net may be NetReader or descendant (NetWriter) + bless { net => $net }, $cls; } 1;