| OLD | NEW | 
|---|
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/sync/engine/net/server_connection_manager.h" | 5 #include "chrome/browser/sync/engine/net/server_connection_manager.h" | 
| 6 | 6 | 
| 7 #include <errno.h> | 7 #include <errno.h> | 
| 8 | 8 | 
| 9 #include <ostream> | 9 #include <ostream> | 
| 10 #include <string> | 10 #include <string> | 
| 11 #include <vector> | 11 #include <vector> | 
| 12 | 12 | 
|  | 13 #include "build/build_config.h" | 
| 13 #include "chrome/browser/sync/engine/net/http_return.h" | 14 #include "chrome/browser/sync/engine/net/http_return.h" | 
| 14 #include "chrome/browser/sync/engine/net/url_translator.h" | 15 #include "chrome/browser/sync/engine/net/url_translator.h" | 
| 15 #include "chrome/browser/sync/engine/syncapi.h" | 16 #include "chrome/browser/sync/engine/syncapi.h" | 
| 16 #include "chrome/browser/sync/engine/syncer.h" | 17 #include "chrome/browser/sync/engine/syncer.h" | 
| 17 #include "chrome/browser/sync/engine/syncproto.h" | 18 #include "chrome/browser/sync/engine/syncproto.h" | 
| 18 #include "chrome/browser/sync/protocol/sync.pb.h" | 19 #include "chrome/browser/sync/protocol/sync.pb.h" | 
| 19 #include "chrome/browser/sync/syncable/directory_manager.h" | 20 #include "chrome/browser/sync/syncable/directory_manager.h" | 
| 20 #include "chrome/browser/sync/util/character_set_converters.h" | 21 #include "chrome/browser/sync/util/character_set_converters.h" | 
| 21 #include "chrome/browser/sync/util/event_sys-inl.h" | 22 #include "chrome/browser/sync/util/event_sys-inl.h" | 
| 22 | 23 | 
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 294   server_status_ = HttpResponse::NONE; | 295   server_status_ = HttpResponse::NONE; | 
| 295   NotifyStatusChanged(); | 296   NotifyStatusChanged(); | 
| 296 } | 297 } | 
| 297 | 298 | 
| 298 void ServerConnectionManager::ResetConnection() { | 299 void ServerConnectionManager::ResetConnection() { | 
| 299   base::subtle::NoBarrier_AtomicIncrement(&reset_count_, 1); | 300   base::subtle::NoBarrier_AtomicIncrement(&reset_count_, 1); | 
| 300   platform_->Reset(); | 301   platform_->Reset(); | 
| 301 } | 302 } | 
| 302 | 303 | 
| 303 bool ServerConnectionManager::IncrementErrorCount() { | 304 bool ServerConnectionManager::IncrementErrorCount() { | 
| 304 #ifdef OS_WINDOWS | 305 #ifdef OS_WIN | 
| 305   error_count_mutex_.Lock(); | 306   error_count_mutex_.Lock(); | 
| 306   error_count_++; | 307   error_count_++; | 
| 307 | 308 | 
| 308   if (error_count_ > kMaxConnectionErrorsBeforeReset) { | 309   if (error_count_ > kMaxConnectionErrorsBeforeReset) { | 
| 309     error_count_ = 0; | 310     error_count_ = 0; | 
| 310 | 311 | 
| 311     // Be careful with this mutex because calling out to other methods can | 312     // Be careful with this mutex because calling out to other methods can | 
| 312     // result in being called back. Unlock it here to prevent any potential | 313     // result in being called back. Unlock it here to prevent any potential | 
| 313     // double-acquisitions. | 314     // double-acquisitions. | 
| 314     error_count_mutex_.Unlock(); | 315     error_count_mutex_.Unlock(); | 
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 369 | 370 | 
| 370 }  // namespace browser_sync | 371 }  // namespace browser_sync | 
| 371 | 372 | 
| 372 std::ostream& operator << (std::ostream& s, | 373 std::ostream& operator << (std::ostream& s, | 
| 373                            const struct browser_sync::HttpResponse& hr) { | 374                            const struct browser_sync::HttpResponse& hr) { | 
| 374   s << " Response Code (bogus on error): " << hr.response_code; | 375   s << " Response Code (bogus on error): " << hr.response_code; | 
| 375   s << " Content-Length (bogus on error): " << hr.content_length; | 376   s << " Content-Length (bogus on error): " << hr.content_length; | 
| 376   s << " Server Status: " << hr.server_status; | 377   s << " Server Status: " << hr.server_status; | 
| 377   return s; | 378   return s; | 
| 378 } | 379 } | 
| OLD | NEW | 
|---|