diff options
author | pavely@chromium.org <pavely@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-05 04:14:53 +0000 |
---|---|---|
committer | pavely@chromium.org <pavely@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-05 04:14:53 +0000 |
commit | 7e31df8fe2753863416731f29b37c01441afaee4 (patch) | |
tree | 3035a33d0950793f47f3ef543edd0fb44fbb2249 /sync/engine/net/server_connection_manager.cc | |
parent | 8f7d908a8a0c0a91edc0dd3c93fa823a801f5439 (diff) | |
download | chromium_src-7e31df8fe2753863416731f29b37c01441afaee4.zip chromium_src-7e31df8fe2753863416731f29b37c01441afaee4.tar.gz chromium_src-7e31df8fe2753863416731f29b37c01441afaee4.tar.bz2 |
Remove connection_code_ from SyncSchedulerImpl.
Removed connection_code_ from SyncSchedulerImpl since it essentially
mirrors ServerConnectionManager::server_status_.
One behavior changed as result of this change: Previously if
SyncSchedulerImpl::OnConnectionStatusChange was called when
connection_code_ is CONNECTION_UNAVAILABLE it would reset
connection_code_ to SERVER_CONNECTION_OK and consecutive calls to
SyncSchedulerImpl::OnConnectionStatusChange would not post canary job
until current one is finished and updates server_status_. With this
change it is no longer true.
Also moved notification about auth error from
SyncManagerImpl::OnInvalidatorStateChange to common code path. It no
longer makes assumption about error code that connection manager is
going to set in OnInvalidationCredentialsRejected.
Also removed few references to get_time.
BUG=177535
Review URL: https://chromiumcodereview.appspot.com/12390070
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@186092 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/engine/net/server_connection_manager.cc')
-rw-r--r-- | sync/engine/net/server_connection_manager.cc | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/sync/engine/net/server_connection_manager.cc b/sync/engine/net/server_connection_manager.cc index c2bb951..7a27229 100644 --- a/sync/engine/net/server_connection_manager.cc +++ b/sync/engine/net/server_connection_manager.cc @@ -28,11 +28,6 @@ using std::vector; static const char kSyncServerSyncPath[] = "/command/"; -// At the /time/ path of the sync server, we expect to find a very simple -// time of day service that we can use to synchronize the local clock with -// server time. -static const char kSyncServerGetTimePath[] = "/time"; - HttpResponse::HttpResponse() : response_code(kUnsetResponseCode), content_length(kUnsetContentLength), @@ -175,11 +170,7 @@ ScopedServerStatusWatcher::ScopedServerStatusWatcher( } ScopedServerStatusWatcher::~ScopedServerStatusWatcher() { - if (conn_mgr_->server_status_ != response_->server_status) { - conn_mgr_->server_status_ = response_->server_status; - conn_mgr_->NotifyStatusChanged(); - return; - } + conn_mgr_->SetServerStatus(response_->server_status); } ServerConnectionManager::ServerConnectionManager( @@ -190,7 +181,6 @@ ServerConnectionManager::ServerConnectionManager( sync_server_port_(port), use_ssl_(use_ssl), proto_sync_path_(kSyncServerSyncPath), - get_time_path_(kSyncServerGetTimePath), server_status_(HttpResponse::NONE), terminated_(false), active_connection_(NULL) { @@ -224,7 +214,7 @@ void ServerConnectionManager::OnConnectionDestroyed(Connection* connection) { void ServerConnectionManager::OnInvalidationCredentialsRejected() { InvalidateAndClearAuthToken(); - server_status_ = HttpResponse::SYNC_AUTH_ERROR; + SetServerStatus(HttpResponse::SYNC_AUTH_ERROR); } void ServerConnectionManager::InvalidateAndClearAuthToken() { @@ -236,6 +226,14 @@ void ServerConnectionManager::InvalidateAndClearAuthToken() { } } +void ServerConnectionManager::SetServerStatus( + HttpResponse::ServerConnectionCode server_status) { + if (server_status_ == server_status) + return; + server_status_ = server_status; + NotifyStatusChanged(); +} + void ServerConnectionManager::NotifyStatusChanged() { DCHECK(thread_checker_.CalledOnValidThread()); FOR_EACH_OBSERVER(ServerConnectionEventListener, listeners_, |