mirror of
https://github.com/resiprocate/resiprocate.git
synced 2026-01-12 00:05:02 +08:00
Protect against time calcuation underflows in ConnectionManager::gc
- misc: remove mostly useless log statement in Helper::getSdp
This commit is contained in:
@@ -244,7 +244,8 @@ unsigned int
|
||||
ConnectionManager::gc(uint64_t relThreshold, unsigned int maxToRemove)
|
||||
{
|
||||
uint64_t curTimeMs = Timer::getTimeMs();
|
||||
uint64_t threshold = curTimeMs - relThreshold;
|
||||
uint64_t threshold = curTimeMs > relThreshold ? curTimeMs - relThreshold : 0; // Ensure we don't underflow
|
||||
|
||||
DebugLog(<< "recycling connections not used in last " << relThreshold/1000.0 << " seconds");
|
||||
|
||||
// Look through non-flow-timer connections and close those using the passed in relThreshold
|
||||
|
||||
@@ -2275,12 +2275,12 @@ unique_ptr<SdpContents> Helper::getSdp(Contents* tree)
|
||||
|
||||
if (sdp)
|
||||
{
|
||||
DebugLog(<< "Got sdp" << endl);
|
||||
//DebugLog(<< "Got sdp");
|
||||
return unique_ptr<SdpContents>(static_cast<SdpContents*>(sdp->clone()));
|
||||
}
|
||||
}
|
||||
|
||||
//DebugLog(<< "No sdp" << endl);
|
||||
//DebugLog(<< "No sdp");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user