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

Unified Diff: remoting/host/remoting_me2me_host.cc

Issue 10831184: Fix Me2Me host to properly reload config when it changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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
Index: remoting/host/remoting_me2me_host.cc
diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc
index 3f90b65ddcef0c03d0de8bc2864c0f21974aa3ec..8fcc1161a7702224dd47a28af0bbb68fda958e73 100644
--- a/remoting/host/remoting_me2me_host.cc
+++ b/remoting/host/remoting_me2me_host.cc
@@ -133,7 +133,6 @@ class HostProcess
}
void ConfigUpdated() {
- // The timer should be set and cleaned up on the same thread.
DCHECK(message_loop_.message_loop_proxy()->BelongsToCurrentThread());
// Call ConfigUpdatedDelayed after a short delay, so that this object won't
@@ -145,7 +144,10 @@ class HostProcess
}
void ConfigUpdatedDelayed() {
- if (LoadConfig()) {
+ DCHECK(message_loop_.message_loop_proxy()->BelongsToCurrentThread());
+
+ if (config_.Reload() && LoadConfig()) {
simonmorris 2012/08/07 00:43:35 I think it's more natural to include the call to R
Sergey Ulanov 2012/08/07 00:57:03 Done. Also changed CompositeHostConfig::AddConfigP
+ // PostTask to create new authenticator factory in case PIN has changed.
context_->network_task_runner()->PostTask(
FROM_HERE,
base::Bind(&HostProcess::CreateAuthenticatorFactory,
@@ -197,6 +199,7 @@ class HostProcess
}
void CreateAuthenticatorFactory() {
+ DCHECK(context_->network_task_runner()->BelongsToCurrentThread());
scoped_ptr<protocol::AuthenticatorFactory> factory(
new protocol::Me2MeHostAuthenticatorFactory(
key_pair_.GenerateCertificate(),
@@ -251,6 +254,12 @@ class HostProcess
// Read host config, returning true if successful.
bool LoadConfig() {
+ DCHECK(message_loop_.message_loop_proxy()->BelongsToCurrentThread());
+
+ // TODO(sergeyu): There is a potential race condition: this function is
+ // called on the main thread while the class members it mutates are used on
+ // the network thread. Fix it. http://crbug.com/140986 .
+
if (!config_.GetString(kHostIdConfigPath, &host_id_)) {
LOG(ERROR) << "host_id is not defined in the config.";
return false;
« remoting/host/composite_host_config.h ('K') | « remoting/host/composite_host_config.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698