Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup Socket/SocketPoll 'Limited open Connections' Changes #10265

Merged
merged 2 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
3 changes: 0 additions & 3 deletions net/Socket.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1441,8 +1441,6 @@ class StreamSocket : public Socket,
return std::string();
}

protected:

/// Called when a polling event is received.
/// @events is the mask of events that triggered the wake.
void handlePoll(SocketDisposition &disposition,
Expand Down Expand Up @@ -1567,7 +1565,6 @@ class StreamSocket : public Socket,
disposition.setClosed();
}

public:
/// Override to write data out to socket.
/// Returns the last return from writeData.
virtual int writeOutgoingData()
Expand Down
Loading