[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC] automatically retrying network connections
From: |
Robert Pluim |
Subject: |
Re: [RFC] automatically retrying network connections |
Date: |
Sun, 22 Jul 2018 16:08:26 +0200 |
Lars Ingebrigtsen <address@hidden> 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))
- Re: [RFC] automatically retrying network connections, (continued)
Re: [RFC] automatically retrying network connections, Robert Pluim, 2018/07/22
Re: [RFC] automatically retrying network connections, Lars Ingebrigtsen, 2018/07/22
Re: [RFC] automatically retrying network connections, Andy Moreton, 2018/07/22
Re: [RFC] automatically retrying network connections, Noam Postavsky, 2018/07/22