user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 2/8] net_reader: set IMAPClient Keepalive flag late
  2021-09-09  5:24  7% [PATCH 0/8] net_reader: simplify + fix bugs Eric Wong
@ 2021-09-09  5:24  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2021-09-09  5:24 UTC (permalink / raw)
  To: meta

Since we always enable SO_KEEPALIVE unconditionally, having it
in {mic_arg} leads to unnecessary IPC overhead and memory use.
---
 lib/PublicInbox/NetReader.pm | 3 +--
 lib/PublicInbox/Watch.pm     | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/PublicInbox/NetReader.pm b/lib/PublicInbox/NetReader.pm
index b5d14f13..9faa362c 100644
--- a/lib/PublicInbox/NetReader.pm
+++ b/lib/PublicInbox/NetReader.pm
@@ -51,7 +51,7 @@ sub mic_new ($$$$) {
 		$socks{Socket} = IO::Socket::Socks->new(%opt) or die
 			"E: <$$uri> ".eval('$IO::Socket::Socks::SOCKS_ERROR');
 	}
-	PublicInbox::IMAPClient->new(%$mic_arg, %socks);
+	PublicInbox::IMAPClient->new(%$mic_arg, %socks, Keepalive => 1);
 }
 
 sub auth_anon_cb { '' }; # for Mail::IMAPClient::Authcallback
@@ -76,7 +76,6 @@ sub mic_for ($$$$) { # mic = Mail::IMAPClient
 		Port => $uri->port,
 		Server => $host,
 		Ssl => $uri->scheme eq 'imaps',
-		Keepalive => 1, # SO_KEEPALIVE
 		%$common, # may set Starttls, Compress, Debug ....
 	};
 	$mic_arg->{Ssl} = 1 if $uri->scheme eq 'imaps';
diff --git a/lib/PublicInbox/Watch.pm b/lib/PublicInbox/Watch.pm
index 482d35c4..7a35ee59 100644
--- a/lib/PublicInbox/Watch.pm
+++ b/lib/PublicInbox/Watch.pm
@@ -358,7 +358,7 @@ sub watch_imap_idle_1 ($$$) {
 	my $mic;
 	local $0 = $uri->mailbox." $sec";
 	until ($self->{quit}) {
-		$mic //= PublicInbox::IMAPClient->new(%$mic_arg);
+		$mic //= PublicInbox::IMAPClient->new(%$mic_arg,Keepalive => 1);
 		my $err;
 		if ($mic && $mic->IsConnected) {
 			local $self->{mics_cached}->{$sec} = $mic;

^ permalink raw reply related	[relevance 7%]

* [PATCH 0/8] net_reader: simplify + fix bugs
@ 2021-09-09  5:24  7% Eric Wong
  2021-09-09  5:24  7% ` [PATCH 2/8] net_reader: set IMAPClient Keepalive flag late Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2021-09-09  5:24 UTC (permalink / raw)
  To: meta

What started off as a series of cleanups leads to some minor bug
fixes for some uncommon corner-cases.  These changes will
hopefully simplify IPC for sharing auth with lei/store and
IMAP IDLE watchers.

Eric Wong (8):
  net_reader: do not set "SSL" fields for non-TLS
  net_reader: set IMAPClient Keepalive flag late
  net_reader: preserve memoized IMAPClient arg for SOCKS
  net_reader: nntp_opt => cfg_opt
  net_reader: imap_opt => cfg_opt
  net_reader: combine Net::NNTP and IMAPClient args
  net_reader: improve naming of common args
  net_reader: support Mail::IMAPClient Ignoresizeerrors

 lib/PublicInbox/NetReader.pm | 94 ++++++++++++++++++------------------
 lib/PublicInbox/Watch.pm     | 10 ++--
 2 files changed, 53 insertions(+), 51 deletions(-)

^ permalink raw reply	[relevance 7%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2021-09-09  5:24  7% [PATCH 0/8] net_reader: simplify + fix bugs Eric Wong
2021-09-09  5:24  7% ` [PATCH 2/8] net_reader: set IMAPClient Keepalive flag late Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).