diff options
author | John Grossman <johngro@google.com> | 2012-04-09 17:00:24 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2012-04-09 17:00:24 -0700 |
commit | 8100960892c89d1c8898fd18fdc4fefca1f3895c (patch) | |
tree | 079953312c66d84f7ac5ac69bf5467339bab0992 /services | |
parent | 2ac05e9c0f8082da41a7b072298c3c2a07f4e317 (diff) | |
parent | e1d6c080f0b1769637d742e51cc22167c7af12bb (diff) | |
download | frameworks_base-8100960892c89d1c8898fd18fdc4fefca1f3895c.zip frameworks_base-8100960892c89d1c8898fd18fdc4fefca1f3895c.tar.gz frameworks_base-8100960892c89d1c8898fd18fdc4fefca1f3895c.tar.bz2 |
am e1d6c080: Make common_time more deferential when coming out of networkless mode.
* commit 'e1d6c080f0b1769637d742e51cc22167c7af12bb':
Make common_time more deferential when coming out of networkless mode.
Diffstat (limited to 'services')
-rw-r--r-- | services/common_time/common_time_server.cpp | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/services/common_time/common_time_server.cpp b/services/common_time/common_time_server.cpp index ef7fa16..7a4986b 100644 --- a/services/common_time/common_time_server.cpp +++ b/services/common_time/common_time_server.cpp @@ -80,14 +80,14 @@ const int CommonTimeServer::kInitial_WhoIsMasterTimeoutMs = 500; // number of sync requests that can fail before a client assumes its master // is dead -const int CommonTimeServer::kClient_NumSyncRequestRetries = 5; +const int CommonTimeServer::kClient_NumSyncRequestRetries = 10; /*** Master state constants ***/ /*** Ronin state constants ***/ // number of WhoIsMaster attempts sent before declaring ourselves master -const int CommonTimeServer::kRonin_NumWhoIsMasterRetries = 4; +const int CommonTimeServer::kRonin_NumWhoIsMasterRetries = 20; // timeout used when waiting for a response to a WhoIsMaster request const int CommonTimeServer::kRonin_WhoIsMasterTimeoutMs = 500; @@ -96,7 +96,7 @@ const int CommonTimeServer::kRonin_WhoIsMasterTimeoutMs = 500; // how long do we wait for an announcement from a master before // trying another election? -const int CommonTimeServer::kWaitForElection_TimeoutMs = 5000; +const int CommonTimeServer::kWaitForElection_TimeoutMs = 12500; CommonTimeServer::CommonTimeServer() : Thread(false) @@ -279,10 +279,14 @@ bool CommonTimeServer::runStateMachine_l() { // If we were in the master state, then either we were the // master in a no-network situation, or we were the master // of a different network and have moved to a new interface. - // In either case, immediately send out a master - // announcement at low priority. + // In either case, immediately transition to Ronin at low + // priority. If there is no one in the network we just + // joined, we will become master soon enough. If there is, + // we want to be certain to defer master status to the + // existing timeline currently running on the network. + // case CommonClockService::STATE_MASTER: - sendMasterAnnouncement(); + becomeRonin("leaving networkless mode"); break; // If we were in any other state (CLIENT, RONIN, or @@ -1072,6 +1076,12 @@ bool CommonTimeServer::becomeClient(const sockaddr_storage& masterEP, mMasterEP = masterEP; mMasterEPValid = true; + + // If we are on a real network as a client of a real master, then we should + // no longer force low priority. If our master disappears, we should have + // the high priority bit set during the election to replace the master + // because this group was a real group and not a singleton created in + // networkless mode. setForceLowPriority(false); mClient_MasterDeviceID = masterDeviceID; @@ -1113,7 +1123,6 @@ bool CommonTimeServer::becomeMaster(const char* cause) { memset(&mMasterEP, 0, sizeof(mMasterEP)); mMasterEPValid = false; - setForceLowPriority(false); mClient_MasterDevicePriority = effectivePriority(); mClient_MasterDeviceID = mDeviceID; mClockRecovery.reset(false, true); |