From: Robert Pluim <rpluim@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: emacs-devel@gnu.org
Subject: Re: [RFC] automatically retrying network connections
Date: Sun, 22 Jul 2018 16:08:26 +0200 [thread overview]
Message-ID: <871sbv7485.fsf@gmail.com> (raw)
In-Reply-To: <m37elno7sd.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sun, 22 Jul 2018 12:59:30 +0200")
Lars Ingebrigtsen <larsi@gnus.org> writes:
> 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.
Is this the kind of change youʼre thinking of?
diff --git i/lisp/net/network-stream.el w/lisp/net/network-stream.el
index a0589e25a4..dbaf719f41 100644
--- i/lisp/net/network-stream.el
+++ w/lisp/net/network-stream.el
@@ -383,7 +383,7 @@ network-stream-get-response
(declare-function open-tls-stream "tls" (name buffer host port))
-(defun network-stream-open-tls (name buffer host service parameters)
+(defun network-stream-open-tls (name buffer host service parameters &optional retry)
(with-current-buffer buffer
(let* ((start (point-max))
(stream
@@ -398,10 +398,14 @@ network-stream-open-tls
;; Check certificate validity etc.
(when (and (gnutls-available-p) stream)
(setq stream (nsm-verify-connection stream host service)))
- (if (null stream)
- (list nil nil nil 'plain)
+ (cond ((null stream)
+ (list nil nil nil 'plain))
;; If we're using tls.el, we have to delete the output from
;; openssl/gnutls-cli.
+ ((and (not retry) (not (process-live-p)))
+ (message "Initial connect failed, retrying")
+ (network-stream-open-tls name buffer host service parameters t))
+ (t
(when (and (not (gnutls-available-p))
eoc)
(network-stream-get-response stream start eoc)
@@ -415,7 +419,7 @@ network-stream-open-tls
(list stream
(network-stream-get-response stream start eoc)
(network-stream-command stream capability-command eo-capa)
- 'tls)))))))
+ 'tls))))))))
(declare-function format-spec "format-spec" (format spec))
(declare-function format-spec-make "format-spec" (&rest pairs))
next prev parent reply other threads:[~2018-07-22 14:08 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-20 20:06 [RFC] automatically retrying network connections Robert Pluim
2018-07-21 15:21 ` Jimmy Yuen Ho Wong
2018-07-22 10:28 ` Lars Ingebrigtsen
2018-07-22 14:28 ` Jimmy Yuen Ho Wong
2018-07-22 16:44 ` Michael Albinus
2018-07-22 23:24 ` Jimmy Yuen Ho Wong
2018-07-22 11:18 ` Robert Pluim
2018-07-22 11:43 ` Lars Ingebrigtsen
2018-07-22 23:29 ` Jimmy Yuen Ho Wong
2018-07-23 7:41 ` Andreas Schwab
2018-07-22 10:24 ` Lars Ingebrigtsen
2018-07-22 10:41 ` Robert Pluim
2018-07-22 10:59 ` Lars Ingebrigtsen
2018-07-22 14:08 ` Robert Pluim [this message]
2018-07-22 14:29 ` Lars Ingebrigtsen
2018-07-22 13:32 ` Andy Moreton
2018-07-22 13:35 ` Lars Ingebrigtsen
2018-07-22 23:27 ` Jimmy Yuen Ho Wong
2018-07-23 8:23 ` Robert Pluim
2018-07-23 20:57 ` Jimmy Yuen Ho Wong
2018-07-22 13:37 ` Noam Postavsky
2018-07-22 13:41 ` Lars Ingebrigtsen
2018-07-22 23:26 ` Jimmy Yuen Ho Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871sbv7485.fsf@gmail.com \
--to=rpluim@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=larsi@gnus.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.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).