Skip to content

Commit

Permalink
StreamSocket::checkRemoval: Fix TO criteria local-var names, drop use…
Browse files Browse the repository at this point in the history
…less `now < getCreationTime()` criteria.

Signed-off-by: Sven Göthel <[email protected]>
Change-Id: I035ab196e57588513b69894ccc669d88cec488c2
  • Loading branch information
Sven Göthel committed Oct 23, 2024
1 parent 55905f9 commit c6d5a88
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions net/Socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1507,21 +1507,19 @@ bool StreamSocket::checkRemoval(std::chrono::steady_clock::time_point now)
const auto durLast =
std::chrono::duration_cast<std::chrono::milliseconds>(now - getLastSeenTime());
const double bytesPerSecIn = durTotal.count() > 0 ? (double)bytesRcvd() / ((double)durTotal.count() / 1000.0) : 0.0;
/// TO Criteria: Violate creation time? (invalid passed now)
const bool cNow = now < getCreationTime();
/// TO Criteria: Violate maximum idle (_pollTimeout default 64s)
const bool cIDLE = _pollTimeout > std::chrono::microseconds::zero() &&
const bool isIDLE = _pollTimeout > std::chrono::microseconds::zero() &&
durLast > _pollTimeout;
/// TO Criteria: Violate minimum bytes-per-sec throughput? (_minBytesPerSec default 0, disabled)
const bool cMinThroughput = _minBytesPerSec > std::numeric_limits<double>::epsilon() &&
const bool isMinThroughput = _minBytesPerSec > std::numeric_limits<double>::epsilon() &&
bytesPerSecIn > std::numeric_limits<double>::epsilon() &&
bytesPerSecIn < _minBytesPerSec;
/// TO Criteria: Shall terminate?
const bool cTermination = SigUtil::getTerminationFlag();
if (cNow || cIDLE || cMinThroughput || cTermination )
const bool isTermination = SigUtil::getTerminationFlag();
if (isIDLE || isMinThroughput || isTermination )
{
LOG_WRN("CheckRemoval: Timeout: {Now " << cNow << ", IDLE " << cIDLE
<< ", MinThroughput " << cMinThroughput << ", Termination " << cTermination << "}, "
LOG_WRN("CheckRemoval: Timeout: {IDLE " << isIDLE
<< ", MinThroughput " << isMinThroughput << ", Termination " << isTermination << "}, "
<< getStatsString(now) << ", "
<< *this);
if (_socketHandler)
Expand Down

0 comments on commit c6d5a88

Please sign in to comment.