# HG changeset patch # User Michael Albinus # Date 1190867853 0 # Node ID 437d3bb0213906d420953ce037366053ed529188 # Parent 89bab9e0761d1378647dd5270139fdabeb95028f * net/tramp.el (tramp-maybe-open-connection): Make test for alive connection more robust. diff -r 89bab9e0761d -r 437d3bb02139 lisp/ChangeLog --- a/lisp/ChangeLog Wed Sep 26 15:59:13 2007 +0000 +++ b/lisp/ChangeLog Thu Sep 27 04:37:33 2007 +0000 @@ -1,3 +1,8 @@ +2007-09-27 Michael Albinus + + * net/tramp.el (tramp-maybe-open-connection): Make test for alive + connection more robust. + 2007-09-26 Juanma Barranquero * emacs-lisp/eldoc.el (eldoc-function-argstring-format): diff -r 89bab9e0761d -r 437d3bb02139 lisp/net/tramp.el --- a/lisp/net/tramp.el Wed Sep 26 15:59:13 2007 +0000 +++ b/lisp/net/tramp.el Thu Sep 27 04:37:33 2007 +0000 @@ -2422,7 +2422,7 @@ res-size ;; 8. File modes, as a string of ten letters or dashes as in ls -l. res-filemodes - ;; 9. t iff file's gid would change if file were deleted and + ;; 9. t if file's gid would change if file were deleted and ;; recreated. Will be set in `tramp-convert-file-attributes' t ;; 10. inode number. @@ -5688,9 +5688,7 @@ (tramp-send-command-internal vec "set +o vi +o emacs") (tramp-message vec 5 "Setting shell prompt") ;; Douglas Gray Stephens says that we must - ;; use "\n" here, not tramp-rsh-end-of-line. We also manually frob - ;; the last time we sent a command, to avoid `tramp-send-command' to - ;; send "echo are you awake". + ;; use "\n" here, not tramp-rsh-end-of-line. (tramp-send-command vec (format "PROMPT_COMMAND=''; PS1='%s%s%s'; PS2=''; PS3=''" @@ -6044,16 +6042,23 @@ ;; tries to send some data to the remote end. So that's why we ;; try to send a command from time to time, then look again ;; whether the process is really alive. - (when (and (> (tramp-time-diff - (current-time) - (tramp-get-connection-property p "last-cmd-time" '(0 0 0))) - 60) - p (processp p) (memq (process-status p) '(run open))) - (tramp-send-command vec "echo are you awake" t t) - (unless (and (memq (process-status p) '(run open)) - (tramp-wait-for-output p 10)) - (delete-process p) - (setq p nil))) + (condition-case nil + (when (and (> (tramp-time-diff + (current-time) + (tramp-get-connection-property + p "last-cmd-time" '(0 0 0))) + 60) + p (processp p) (memq (process-status p) '(run open))) + (tramp-send-command vec "echo are you awake" t t) + (unless (and (memq (process-status p) '(run open)) + (tramp-wait-for-output p 10)) + ;; The error will be catched locally. + (tramp-error vec 'file-error "Awake did fail"))) + (file-error + (tramp-flush-connection-property vec nil) + (tramp-flush-connection-property p nil) + (delete-process p) + (setq p nil))) ;; New connection must be opened. (unless (and p (processp p) (memq (process-status p) '(run open))) @@ -6571,7 +6576,7 @@ (string-to-number (match-string 2 host))))) (defun tramp-tramp-file-p (name) - "Return t iff NAME is a tramp file." + "Return t if NAME is a tramp file." (save-match-data (string-match tramp-file-name-regexp name)))