X-Git-Url: https://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Fproto-stream.el;h=c1acf4b9b155535f678c88fb599ca352f60666bb;hb=70233025bc5d0f151495408d9efb46bf5ece26c9;hp=6f4b019f3c8f19029b9b8f37fd47b802029c6c2e;hpb=fbf92a9ff447ce137478957f264feec56f6e0b44;p=gnus diff --git a/lisp/proto-stream.el b/lisp/proto-stream.el index 6f4b019f3..c1acf4b9b 100644 --- a/lisp/proto-stream.el +++ b/lisp/proto-stream.el @@ -148,7 +148,16 @@ command to switch on STARTTLS otherwise." (proto-stream-command stream starttls-command eoc) (if (fboundp 'open-gnutls-stream) (gnutls-negotiate stream nil) - (starttls-negotiate stream)) + (unless (starttls-negotiate stream) + (delete-process stream) + (setq stream nil))) + (when (or (null stream) + (not (memq (process-status stream) + '(open run)))) + ;; It didn't successfully negotiate STARTTLS, so we reopen + ;; the connection. + (setq stream (open-network-stream name buffer host service)) + (proto-stream-get-response stream start eoc)) ;; Re-get the capabilities, since they may have changed ;; after switching to TLS. (list stream greeting