Chromium Code Reviews| 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 one used by the host. |
|
Lambros
2012/04/17 19:01:19
s/one/ones
or
s/the one/those
alexeypa (please no reviews)
2012/04/17 19:20:32
Done.
| |
| 735 if os.WEXITSTATUS(status) == 100: | 735 # See remoting/host/constants.h. |
| 736 if os.WEXITSTATUS(status) == 1: | |
|
Lambros
2012/04/17 19:01:19
Please don't use exit code number 1. The problem
alexeypa (please no reviews)
2012/04/17 19:20:32
Done.
| |
| 737 logging.info("Host configuration is invalid - exiting.") | |
| 738 elif os.WEXITSTATUS(status) == 2: | |
| 736 logging.info("Host ID has been deleted - exiting.") | 739 logging.info("Host ID has been deleted - exiting.") |
| 737 # Host config is no longer valid. Delete it, so the next time this | 740 elif os.WEXITSTATUS(status) == 3: |
| 738 # script is run, a new Host ID will be created and registered. | 741 logging.info("OAuth credentials are invalid - exiting.") |
| 742 | |
| 743 # The host config is no longer valid if either of these codes is returned. | |
| 744 # Delete it, so the next time this script is run, a new configuration | |
| 745 # will be created and registered. | |
| 746 if os.WEXITSTATUS(status) == 1 or | |
| 747 os.WEXITSTATUS(status) == 2 or | |
| 748 os.WEXITSTATUS(status) == 3: | |
|
Lambros
2012/04/17 19:01:19
In case 3, should remove auth.config_file rather t
alexeypa (please no reviews)
2012/04/17 19:20:32
Done.
| |
| 739 os.remove(host.config_file) | 749 os.remove(host.config_file) |
| 740 return 0 | 750 return 0 |
| 741 | 751 |
| 742 | |
| 743 if __name__ == "__main__": | 752 if __name__ == "__main__": |
| 744 logging.basicConfig(level=logging.DEBUG) | 753 logging.basicConfig(level=logging.DEBUG) |
| 745 sys.exit(main()) | 754 sys.exit(main()) |
| OLD | NEW |