/[tramp]/tramp/lisp/tramp.el
ViewVC logotype

Diff of /tramp/lisp/tramp.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2.146 by kai, Sat Jul 27 15:26:42 2002 UTC revision 2.147 by kai, Sat Jul 27 16:24:47 2002 UTC
# Line 1251  This is used to map a mode number to a p Line 1251  This is used to map a mode number to a p
1251      'undecided-dos)      'undecided-dos)
1252    "Some Emacsen know the `dos' coding system, others need `undecided-dos'.")    "Some Emacsen know the `dos' coding system, others need `undecided-dos'.")
1253    
1254    (defvar tramp-last-cmd-time nil
1255      "Internal Tramp variable recording the time when the last cmd was sent.
1256    This variable is buffer-local in every buffer.")
1257    (make-variable-buffer-local 'tramp-last-cmd-time)
1258    
1259  ;; New handlers should be added here.  The following operations can be  ;; New handlers should be added here.  The following operations can be
1260  ;; handled using the normal primitives: file-name-as-directory,  ;; handled using the normal primitives: file-name-as-directory,
# Line 4460  Goes through the list `tramp-coding-comm Line 4464  Goes through the list `tramp-coding-comm
4464    "Maybe open a connection to HOST, logging in as USER, using METHOD.    "Maybe open a connection to HOST, logging in as USER, using METHOD.
4465  Does not do anything if a connection is already open, but re-opens the  Does not do anything if a connection is already open, but re-opens the
4466  connection if a previous connection has died for some reason."  connection if a previous connection has died for some reason."
4467    (let ((p (get-buffer-process (tramp-get-buffer multi-method method user host))))    (let ((p (get-buffer-process (tramp-get-buffer multi-method method user host)))
4468      (unless (and p          last-cmd-time)
4469                   (processp p)      ;; If too much time has passed since last command was sent, look
4470                   (memq (process-status p) '(run open)))      ;; whether process is still alive.  If it isn't, kill it.  When
4471        ;; using ssh, it can sometimes happen that the remote end has hung
4472        ;; up but the local ssh client doesn't recognize this until it
4473        ;; tries to send some data to the remote end.  So that's why we
4474        ;; try to send a command from time to time, then look again
4475        ;; whether the process is really alive.
4476        (save-excursion
4477          (set-buffer (tramp-get-buffer multi-method method user host))
4478          (when (> (tramp-time-diff tramp-last-cmd-time (current-time)) 60)
4479            (process-send-string p (concat "echo hello" tramp-rsh-end-of-line))
4480            (if (accept-process-output p 2)
4481                (erase-buffer)
4482              (delete-process p)
4483              (setq p nil))))
4484        (unless (and p (processp p) (memq (process-status p) '(run open)))
4485        (when (and p (processp p))        (when (and p (processp p))
4486          (delete-process p))          (delete-process p))
4487        (funcall (tramp-get-connection-function multi-method method)        (funcall (tramp-get-connection-function multi-method method)
# Line 4475  connection if a previous connection has Line 4493  connection if a previous connection has
4493  Erases temporary buffer before sending the command (unless NOERASE  Erases temporary buffer before sending the command (unless NOERASE
4494  is true)."  is true)."
4495    (tramp-maybe-open-connection multi-method method user host)    (tramp-maybe-open-connection multi-method method user host)
4496      (setq tramp-last-cmd-time (current-time))
4497    (when tramp-debug-buffer    (when tramp-debug-buffer
4498      (save-excursion      (save-excursion
4499        (set-buffer (tramp-get-debug-buffer multi-method method user host))        (set-buffer (tramp-get-debug-buffer multi-method method user host))

Legend:
Removed from v.2.146  
changed lines
  Added in v.2.147

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26