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

Remove disabled StreamSocket::checkRemoval criteria minimum throughput #10325

Merged
merged 1 commit into from
Oct 25, 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
3 changes: 0 additions & 3 deletions net/NetUtil.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ class Defaults

/// Maximum total connections (9999 or MAX_CONNECTIONS). Zero disables metric.
size_t MaxConnections;
/// Socket minimum bits per seconds throughput (0). Zero disables metric.
double MinBytesPerSec;

/// Socket poll timeout in us (64s), useful to increase for debugging.
std::chrono::microseconds SocketPollTimeout;
Expand All @@ -53,7 +51,6 @@ class Defaults
, WSPingPeriod(std::chrono::microseconds(3000000))
, HTTPTimeout(std::chrono::microseconds(30000000))
, MaxConnections(9999)
, MinBytesPerSec(0.0)
, SocketPollTimeout(std::chrono::microseconds(64000000))
{
}
Expand Down
11 changes: 2 additions & 9 deletions net/Socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1502,24 +1502,17 @@ bool StreamSocket::checkRemoval(std::chrono::steady_clock::time_point now)
if( isIPType() )
{
// Forced removal on outside-facing IPv[46] network connections only
const auto durTotal =
std::chrono::duration_cast<std::chrono::milliseconds>(now - getCreationTime());
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 maximum idle (_pollTimeout default 64s)
const bool isIDLE = _pollTimeout > std::chrono::microseconds::zero() &&
durLast > _pollTimeout;
/// TO Criteria: Violate minimum bytes-per-sec throughput? (_minBytesPerSec default 0, disabled)
const bool isMinThroughput = _minBytesPerSec > std::numeric_limits<double>::epsilon() &&
bytesPerSecIn > std::numeric_limits<double>::epsilon() &&
bytesPerSecIn < _minBytesPerSec;
/// TO Criteria: Shall terminate?
const bool isTermination = SigUtil::getTerminationFlag();
if (isIDLE || isMinThroughput || isTermination )
if (isIDLE || isTermination )
{
LOG_WRN("CheckRemoval: Timeout: {IDLE " << isIDLE
<< ", MinThroughput " << isMinThroughput << ", Termination " << isTermination << "}, "
<< ", 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 @@ -1069,7 +1069,6 @@ class StreamSocket : public Socket,
Socket(fd, type, creationTime),
_pollTimeout( net::Defaults::get().SocketPollTimeout ),
_httpTimeout( net::Defaults::get().HTTPTimeout ),
_minBytesPerSec( net::Defaults::get().MinBytesPerSec ),
_hostname(std::move(host)),
_wsState(WSState::HTTP),
_isLocalHost(hostType == LocalHost),
Expand Down Expand Up @@ -1739,8 +1738,6 @@ class StreamSocket : public Socket,
const std::chrono::microseconds _pollTimeout;
/// defaults to 30s, see net::Defaults::HTTPTimeout
const std::chrono::microseconds _httpTimeout;
/// defaults to 0 (disabled), see net::Defaults::MinBytesPerSec
const double _minBytesPerSec;

/// The hostname (or IP) of the peer we are connecting to.
const std::string _hostname;
Expand Down
3 changes: 0 additions & 3 deletions test/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ all_la_unit_tests = \
unit-join-disconnect.la \
unit-initial-load-fail.la \
unit-timeout.la \
unit-timeout_socket.la \
unit-timeout_wsping.la \
unit-timeout_conn.la \
unit-timeout_none.la \
Expand Down Expand Up @@ -227,8 +226,6 @@ unit_join_disconnect_la_SOURCES = UnitJoinDisconnect.cpp
unit_join_disconnect_la_LIBADD = $(CPPUNIT_LIBS)
unit_timeout_la_SOURCES = UnitTimeout.cpp
unit_timeout_la_LIBADD = $(CPPUNIT_LIBS)
unit_timeout_socket_la_SOURCES = UnitTimeoutSocket.cpp
unit_timeout_socket_la_LIBADD = $(CPPUNIT_LIBS)
unit_timeout_wsping_la_SOURCES = UnitTimeoutWSPing.cpp
unit_timeout_wsping_la_LIBADD = $(CPPUNIT_LIBS)
unit_timeout_conn_la_SOURCES = UnitTimeoutConnections.cpp
Expand Down
1 change: 0 additions & 1 deletion test/UnitTimeoutConnections.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class UnitTimeoutConnections : public UnitTimeoutBase1
// defaults.HTTPTimeout = std::chrono::microseconds(30000000);
// defaults.MaxConnections = 9999;
defaults.MaxConnections = ConnectionLimit;
// defaults.MinBytesPerSec = 0.0;
// defaults.SocketPollTimeout = std::chrono::microseconds(64000000);
}

Expand Down
1 change: 0 additions & 1 deletion test/UnitTimeoutNone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class UnitTimeoutNone : public UnitTimeoutBase1
// defaults.HTTPTimeout = std::chrono::microseconds(30000000);
// defaults.MaxConnections = 9999;
// defaults.MaxConnections = ConnectionLimit;
// defaults.MinBytesPerSec = 0.0;
// defaults.SocketPollTimeout = std::chrono::microseconds(64000000);
}

Expand Down
192 changes: 0 additions & 192 deletions test/UnitTimeoutSocket.cpp

This file was deleted.

1 change: 0 additions & 1 deletion test/UnitTimeoutWSPing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class UnitTimeoutWSPing : public UnitTimeoutBase0
defaults.WSPingPeriod = std::chrono::microseconds(10000);
// defaults.HTTPTimeout = std::chrono::microseconds(30000000);
// defaults.MaxConnections = 9999;
// defaults.MinBytesPerSec = 0.0;
// defaults.SocketPollTimeout = std::chrono::microseconds(64000000);
}

Expand Down
1 change: 0 additions & 1 deletion wsd/COOLWSD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2771,7 +2771,6 @@ void COOLWSD::innerInitialize(Poco::Util::Application& self)
LOG_DBG("net::Defaults: WSPing[Timeout "
<< netDefaults.WSPingTimeout << ", Period " << netDefaults.WSPingPeriod << "], HTTP[Timeout "
<< netDefaults.HTTPTimeout << "], Socket[MaxConnections " << netDefaults.MaxConnections
<< ", MinBytesPerSec " << netDefaults.MinBytesPerSec
<< "], SocketPoll[Timeout " << netDefaults.SocketPollTimeout << "]");
}

Expand Down
Loading