@@ -49,17 +49,20 @@ const stdx::chrono::seconds kDefaultSocketTimeout(30);
4949const milliseconds kDefaultPingInterval (30 * 1000 );
5050} // unnamed namespace
5151
52+ bool LegacyDistLockManager::_pingerEnabled = true ;
53+
5254LegacyDistLockManager::LegacyDistLockManager (ConnectionString configServer,
5355 const std::string& processId)
54- : _configServer(std::move(configServer)),
55- _processId (processId),
56- _isStopped(false ),
57- _pingerEnabled(true ) {}
56+ : _configServer(std::move(configServer)), _processId(processId), _isStopped(false ) {}
5857
5958void LegacyDistLockManager::startUp () {
6059 stdx::lock_guard<stdx::mutex> sl (_mutex);
6160 invariant (!_pinger);
6261 _pinger = stdx::make_unique<LegacyDistLockPinger>();
62+
63+ if (_pingerEnabled) {
64+ uassertStatusOK (_pinger->startup (_configServer, _processId, kDefaultPingInterval ));
65+ }
6366}
6467
6568void LegacyDistLockManager::shutDown (OperationContext* txn, bool allowNetworking) {
@@ -93,13 +96,6 @@ StatusWith<DistLockManager::ScopedDistLock> LegacyDistLockManager::lock(
9396 if (_isStopped) {
9497 return Status (ErrorCodes::LockBusy, " legacy distlock manager is stopped" );
9598 }
96-
97- if (_pingerEnabled) {
98- auto pingStatus = _pinger->startPing (*(distLock.get ()), kDefaultPingInterval );
99- if (!pingStatus.isOK ()) {
100- return pingStatus;
101- }
102- }
10399 }
104100
105101 auto lastStatus =
@@ -227,11 +223,6 @@ Status LegacyDistLockManager::checkStatus(OperationContext* txn, const DistLockH
227223 return distLock->checkStatus (durationCount<Seconds>(kDefaultSocketTimeout ));
228224}
229225
230- void LegacyDistLockManager::enablePinger (bool enable) {
231- stdx::lock_guard<stdx::mutex> sl (_mutex);
232- _pingerEnabled = enable;
233- }
234-
235226void LegacyDistLockManager::unlockAll (OperationContext* txn, const std::string& processID) {
236227 fassertFailed (34367 ); // Only supported for CSRS
237228}
0 commit comments