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

Unified Diff: chrome/browser/sync/engine/net/server_connection_manager.h

Issue 7563017: Dont retry sync in case of auth errors. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Upload before commit. Created 9 years, 5 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
« no previous file with comments | « no previous file | chrome/browser/sync/engine/net/server_connection_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/engine/net/server_connection_manager.h
diff --git a/chrome/browser/sync/engine/net/server_connection_manager.h b/chrome/browser/sync/engine/net/server_connection_manager.h
index 68bf8c3233e041d9c355ba3c0c16393ee6e84c3a..8bdf72d5007e0cdb85756d6ba6daf43d0cbbc3bb 100644
--- a/chrome/browser/sync/engine/net/server_connection_manager.h
+++ b/chrome/browser/sync/engine/net/server_connection_manager.h
@@ -277,10 +277,25 @@ class ServerConnectionManager {
client_id_.assign(client_id);
}
- void set_auth_token(const std::string& auth_token) {
+ // Returns true if the auth token is succesfully set and false otherwise.
+ bool set_auth_token(const std::string& auth_token) {
// TODO(chron): Consider adding a message loop check here.
base::AutoLock lock(auth_token_mutex_);
- auth_token_.assign(auth_token);
+ if (previously_invalidated_token != auth_token) {
+ auth_token_.assign(auth_token);
+ previously_invalidated_token = std::string();
+ return true;
+ }
+ return false;
+ }
+
+ void InvalidateAndClearAuthToken() {
+ // Copy over the token to previous invalid token.
+ base::AutoLock lock(auth_token_mutex_);
+ if (!auth_token_.empty()) {
+ previously_invalidated_token.assign(auth_token_);
+ auth_token_ = std::string();
+ }
}
const std::string auth_token() const {
@@ -338,6 +353,9 @@ class ServerConnectionManager {
// The auth token to use in authenticated requests. Set by the AuthWatcher.
std::string auth_token_;
+ // The previous auth token that is invalid now.
+ std::string previously_invalidated_token;
+
base::Lock error_count_mutex_; // Protects error_count_
int error_count_; // Tracks the number of connection errors.
« no previous file with comments | « no previous file | chrome/browser/sync/engine/net/server_connection_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698