From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Re: [RFC] automatically retrying network connections Date: Sun, 22 Jul 2018 12:59:30 +0200 Message-ID: References: <87sh4dfz8r.fsf@gmail.com> <87fu0bft72.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1532257093 21382 195.159.176.226 (22 Jul 2018 10:58:13 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 22 Jul 2018 10:58:13 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jul 22 12:58:08 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fhC3z-0005Rd-In for ged-emacs-devel@m.gmane.org; Sun, 22 Jul 2018 12:58:08 +0200 Original-Received: from localhost ([::1]:55527 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhC66-0006fX-7s for ged-emacs-devel@m.gmane.org; Sun, 22 Jul 2018 07:00:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57271) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhC5T-0006fQ-8D for emacs-devel@gnu.org; Sun, 22 Jul 2018 06:59:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fhC5Q-0007dI-6q for emacs-devel@gnu.org; Sun, 22 Jul 2018 06:59:39 -0400 Original-Received: from hermes.netfonds.no ([80.91.224.195]:57787) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fhC5P-0007cM-V5 for emacs-devel@gnu.org; Sun, 22 Jul 2018 06:59:36 -0400 Original-Received: from cm-84.212.221.165.getinternet.no ([84.212.221.165] helo=stories) by hermes.netfonds.no with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1fhC5K-0006NR-Hs for emacs-devel@gnu.org; Sun, 22 Jul 2018 12:59:32 +0200 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAD1BMVEWbiYEVDAopGhZSQDoK BAPzsxKiAAACeklEQVQ4jT2UgZX0KgiFmdDAohYQYQpQ2AbM2H9N7+Ls/5xzJolfuCJcQ+5qREwD P/UYFEGDxyBXNTxhmljjgByDLoAgw0vMiIgRg4nyvWDVALwZosGY+Q7ceMoFXnCLC0t8x/0FGmYF /+HjL6bmotAK6tptRKZyRjnAddD0blD8B+QGKC6Du3VkpfEH+g+Rmha7CqYzDftLCddpXTSKXuDq 9zeCkemMLiXELhE1TykkzSK937oEYBZoldw5gO+95af0wssKd4SicCgWtd2a1GbCZY4uXexbRtp7 iZT2mVeNl2AA8Ddirw4UrxFyAJcTsRZCVpFx8UQeIFoPeARS6+k34hXzqr2gykGad3i+h7n1ipKo QhgAVWhSEKGy9CTkffwPpP/w0dFcOTkZHtoTUS+BNiD068lqZ8LQfsty1LKcEt8MALLEoLekcEEA ugyj7XX2jhI/W+p4CTqoN10oydk6clhbdLD8ZI+4kwAULeoQRPtIsnnYCr1yHm544xqONmS7URh6 YeOWbmgt0z/+9AQRU6NDpD/T0syEdA/wsLbrHHPLkwYxPtVDxMvX/lSAvhI4ZZWVFDWT/SloPtoK 6+QRQQgpl7bWx4Y3bQVWZzgnNEHfIh8k1EozhVSkS5xugJbLXq1sWXn2Mszh0tzaHoR+7J2rUx4d RnaylrWbubcDvm5n6vDt9l0hhapVRB5yUXve7fGq2AfGkyl9pX4/e3906H3A+gcCQHaFE7WmFCQp Pw9jkn20oRcwUA2UC0fSHFGdbIX/ZrPeNTPW8zFxAH8PBlilxJgwWMrDe0rzN+ZEW3EEo8EnhkJe HXKuM9u+TfMI5iHEJlDy/wDjJ5D7WyPvDgAAAABJRU5ErkJggg== In-Reply-To: <87fu0bft72.fsf@gmail.com> (Robert Pluim's message of "Sun, 22 Jul 2018 12:41:53 +0200") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 80.91.224.195 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:227657 Archived-At: Robert Pluim writes: > There=CA=BCs this little-known news server called news.gmane.org that has= a > 10 second timeout :-) Reconnecting immediately works, so it=CA=BCs not a > big deal. Never heard about it. :-) > So you'd put this in nsm-verify-connection, without a user option? I > don=CA=BCt think nsm currently has access to all the connection setup > parameters, which is why I put the logic in open-network-stream. > Proof-of-concept patch attached (it should really do more checking of > what nsm returned). I was thinking that the `nsm-verify-connection' call sites would reconnect that function said "go ahead" and the process was dead. Which is basically if it returns non-nil, I guess, so the return value of that function doesn't have to change. :retry-on-fail is too general -- it's not really useful to reestablish the connection if the server closes the connection for other reasons than an NSM-related timeout. >> We could also reverse the logic a bit and have the NSM always shut down >> the connection before prompting. This will make network connections >> (that prompt an NSM warning) be somewhat slower, but it shouldn't be a >> big deal. > > That seems wasteful. In most cases the connection will complete OK, so > why add an extra connection setup for all cases? An NSM warning isn't the common case, and reestablishing the connection would be a minuscule extra delay. It would just be more... consistent? But little real-world impact. >> In any case, when reconnecting we have to consider whether this would >> trigger extra auth-source prompts, which would be annoying, but I have a >> feeling like these are mostly done later in the connection process >> usually, so it shouldn't be an issue. > > If you=CA=BCre thinking of authentication for SMTP sessions and the like, > they'd all arrive after completion of the TLS setup. I think so, too, but we should audit the call sites and ensure that nobody does stuff like (open-network-stream ... :starttls-function () (auth-source-search ...)) Seems unlikely, though. --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no