summaryrefslogtreecommitdiff
path: root/lisp/net
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2012-12-22 14:44:06 +0100
committerMichael Albinus <michael.albinus@gmx.de>2012-12-22 14:44:06 +0100
commitcdb075396213de91d318dbb6739d1885453a910c (patch)
tree09f2c74aa3b4e5c7bd2dd26bed804cec3edbb66e /lisp/net
parentb2faf49cd91a9270a5532d1be7b1b6f438c56fcc (diff)
downloademacs-cdb075396213de91d318dbb6739d1885453a910c.tar.gz
emacs-cdb075396213de91d318dbb6739d1885453a910c.tar.bz2
emacs-cdb075396213de91d318dbb6739d1885453a910c.zip
* net/tramp-adb.el (tramp-adb-maybe-open-connection): Check
properties of remote device. Restart connection, if there is a change.
Diffstat (limited to 'lisp/net')
-rw-r--r--lisp/net/tramp-adb.el26
1 files changed, 25 insertions, 1 deletions
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index 261c65ffdae..b500b1bba61 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -982,7 +982,31 @@ connection if a previous connection has died for some reason."
(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