summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-17 05:22:26 +0000
committertim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-17 05:22:26 +0000
commit79bb11c5d1a3b1d8d3b6f868ee58f606f9783602 (patch)
treecd866bae1a791df7bff887cc2b354c6528d0d23e
parent5b9652b3ce3872c76a824e0c87c6608b03257ae8 (diff)
downloadchromium_src-79bb11c5d1a3b1d8d3b6f868ee58f606f9783602.zip
chromium_src-79bb11c5d1a3b1d8d3b6f868ee58f606f9783602.tar.gz
chromium_src-79bb11c5d1a3b1d8d3b6f868ee58f606f9783602.tar.bz2
sync: remove IncrementErrorCount from ServerConnectionManager.
It's not used for a real purpose anymore, and it was causing the SCM to have multiple active_connection_ objects in certain cases, which is bad. This is mostly covered by SyncAPIServerConnectionManagerTest BUG=101639 TEST=On a debug build, no DCHECKs if the server is unreachable on sync startup. Review URL: http://codereview.chromium.org/8590005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110443 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/sync/engine/net/server_connection_manager.cc28
-rw-r--r--chrome/browser/sync/engine/net/server_connection_manager.h10
2 files changed, 2 insertions, 36 deletions
diff --git a/chrome/browser/sync/engine/net/server_connection_manager.cc b/chrome/browser/sync/engine/net/server_connection_manager.cc
index bceb187..b0d7c2f 100644
--- a/chrome/browser/sync/engine/net/server_connection_manager.cc
+++ b/chrome/browser/sync/engine/net/server_connection_manager.cc
@@ -180,7 +180,6 @@ ServerConnectionManager::ServerConnectionManager(
use_ssl_(use_ssl),
proto_sync_path_(kSyncServerSyncPath),
get_time_path_(kSyncServerGetTimePath),
- error_count_(0),
server_status_(HttpResponse::NONE),
server_reachable_(false),
terminated_(false),
@@ -252,14 +251,11 @@ bool ServerConnectionManager::PostBufferToPath(PostBufferParams* params,
bool ok = post.get()->Init(
path.c_str(), auth_token, params->buffer_in, &params->response);
- if (params->response.server_status == HttpResponse::SYNC_AUTH_ERROR) {
+ if (params->response.server_status == HttpResponse::SYNC_AUTH_ERROR)
InvalidateAndClearAuthToken();
- }
- if (!ok || RC_REQUEST_OK != params->response.response_code) {
- IncrementErrorCount();
+ if (!ok || RC_REQUEST_OK != params->response.response_code)
return false;
- }
if (post.get()->ReadBufferResponse(
&params->buffer_out, &params->response, true)) {
@@ -311,7 +307,6 @@ bool ServerConnectionManager::CheckTime(int32* out_time) {
VLOG(1) << "Server was reachable.";
return true;
}
- IncrementErrorCount();
return false;
}
@@ -336,25 +331,6 @@ bool ServerConnectionManager::CheckServerReachable() {
return server_is_reachable;
}
-bool ServerConnectionManager::IncrementErrorCount() {
- DCHECK(thread_checker_.CalledOnValidThread());
- error_count_++;
-
- if (error_count_ > kMaxConnectionErrorsBeforeReset) {
- error_count_ = 0;
-
- if (!IsServerReachable()) {
- LOG(WARNING) << "Too many connection failures, server is not reachable. "
- << "Resetting connections.";
- } else {
- LOG(WARNING) << "Multiple connection failures while server is reachable.";
- }
- return false;
- }
-
- return true;
-}
-
void ServerConnectionManager::SetServerParameters(const string& server_url,
int port,
bool use_ssl) {
diff --git a/chrome/browser/sync/engine/net/server_connection_manager.h b/chrome/browser/sync/engine/net/server_connection_manager.h
index ae53a37..748c3f7 100644
--- a/chrome/browser/sync/engine/net/server_connection_manager.h
+++ b/chrome/browser/sync/engine/net/server_connection_manager.h
@@ -31,10 +31,6 @@ namespace browser_sync {
class ClientToServerMessage;
-// How many connection errors are accepted before network handles are closed
-// and reopened.
-static const int32 kMaxConnectionErrorsBeforeReset = 10;
-
static const int32 kUnsetResponseCode = -1;
static const int32 kUnsetContentLength = -1;
static const int32 kUnsetPayloadLength = -1;
@@ -299,10 +295,6 @@ class ServerConnectionManager {
return get_time_path_;
}
- // Called wherever a failure should be taken as an indication that we may
- // be experiencing connection difficulties.
- virtual bool IncrementErrorCount();
-
// NOTE: Tests rely on this protected function being virtual.
//
// Internal PostBuffer base function.
@@ -345,8 +337,6 @@ class ServerConnectionManager {
// The previous auth token that is invalid now.
std::string previously_invalidated_token;
- int error_count_; // Tracks the number of connection errors.
-
ObserverList<ServerConnectionEventListener> listeners_;
HttpResponse::ServerConnectionCode server_status_;