| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 # Virtual Me2Me implementation. This script runs and manages the processes | 6 # Virtual Me2Me implementation. This script runs and manages the processes |
| 7 # required for a Virtual Me2Me desktop, which are: X server, X desktop | 7 # required for a Virtual Me2Me desktop, which are: X server, X desktop |
| 8 # session, and Host process. | 8 # session, and Host process. |
| 9 # This script is intended to run continuously as a background daemon | 9 # This script is intended to run continuously as a background daemon |
| 10 # process, running under an ordinary (non-root) user account. | 10 # process, running under an ordinary (non-root) user account. |
| (...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 desktop.x_proc = None | 724 desktop.x_proc = None |
| 725 | 725 |
| 726 if desktop.session_proc is not None and pid == desktop.session_proc.pid: | 726 if desktop.session_proc is not None and pid == desktop.session_proc.pid: |
| 727 logging.info("Session process terminated") | 727 logging.info("Session process terminated") |
| 728 desktop.session_proc = None | 728 desktop.session_proc = None |
| 729 | 729 |
| 730 if desktop.host_proc is not None and pid == desktop.host_proc.pid: | 730 if desktop.host_proc is not None and pid == desktop.host_proc.pid: |
| 731 logging.info("Host process terminated") | 731 logging.info("Host process terminated") |
| 732 desktop.host_proc = None | 732 desktop.host_proc = None |
| 733 | 733 |
| 734 # The exit-code must match the one used in HeartbeatSender. | 734 # These exit-codes must match the ones used by the host. |
| 735 if os.WEXITSTATUS(status) == 100: | 735 # See remoting/host/constants.h. |
| 736 logging.info("Host ID has been deleted - exiting.") | 736 # Delete the host or auth configuration depending on the returned error |
| 737 # Host config is no longer valid. Delete it, so the next time this | 737 # code, so the next time this script is run, a new configuration |
| 738 # script is run, a new Host ID will be created and registered. | 738 # will be created and registered. |
| 739 if os.WEXITSTATUS(status) == 2: |
| 740 logging.info("Host configuration is invalid - exiting.") |
| 741 os.remove(auth.config_file) |
| 739 os.remove(host.config_file) | 742 os.remove(host.config_file) |
| 740 return 0 | 743 return 0 |
| 741 | 744 elif os.WEXITSTATUS(status) == 3: |
| 745 logging.info("Host ID has been deleted - exiting.") |
| 746 os.remove(host.config_file) |
| 747 return 0 |
| 748 elif os.WEXITSTATUS(status) == 4: |
| 749 logging.info("OAuth credentials are invalid - exiting.") |
| 750 os.remove(auth.config_file) |
| 751 return 0 |
| 742 | 752 |
| 743 if __name__ == "__main__": | 753 if __name__ == "__main__": |
| 744 logging.basicConfig(level=logging.DEBUG) | 754 logging.basicConfig(level=logging.DEBUG) |
| 745 sys.exit(main()) | 755 sys.exit(main()) |
| OLD | NEW |