Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1315)

Unified Diff: remoting/host/remoting_me2me_host.cc

Issue 1061903002: Disable chromoting service on permanent errors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« remoting/host/host_exit_codes.h ('K') | « remoting/host/ipc_host_event_logger.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/remoting_me2me_host.cc
diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc
index 96fe46e40165ff34fb2a592013ed555494c8eaff..fc0503e159f7d7583d04a4be81ae06b0b6584bfa 100644
--- a/remoting/host/remoting_me2me_host.cc
+++ b/remoting/host/remoting_me2me_host.cc
@@ -149,12 +149,6 @@ const int kShutdownTimeoutSeconds = 15;
// before continuing normal process shutdown.
const int kHostOfflineReasonTimeoutSeconds = 10;
-// Host offline reasons not associated with shutting down the host process
-// and therefore not expressible through HostExitCodes enum.
-const char kHostOfflineReasonPolicyReadError[] = "POLICY_READ_ERROR";
-const char kHostOfflineReasonPolicyChangeRequiresRestart[] =
- "POLICY_CHANGE_REQUIRES_RESTART";
-
} // namespace
namespace remoting {
@@ -283,11 +277,11 @@ class HostProcess : public ConfigWatcher::Delegate,
void OnUnknownHostIdError() override;
void OnAuthFailed() override;
- void RestartHost(const std::string& host_offline_reason);
+ void RestartHost(HostExitCodes exit_code);
void ShutdownHost(HostExitCodes exit_code);
// Helper methods doing the work needed by RestartHost and ShutdownHost.
- void GoOffline(const std::string& host_offline_reason);
+ void GoOffline(HostExitCodes exit_code);
void OnHostOfflineReasonAck(bool success);
#if defined(OS_WIN)
@@ -1014,7 +1008,7 @@ void HostProcess::OnPolicyUpdate(scoped_ptr<base::DictionaryValue> policies) {
StartHostIfReady();
} else if (state_ == HOST_STARTED) {
if (restart_required)
- RestartHost(kHostOfflineReasonPolicyChangeRequiresRestart);
+ RestartHost(kPolicyChangeRequiresRestart);
}
}
@@ -1042,7 +1036,7 @@ void HostProcess::ReportPolicyErrorAndRestartHost() {
policy_state_ = POLICY_ERROR_REPORTED;
LOG(INFO) << "Restarting the host due to policy errors.";
- RestartHost(kHostOfflineReasonPolicyReadError);
+ RestartHost(kPolicyReadError);
}
void HostProcess::ApplyHostDomainPolicy() {
@@ -1413,12 +1407,11 @@ void HostProcess::OnAuthFailed() {
ShutdownHost(kInvalidOauthCredentialsExitCode);
}
-void HostProcess::RestartHost(const std::string& host_offline_reason) {
+void HostProcess::RestartHost(HostExitCodes exit_code) {
DCHECK(context_->network_task_runner()->BelongsToCurrentThread());
- DCHECK(!host_offline_reason.empty());
SetState(HOST_GOING_OFFLINE_TO_RESTART);
- GoOffline(host_offline_reason);
+ GoOffline(exit_code);
}
void HostProcess::ShutdownHost(HostExitCodes exit_code) {
@@ -1430,7 +1423,7 @@ void HostProcess::ShutdownHost(HostExitCodes exit_code) {
case HOST_STARTING:
case HOST_STARTED:
SetState(HOST_GOING_OFFLINE_TO_STOP);
- GoOffline(ExitCodeToString(exit_code));
+ GoOffline(exit_code);
break;
case HOST_GOING_OFFLINE_TO_RESTART:
@@ -1444,13 +1437,14 @@ void HostProcess::ShutdownHost(HostExitCodes exit_code) {
}
}
-void HostProcess::GoOffline(const std::string& host_offline_reason) {
+void HostProcess::GoOffline(HostExitCodes exit_code) {
DCHECK(context_->network_task_runner()->BelongsToCurrentThread());
- DCHECK(!host_offline_reason.empty());
DCHECK((state_ == HOST_GOING_OFFLINE_TO_STOP) ||
(state_ == HOST_GOING_OFFLINE_TO_RESTART));
+ std::string host_offline_reason = ExitCodeToString(exit_code);
// Shut down everything except the HostSignalingManager.
+ host_->SetExitCode(exit_code);
host_.reset();
host_event_logger_.reset();
host_status_logger_.reset();
« remoting/host/host_exit_codes.h ('K') | « remoting/host/ipc_host_event_logger.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698