diff options
author | Eric Wong <e@80x24.org> | 2021-02-22 08:22:56 -0300 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-02-22 18:14:21 -0400 |
commit | fa5650d399f51a596e5c126b3ce65347409d4fe9 (patch) | |
tree | b96b5ccaaf4a41135948f753572b2fa408908278 /lib/PublicInbox/LeiAuth.pm | |
parent | eda916393e1d7c203225279df84ccf692953ab57 (diff) | |
download | public-inbox-fa5650d399f51a596e5c126b3ce65347409d4fe9.tar.gz |
We can rework the first lei2mail worker to authenticate, and then share auth info with the rest of the lei2mail workers. As with "lei import", this uses PktOp and lei-daemon to share updated credentials between the first an subsequent l2m workers.
Diffstat (limited to 'lib/PublicInbox/LeiAuth.pm')
-rw-r--r-- | lib/PublicInbox/LeiAuth.pm | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/lib/PublicInbox/LeiAuth.pm b/lib/PublicInbox/LeiAuth.pm index d329eadb..b4777114 100644 --- a/lib/PublicInbox/LeiAuth.pm +++ b/lib/PublicInbox/LeiAuth.pm @@ -20,13 +20,6 @@ sub net_merge { } } -sub do_auth { # called via wq_io_do - my ($self) = @_; - my ($lei, $net) = @$self{qw(lei net)}; - $net->imap_common_init($lei); - net_merge($lei, $net); # tell lei-daemon updated auth info -} - sub do_auth_atfork { # used by IPC WQ workers my ($self, $wq) = @_; return if $wq->{-wq_worker_nr} != 0; @@ -63,36 +56,6 @@ sub op_merge { # prepares PktOp->pair ops $ops->{net_merge_done1} = [ \&net_merge_done1, $wq ]; } -sub do_finish_auth { # dwaitpid callback - my ($arg, $pid) = @_; - my ($self, $lei, $post_auth_cb, @args) = @$arg; - $? ? $lei->dclose : $post_auth_cb->(@args); -} - -sub auth_eof { - my ($lei, $post_auth_cb, @args) = @_; - my $self = delete $lei->{auth} or return; - $self->wq_wait_old(\&do_finish_auth, $lei, $post_auth_cb, @args); -} - -sub auth_start { - my ($self, $lei, $post_auth_cb, @args) = @_; - my $op = $lei->workers_start($self, 'auth', 1, { - 'net_merge' => [ \&net_merge, $lei ], - '' => [ \&auth_eof, $lei, $post_auth_cb, @args ], - }); - $self->wq_io_do('do_auth', []); - $self->wq_close(1); - while ($op && $op->{sock}) { $op->event_step } -} - -sub ipc_atfork_child { - my ($self) = @_; - delete $self->{lei}->{auth}; # drop circular ref - $self->{lei}->lei_atfork_child; - $self->SUPER::ipc_atfork_child; -} - sub new { my ($cls, $net) = @_; # net may be NetReader or descendant (NetWriter) bless { net => $net }, $cls; |