diff options
author | Eric Wong <e@80x24.org> | 2022-08-01 21:24:43 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2022-08-02 19:20:11 +0000 |
commit | c38111d6f3877cf31d28b0a0339d063df0fa58f6 (patch) | |
tree | 8bf1d2c22d96a9bc3ca9c20b9c85eab46802c5be /lib/PublicInbox/NNTPD.pm | |
parent | a55a38db0276a8ce1a09392573af6e1305cbaba9 (diff) | |
download | public-inbox-c38111d6f3877cf31d28b0a0339d063df0fa58f6.tar.gz |
This allows memory savings by allowing multiple, completely unrelated-PSGI apps to run within the same process as IMAP, NNTP, and POP3.
Diffstat (limited to 'lib/PublicInbox/NNTPD.pm')
-rw-r--r-- | lib/PublicInbox/NNTPD.pm | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/lib/PublicInbox/NNTPD.pm b/lib/PublicInbox/NNTPD.pm index f31d4381..9e232ef6 100644 --- a/lib/PublicInbox/NNTPD.pm +++ b/lib/PublicInbox/NNTPD.pm @@ -13,21 +13,10 @@ use PublicInbox::NNTP; sub new { my ($class) = @_; - my $pi_cfg = PublicInbox::Config->new; - my $name = $pi_cfg->{'publicinbox.nntpserver'}; - if (!defined($name) or $name eq '') { - $name = hostname; - } elsif (ref($name) eq 'ARRAY') { - $name = $name->[0]; - } - bless { - groups => {}, err => \*STDERR, out => \*STDOUT, - pi_cfg => $pi_cfg, - servername => $name, - greet => \"201 $name ready - post via email\r\n", + # pi_cfg => $pi_cfg, # accept_tls => { SSL_server => 1, ..., SSL_reuse_ctx => ... } # idler => PublicInbox::InboxIdle }, $class; @@ -35,7 +24,17 @@ sub new { sub refresh_groups { my ($self, $sig) = @_; - my $pi_cfg = $sig ? PublicInbox::Config->new : $self->{pi_cfg}; + my $pi_cfg = PublicInbox::Config->new; + my $name = $pi_cfg->{'publicinbox.nntpserver'}; + if (!defined($name) or $name eq '') { + $name = hostname; + } elsif (ref($name) eq 'ARRAY') { + $name = $name->[0]; + } + if ($name ne ($self->{servername} // '')) { + $self->{servername} = $name; + $self->{greet} = \"201 $name ready - post via email\r\n"; + } my $groups = $pi_cfg->{-by_newsgroup}; # filled during each_inbox my $cache = eval { $pi_cfg->ALL->misc->nntpd_cache_load } // {}; $pi_cfg->each_inbox(sub { |