0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

safter time parsing from heartbeat

This commit is contained in:
Eliot Horowitz 2010-10-01 13:40:54 -04:00
parent 9eb2e8c2ba
commit 7b17586c5b

View File

@ -163,15 +163,15 @@ namespace mongo {
time_t after = mem.lastHeartbeat = time(0); // we set this on any response - we don't get this far if couldn't connect because exception is thrown
try {
mem.skew = 0;
long long t = info["time"].Long();
if ( info["time"].isNumber() ) {
long long t = info["time"].numberLong();
if( t > after )
mem.skew = (int) (t - after);
else if( t < before )
mem.skew = (int) (t - before); // negative
}
catch(...) {
else {
warning() << "heatbeat.time isn't a number: " << info << endl;
mem.skew = INT_MIN;
}