emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r111295: * net/tramp-adb.el (tramp-ad


From: Michael Albinus
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111295: * net/tramp-adb.el (tramp-adb-maybe-open-connection): Check
Date: Sat, 22 Dec 2012 14:44:06 +0100
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111295
committer: Michael Albinus <address@hidden>
branch nick: trunk
timestamp: Sat 2012-12-22 14:44:06 +0100
message:
  * net/tramp-adb.el (tramp-adb-maybe-open-connection): Check
  properties of remote device.  Restart connection, if there is a
  change.
modified:
  lisp/ChangeLog
  lisp/net/tramp-adb.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-12-21 19:32:43 +0000
+++ b/lisp/ChangeLog    2012-12-22 13:44:06 +0000
@@ -1,3 +1,9 @@
+2012-12-22  Michael Albinus  <address@hidden>
+
+       * net/tramp-adb.el (tramp-adb-maybe-open-connection): Check
+       properties of remote device.  Restart connection, if there is a
+       change.
+
 2012-12-21  Chong Yidong  <address@hidden>
 
        * sort.el (sort-subr): Doc fix (Bug#13056).

=== modified file 'lisp/net/tramp-adb.el'
--- a/lisp/net/tramp-adb.el     2012-12-17 14:38:07 +0000
+++ b/lisp/net/tramp-adb.el     2012-12-22 13:44:06 +0000
@@ -982,7 +982,31 @@
            (tramp-adb-wait-for-output p)
            (unless (eq 'run (process-status p))
              (tramp-error  vec 'file-error "Terminated!"))
-           (set-process-query-on-exit-flag p nil)))))))
+           (set-process-query-on-exit-flag p nil)
+
+           ;; Check whether the properties have been changed.  If
+           ;; yes, this is a strong indication that we must expire all
+           ;; connection properties.  We start again.
+           (tramp-message vec 5 "Checking system information")
+           (tramp-adb-send-command
+            vec "echo \\\"`getprop ro.product.model` `getprop 
ro.product.version` `getprop ro.build.version.release`\\\"")
+           (let ((old-getprop
+                  (tramp-get-connection-property vec "getprop" nil))
+                 (new-getprop
+                  (tramp-set-connection-property
+                   vec "getprop"
+                   (with-current-buffer (tramp-get-connection-buffer vec)
+                     ;; Read the expression.
+                     (goto-char (point-min))
+                     (read (current-buffer))))))
+             (when (and (stringp old-getprop)
+                        (not (string-equal old-getprop new-getprop)))
+               (tramp-cleanup vec)
+               (tramp-message
+                vec 3
+                "Connection reset, because remote host changed from `%s' to 
`%s'"
+                old-getprop new-getprop)
+               (tramp-adb-maybe-open-connection vec)))))))))
 
 (provide 'tramp-adb)
 ;;; tramp-adb.el ends here


reply via email to

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