aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2007-09-27 04:37:33 +0000
committerMichael Albinus2007-09-27 04:37:33 +0000
commit1437876ce35b2adb9463dab2aa81a954471b2639 (patch)
tree44aa49aeb948ce4abb6ef2e34ea0fe0acb24025f
parentc4e36c26f634e0f9603b6d65eeebabe97b21378e (diff)
downloademacs-1437876ce35b2adb9463dab2aa81a954471b2639.tar.gz
emacs-1437876ce35b2adb9463dab2aa81a954471b2639.zip
* net/tramp.el (tramp-maybe-open-connection): Make test for alive
connection more robust.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/net/tramp.el35
2 files changed, 25 insertions, 15 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b09604eb0bb..839be79a88b 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12007-09-27 Michael Albinus <michael.albinus@gmx.de>
2
3 * net/tramp.el (tramp-maybe-open-connection): Make test for alive
4 connection more robust.
5
12007-09-26 Juanma Barranquero <lekktu@gmail.com> 62007-09-26 Juanma Barranquero <lekktu@gmail.com>
2 7
3 * emacs-lisp/eldoc.el (eldoc-function-argstring-format): 8 * emacs-lisp/eldoc.el (eldoc-function-argstring-format):
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index db6739a9e9f..3d1d6786fb4 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -2422,7 +2422,7 @@ target of the symlink differ."
2422 res-size 2422 res-size
2423 ;; 8. File modes, as a string of ten letters or dashes as in ls -l. 2423 ;; 8. File modes, as a string of ten letters or dashes as in ls -l.
2424 res-filemodes 2424 res-filemodes
2425 ;; 9. t iff file's gid would change if file were deleted and 2425 ;; 9. t if file's gid would change if file were deleted and
2426 ;; recreated. Will be set in `tramp-convert-file-attributes' 2426 ;; recreated. Will be set in `tramp-convert-file-attributes'
2427 t 2427 t
2428 ;; 10. inode number. 2428 ;; 10. inode number.
@@ -5688,9 +5688,7 @@ process to set up. VEC specifies the connection."
5688 (tramp-send-command-internal vec "set +o vi +o emacs") 5688 (tramp-send-command-internal vec "set +o vi +o emacs")
5689 (tramp-message vec 5 "Setting shell prompt") 5689 (tramp-message vec 5 "Setting shell prompt")
5690 ;; Douglas Gray Stephens <DGrayStephens@slb.com> says that we must 5690 ;; Douglas Gray Stephens <DGrayStephens@slb.com> says that we must
5691 ;; use "\n" here, not tramp-rsh-end-of-line. We also manually frob 5691 ;; use "\n" here, not tramp-rsh-end-of-line.
5692 ;; the last time we sent a command, to avoid `tramp-send-command' to
5693 ;; send "echo are you awake".
5694 (tramp-send-command 5692 (tramp-send-command
5695 vec 5693 vec
5696 (format "PROMPT_COMMAND=''; PS1='%s%s%s'; PS2=''; PS3=''" 5694 (format "PROMPT_COMMAND=''; PS1='%s%s%s'; PS2=''; PS3=''"
@@ -6044,16 +6042,23 @@ connection if a previous connection has died for some reason."
6044 ;; tries to send some data to the remote end. So that's why we 6042 ;; tries to send some data to the remote end. So that's why we
6045 ;; try to send a command from time to time, then look again 6043 ;; try to send a command from time to time, then look again
6046 ;; whether the process is really alive. 6044 ;; whether the process is really alive.
6047 (when (and (> (tramp-time-diff 6045 (condition-case nil
6048 (current-time) 6046 (when (and (> (tramp-time-diff
6049 (tramp-get-connection-property p "last-cmd-time" '(0 0 0))) 6047 (current-time)
6050 60) 6048 (tramp-get-connection-property
6051 p (processp p) (memq (process-status p) '(run open))) 6049 p "last-cmd-time" '(0 0 0)))
6052 (tramp-send-command vec "echo are you awake" t t) 6050 60)
6053 (unless (and (memq (process-status p) '(run open)) 6051 p (processp p) (memq (process-status p) '(run open)))
6054 (tramp-wait-for-output p 10)) 6052 (tramp-send-command vec "echo are you awake" t t)
6055 (delete-process p) 6053 (unless (and (memq (process-status p) '(run open))
6056 (setq p nil))) 6054 (tramp-wait-for-output p 10))
6055 ;; The error will be catched locally.
6056 (tramp-error vec 'file-error "Awake did fail")))
6057 (file-error
6058 (tramp-flush-connection-property vec nil)
6059 (tramp-flush-connection-property p nil)
6060 (delete-process p)
6061 (setq p nil)))
6057 6062
6058 ;; New connection must be opened. 6063 ;; New connection must be opened.
6059 (unless (and p (processp p) (memq (process-status p) '(run open))) 6064 (unless (and p (processp p) (memq (process-status p) '(run open)))
@@ -6571,7 +6576,7 @@ Not actually used. Use `(format \"%o\" i)' instead?"
6571 (string-to-number (match-string 2 host))))) 6576 (string-to-number (match-string 2 host)))))
6572 6577
6573(defun tramp-tramp-file-p (name) 6578(defun tramp-tramp-file-p (name)
6574 "Return t iff NAME is a tramp file." 6579 "Return t if NAME is a tramp file."
6575 (save-match-data 6580 (save-match-data
6576 (string-match tramp-file-name-regexp name))) 6581 (string-match tramp-file-name-regexp name)))
6577 6582