emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r107562: Bugfix for url-http-find-fre


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r107562: Bugfix for url-http-find-free-connection.
Date: Sun, 11 Mar 2012 17:43:01 +0800
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 107562
fixes bug(s): http://debbugs.gnu.org/10891
author: Devon Sean McCullough <address@hidden>
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Sun 2012-03-11 17:43:01 +0800
message:
  Bugfix for url-http-find-free-connection.
  
  * lisp/url/url-http.el (url-http-find-free-connection): Don't pass a nil
  argument to url-http-mark-connection-as-busy.
modified:
  lisp/url/ChangeLog
  lisp/url/url-http.el
=== modified file 'lisp/url/ChangeLog'
--- a/lisp/url/ChangeLog        2012-02-20 12:12:48 +0000
+++ b/lisp/url/ChangeLog        2012-03-11 09:43:01 +0000
@@ -1,3 +1,8 @@
+2012-03-11  Devon Sean McCullough  <address@hidden>
+
+       * url-http.el (url-http-find-free-connection): Don't pass a nil
+       argument to url-http-mark-connection-as-busy (bug#10891).
+
 2012-02-20  Lars Ingebrigtsen  <address@hidden>
 
        * url-queue.el (url-queue-kill-job): Delete the process sentinel

=== modified file 'lisp/url/url-http.el'
--- a/lisp/url/url-http.el      2012-02-10 17:30:39 +0000
+++ b/lisp/url/url-http.el      2012-03-11 09:43:01 +0000
@@ -153,38 +153,40 @@
 
 (defun url-http-find-free-connection (host port)
   (let ((conns (gethash (cons host port) url-http-open-connections))
-       (found nil))
-    (while (and conns (not found))
+       (connection nil))
+    (while (and conns (not connection))
       (if (not (memq (process-status (car conns)) '(run open connect)))
          (progn
            (url-http-debug "Cleaning up dead process: %s:%d %S"
                            host port (car conns))
            (url-http-idle-sentinel (car conns) nil))
-       (setq found (car conns))
-       (url-http-debug "Found existing connection: %s:%d %S" host port found))
+       (setq connection (car conns))
+       (url-http-debug "Found existing connection: %s:%d %S" host port 
connection))
       (pop conns))
-    (if found
+    (if connection
        (url-http-debug "Reusing existing connection: %s:%d" host port)
       (url-http-debug "Contacting host: %s:%d" host port))
     (url-lazy-message "Contacting host: %s:%d" host port)
-    (url-http-mark-connection-as-busy
-     host port
-     (or found
-         (let ((buf (generate-new-buffer " *url-http-temp*")))
-           ;; `url-open-stream' needs a buffer in which to do things
-           ;; like authentication.  But we use another buffer afterwards.
-           (unwind-protect
-               (let ((proc (url-open-stream host buf host port)))
-                ;; url-open-stream might return nil.
-                (when (processp proc)
-                  ;; Drop the temp buffer link before killing the buffer.
-                  (set-process-buffer proc nil))
-                 proc)
-            ;; If there was an error on connect, make sure we don't
-            ;; get queried.
-            (when (get-buffer-process buf)
-              (set-process-query-on-exit-flag (get-buffer-process buf) nil))
-             (kill-buffer buf)))))))
+
+    (unless connection
+      (let ((buf (generate-new-buffer " *url-http-temp*")))
+       ;; `url-open-stream' needs a buffer in which to do things
+       ;; like authentication.  But we use another buffer afterwards.
+       (unwind-protect
+           (let ((proc (url-open-stream host buf host port)))
+             ;; url-open-stream might return nil.
+             (when (processp proc)
+               ;; Drop the temp buffer link before killing the buffer.
+               (set-process-buffer proc nil)
+               (setq connection proc)))
+         ;; If there was an error on connect, make sure we don't
+         ;; get queried.
+         (when (get-buffer-process buf)
+           (set-process-query-on-exit-flag (get-buffer-process buf) nil))
+         (kill-buffer buf))))
+
+    (if connection
+       (url-http-mark-connection-as-busy host port connection))))
 
 ;; Building an HTTP request
 (defun url-http-user-agent-string ()


reply via email to

[Prev in Thread] Current Thread [Next in Thread]