aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2020-07-18 19:59:19 +0200
committerLars Ingebrigtsen2020-07-18 19:59:19 +0200
commit77d35f28e5d8d45a00350bfc32d17bc4446e28dc (patch)
tree6f015fc1d3f67bb40695bd3f9d7083517798de8f
parentc45c1e8c4376cbbe68cec997a5ef686732377ca6 (diff)
downloademacs-77d35f28e5d8d45a00350bfc32d17bc4446e28dc.tar.gz
emacs-77d35f28e5d8d45a00350bfc32d17bc4446e28dc.zip
Don't have shr kill random buffers on network failures
* lisp/url/url-queue.el (url-queue-callback-function): Don't kill off random buffers on HTTP failures (bug#40976).
-rw-r--r--lisp/url/url-queue.el29
1 files changed, 18 insertions, 11 deletions
diff --git a/lisp/url/url-queue.el b/lisp/url/url-queue.el
index ff18cf1fe40..46cdff0f724 100644
--- a/lisp/url/url-queue.el
+++ b/lisp/url/url-queue.el
@@ -123,17 +123,24 @@ The variable `url-queue-timeout' sets a timeout."
123 (setq url-queue-progress-timer nil)))) 123 (setq url-queue-progress-timer nil))))
124 124
125(defun url-queue-callback-function (status job) 125(defun url-queue-callback-function (status job)
126 (setq url-queue (delq job url-queue)) 126 (let ((buffer (current-buffer)))
127 (when (and (eq (car status) :error) 127 (setq url-queue (delq job url-queue))
128 (eq (cadr (cadr status)) 'connection-failed)) 128 (when (and (eq (car status) :error)
129 ;; If we get a connection error, then flush all other jobs from 129 (eq (cadr (cadr status)) 'connection-failed))
130 ;; the host from the queue. This particularly makes sense if the 130 ;; If we get a connection error, then flush all other jobs from
131 ;; error really is a DNS resolver issue, which happens 131 ;; the host from the queue. This particularly makes sense if the
132 ;; synchronously and totally halts Emacs. 132 ;; error really is a DNS resolver issue, which happens
133 (url-queue-remove-jobs-from-host 133 ;; synchronously and totally halts Emacs.
134 (plist-get (nthcdr 3 (cadr status)) :host))) 134 (url-queue-remove-jobs-from-host
135 (url-queue-run-queue) 135 (plist-get (nthcdr 3 (cadr status)) :host)))
136 (apply (url-queue-callback job) (cons status (url-queue-cbargs job)))) 136 (url-queue-run-queue)
137 ;; Somehow something deep in the bowels in the URL library may
138 ;; have killed off the current buffer. So check that it's still
139 ;; alive before doing anything, and if not, just create a dummy
140 ;; buffer and do the callback anyway.
141 (unless (buffer-live-p buffer)
142 (set-buffer (generate-new-buffer " *temp*")))
143 (apply (url-queue-callback job) (cons status (url-queue-cbargs job)))))
137 144
138(defun url-queue-remove-jobs-from-host (host) 145(defun url-queue-remove-jobs-from-host (host)
139 (let ((jobs nil)) 146 (let ((jobs nil))