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

Side by Side Diff: components/sync/engine_impl/net/server_connection_manager.cc

Issue 2106743002: WIP: Local sync only... (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix after rebase. Created 4 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/sync/engine_impl/net/server_connection_manager.h" 5 #include "components/sync/engine_impl/net/server_connection_manager.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <ostream> 10 #include <ostream>
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 active_connection_ = NULL; 201 active_connection_ = NULL;
202 } 202 }
203 203
204 bool ServerConnectionManager::SetAuthToken(const std::string& auth_token) { 204 bool ServerConnectionManager::SetAuthToken(const std::string& auth_token) {
205 DCHECK(thread_checker_.CalledOnValidThread()); 205 DCHECK(thread_checker_.CalledOnValidThread());
206 if (previously_invalidated_token != auth_token) { 206 if (previously_invalidated_token != auth_token) {
207 auth_token_.assign(auth_token); 207 auth_token_.assign(auth_token);
208 previously_invalidated_token = std::string(); 208 previously_invalidated_token = std::string();
209 return true; 209 return true;
210 } 210 }
211 LOG(ERROR) << "@@@ THIS IS SHIT...or";
212 return true;
211 213
212 // This could happen in case like server outage/bug. E.g. token returned by 214 // This could happen in case like server outage/bug. E.g. token returned by
213 // first request is considered invalid by sync server and because 215 // first request is considered invalid by sync server and because
214 // of token server's caching policy, etc, same token is returned on second 216 // of token server's caching policy, etc, same token is returned on second
215 // request. Need to notify sync frontend again to request new token, 217 // request. Need to notify sync frontend again to request new token,
216 // otherwise backend will stay in SYNC_AUTH_ERROR state while frontend thinks 218 // otherwise backend will stay in SYNC_AUTH_ERROR state while frontend thinks
217 // everything is fine and takes no actions. 219 // everything is fine and takes no actions.
218 SetServerStatus(HttpResponse::SYNC_AUTH_ERROR); 220 //SetServerStatus(HttpResponse::SYNC_AUTH_ERROR);
219 return false; 221 //return false;
220 } 222 }
221 223
222 void ServerConnectionManager::InvalidateAndClearAuthToken() { 224 void ServerConnectionManager::InvalidateAndClearAuthToken() {
223 DCHECK(thread_checker_.CalledOnValidThread()); 225 DCHECK(thread_checker_.CalledOnValidThread());
224 // Copy over the token to previous invalid token. 226 // Copy over the token to previous invalid token.
225 if (!auth_token_.empty()) { 227 if (!auth_token_.empty()) {
226 previously_invalidated_token.assign(auth_token_); 228 previously_invalidated_token.assign(auth_token_);
227 auth_token_ = std::string(); 229 auth_token_ = std::string();
228 } 230 }
229 } 231 }
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 332
331 std::ostream& operator<<(std::ostream& s, const struct HttpResponse& hr) { 333 std::ostream& operator<<(std::ostream& s, const struct HttpResponse& hr) {
332 s << " Response Code (bogus on error): " << hr.response_code; 334 s << " Response Code (bogus on error): " << hr.response_code;
333 s << " Content-Length (bogus on error): " << hr.content_length; 335 s << " Content-Length (bogus on error): " << hr.content_length;
334 s << " Server Status: " 336 s << " Server Status: "
335 << HttpResponse::GetServerConnectionCodeString(hr.server_status); 337 << HttpResponse::GetServerConnectionCodeString(hr.server_status);
336 return s; 338 return s;
337 } 339 }
338 340
339 } // namespace syncer 341 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698