Chromium Code Reviews| 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..1e39dab475a940f7154018e699def36b7e94731f 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 (previous_invalid_token_ != auth_token) { |
| + auth_token_.assign(auth_token); |
| + previous_invalid_token_ = std::string(); |
| + return true; |
| + } |
| + return false; |
| + } |
| + |
| + void reset_auth_token() { |
|
tim (not reviewing)
2011/08/04 00:24:40
lets call this InvalidateAndClearAuthToken() (or
lipalani1
2011/08/04 01:14:33
Done.
|
| + // Copy over the token to previous invalid token. |
| + base::AutoLock lock(auth_token_mutex_); |
| + if (!auth_token_.empty()) { |
| + previous_invalid_token_.assign(auth_token_); |
|
tim (not reviewing)
2011/08/04 00:24:40
With the method change above, lets tweak this slig
lipalani1
2011/08/04 01:14:33
Done.
|
| + 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. |
|
tim (not reviewing)
2011/08/04 00:24:40
rename the var as suggested, and comment could be
lipalani1
2011/08/04 01:14:33
Done.
|
| + std::string previous_invalid_token_; |
| + |
| base::Lock error_count_mutex_; // Protects error_count_ |
| int error_count_; // Tracks the number of connection errors. |