[PATCH 1/6] ds: next_tick: shorten object lifetimes

2023-10-31 Thread Eric Wong
Drop reference counts ASAP in case it saves us some memory sooner rather than later. This ought to give us more predictable resource use and ensure OnDestroy callbacks fire sooner. There's no need to use `local' to clobber the arrayref anymore, either. AFAIK, this doesn't fix any known bug, but

[PATCH 2/6] ds: do not defer close

2023-10-31 Thread Eric Wong
We can map all integer FDs to Perl objects once ->ep_wait returns, so there's no need to play tricks elsewhere to ensure FDs can be mapped to objects within the same event loop iteration. --- lib/PublicInbox/DS.pm | 67 ++- 1 file changed, 22 insertions(+),

[PATCH 5/6] pop3: use SSL_shutdown(3ssl) if appropriate

2023-10-31 Thread Eric Wong
This allows us support SSL session caching + reuse in the future. --- lib/PublicInbox/POP3.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/PublicInbox/POP3.pm b/lib/PublicInbox/POP3.pm index 6d24b17c..06772069 100644 --- a/lib/PublicInbox/POP3.pm +++

[PATCH 4/6] watch: simplify DirIdle object cleanup

2023-10-31 Thread Eric Wong
There's no need to waste time nor reach into DS internals to map FDs to Perl objects, here. LEI.pm has never had to deal with integer FDs for DirIdle, either. --- lib/PublicInbox/Watch.pm | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/PublicInbox/Watch.pm

[PATCH 6/6] ds: make ->close behave like CORE::close

2023-10-31 Thread Eric Wong
Matching existing Perl IO semantics seems like a good idea to reduce confusion in the future. We'll also fix some outdated comments and update indentation to match the rest of our code base since we're far detached from Danga::Socket at this point. --- lib/PublicInbox/CidxComm.pm | 2 +-

[PATCH 0/6] ds: object lifetime shortening

2023-10-31 Thread Eric Wong
1 and 2 do the bulk of the work 3 and 4 are things I noticed when working on 2 5 is a fix while preparing for 6 6 is something I've wanted to do for a long time. Anyways, the code reductions always make me happy. Eric Wong (6): ds: next_tick: shorten object lifetimes ds: do not defer close

[PATCH 3/6] ds: move maxevents further down the stack

2023-10-31 Thread Eric Wong
The epoll implementation is the only one which respects the limit (kevent would, but IO::KQueue does not). In any case, I'm not a fan of the maxevents=1000 historical default since it leads to fairness problems with shared non-blocking listeners across multiple daemon workers. ---

[PATCH] xap_helper.pm: quiet undefined die at shutdown

2023-10-31 Thread Eric Wong
Another attempt at doing what commit 35de8fdcbf290e25 (xap_helper.pm: quiet undefined warnings at shutdown, 2023-10-23) tried to do. It turns out perl croaks (not warn/carp) when it sees an undefined file handle, here. --- lib/PublicInbox/XapHelper.pm | 8 +--- 1 file changed, 5