Chromium Code Reviews| Index: chrome/browser/sync/engine/syncer_proto_util.cc |
| diff --git a/chrome/browser/sync/engine/syncer_proto_util.cc b/chrome/browser/sync/engine/syncer_proto_util.cc |
| index 6dae7689f12e54886bdb2e3844ff305f598fc48b..2d4d1c98866847fa1f507fca75b8cfb1377aeedb 100644 |
| --- a/chrome/browser/sync/engine/syncer_proto_util.cc |
| +++ b/chrome/browser/sync/engine/syncer_proto_util.cc |
| @@ -11,6 +11,7 @@ |
| #include "chrome/browser/sync/engine/syncer_types.h" |
| #include "chrome/browser/sync/engine/syncer_util.h" |
| #include "chrome/browser/sync/protocol/service_constants.h" |
| +#include "chrome/browser/sync/protocol/sync.pb.h" |
| #include "chrome/browser/sync/sessions/sync_session.h" |
| #include "chrome/browser/sync/syncable/directory_manager.h" |
| #include "chrome/browser/sync/syncable/model_type.h" |
| @@ -182,6 +183,17 @@ bool SyncerProtoUtil::PostAndProcessHeaders(ServerConnectionManager* scm, |
| return false; |
| } |
| +int SyncerProtoUtil::GetThrottleDelay( |
| + const sync_pb::ClientToServerResponse& response) { |
| + if (!response.has_client_command()) |
| + return kSyncDelayAfterThrottled; |
| + const sync_pb::ClientCommand& command = response.client_command(); |
| + if (command.has_throttle_delay()) |
| + return command.throttle_delay(); |
|
akalin
2011/08/10 01:24:36
use TimeDelta::FromSeconds()
lipalani1
2011/08/10 19:04:05
Done.
|
| + else |
| + return kSyncDelayAfterThrottled; |
|
akalin
2011/08/10 01:24:36
here, too
lipalani1
2011/08/10 19:04:05
Done.
|
| +} |
| + |
| namespace { |
| // Helper function for an assertion in PostClientToServerMessage. |
| @@ -236,7 +248,7 @@ bool SyncerProtoUtil::PostClientToServerMessage( |
| case ClientToServerResponse::THROTTLED: |
| LOG(WARNING) << "Client silenced by server."; |
| session->delegate()->OnSilencedUntil(base::TimeTicks::Now() + |
| - base::TimeDelta::FromSeconds(kSyncDelayAfterThrottled)); |
| + base::TimeDelta::FromSeconds(GetThrottleDelay(*response))); |
| return false; |
| case ClientToServerResponse::TRANSIENT_ERROR: |
| return false; |