diff options
author | sergeyu <sergeyu@chromium.org> | 2016-02-24 18:39:39 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-25 02:42:04 +0000 |
commit | 7e16a84c48423858ca62cd26e46f7dd00c3f96eb (patch) | |
tree | 31a10f27e2a5a894c61cd76f19f7623638330e54 /remoting/host | |
parent | 301ccdb3cfef6992faa0d4ac95f4d748116eecec (diff) | |
download | chromium_src-7e16a84c48423858ca62cd26e46f7dd00c3f96eb.zip chromium_src-7e16a84c48423858ca62cd26e46f7dd00c3f96eb.tar.gz chromium_src-7e16a84c48423858ca62cd26e46f7dd00c3f96eb.tar.bz2 |
Improve handling of invalid command line in Me2Me host.
Previously the host was DCHECK'ing in remoting::ExitCodeToString()
when started with invalid command line. This was happening because
kHostExitCodeStrings didn't contain all possible error codes.
Also the host was trying to report offline reason, but it makes no sense
to report offline reason in this case.
Review URL: https://codereview.chromium.org/1735523003
Cr-Commit-Position: refs/heads/master@{#377472}
Diffstat (limited to 'remoting/host')
-rw-r--r-- | remoting/host/desktop_process_main.cc | 2 | ||||
-rw-r--r-- | remoting/host/host_exit_codes.cc | 1 | ||||
-rw-r--r-- | remoting/host/host_exit_codes.h | 2 | ||||
-rw-r--r-- | remoting/host/host_main.cc | 4 | ||||
-rw-r--r-- | remoting/host/remoting_me2me_host.cc | 4 | ||||
-rw-r--r-- | remoting/host/win/host_service.cc | 2 |
6 files changed, 7 insertions, 8 deletions
diff --git a/remoting/host/desktop_process_main.cc b/remoting/host/desktop_process_main.cc index 794128c..7116580 100644 --- a/remoting/host/desktop_process_main.cc +++ b/remoting/host/desktop_process_main.cc @@ -32,7 +32,7 @@ int DesktopProcessMain() { command_line->GetSwitchValueASCII(kDaemonPipeSwitchName); if (channel_name.empty()) - return kUsageExitCode; + return kInvalidCommandLineExitCode; base::MessageLoopForUI message_loop; base::RunLoop run_loop; diff --git a/remoting/host/host_exit_codes.cc b/remoting/host/host_exit_codes.cc index 4e206a5..5d1a13c 100644 --- a/remoting/host/host_exit_codes.cc +++ b/remoting/host/host_exit_codes.cc @@ -13,6 +13,7 @@ namespace remoting { const NameMapElement<HostExitCodes> kHostExitCodeStrings[] = { { kSuccessExitCode, "SUCCESS_EXIT" }, { kInitializationFailed, "INITIALIZATION_FAILED" }, + { kInvalidCommandLineExitCode, "INVALID_COMMAND_LINE" }, { kInvalidHostConfigurationExitCode, "INVALID_HOST_CONFIGURATION" }, { kInvalidHostIdExitCode, "INVALID_HOST_ID" }, { kInvalidOauthCredentialsExitCode, "INVALID_OAUTH_CREDENTIALS" }, diff --git a/remoting/host/host_exit_codes.h b/remoting/host/host_exit_codes.h index 81f19ed..becefae 100644 --- a/remoting/host/host_exit_codes.h +++ b/remoting/host/host_exit_codes.h @@ -17,7 +17,7 @@ enum HostExitCodes { kSuccessExitCode = 0, kReservedForX11ExitCode = 1, kInitializationFailed = 2, - kUsageExitCode = 3, + kInvalidCommandLineExitCode = 3, // Error codes that do indicate a permanent error condition. kInvalidHostConfigurationExitCode = 100, diff --git a/remoting/host/host_main.cc b/remoting/host/host_main.cc index 961f36c..6501fb74 100644 --- a/remoting/host/host_main.cc +++ b/remoting/host/host_main.cc @@ -202,7 +202,7 @@ int HostMain(int argc, char** argv) { fprintf(stderr, "Unknown process type '%s' specified.", process_type.c_str()); Usage(command_line->GetProgram()); - return kUsageExitCode; + return kInvalidCommandLineExitCode; } // Required to find the ICU data file, used by some file_util routines. @@ -212,7 +212,7 @@ int HostMain(int argc, char** argv) { // Invoke the entry point. int exit_code = main_routine(); - if (exit_code == kUsageExitCode) { + if (exit_code == kInvalidCommandLineExitCode) { Usage(command_line->GetProgram()); } diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc index ebea38f..180c15b 100644 --- a/remoting/host/remoting_me2me_host.cc +++ b/remoting/host/remoting_me2me_host.cc @@ -864,9 +864,7 @@ void HostProcess::StartOnUiThread() { if (!InitWithCommandLine(base::CommandLine::ForCurrentProcess())) { // Shutdown the host if the command line is invalid. - context_->network_task_runner()->PostTask( - FROM_HERE, base::Bind(&HostProcess::ShutdownHost, this, - kUsageExitCode)); + ShutdownOnUiThread(); return; } diff --git a/remoting/host/win/host_service.cc b/remoting/host/win/host_service.cc index 950219d..37fb9c6 100644 --- a/remoting/host/win/host_service.cc +++ b/remoting/host/win/host_service.cc @@ -434,7 +434,7 @@ VOID WINAPI HostService::ServiceMain(DWORD argc, WCHAR* argv[]) { int DaemonProcessMain() { HostService* service = HostService::GetInstance(); if (!service->InitWithCommandLine(base::CommandLine::ForCurrentProcess())) { - return kUsageExitCode; + return kInvalidCommandLineExitCode; } return service->Run(); |