mirror of
https://github.com/ManchildProductions/UXP-Fixed.git
synced 2026-07-21 03:48:43 +00:00
Revert "Issue #1695 - Add clamping to websocket polling timeouts."
As of [da0c073a7] we no longer need this workaround because the issue is avoided with proper sleep/wake logic restored. This reverts commit2fa993b563.
This commit is contained in:
@@ -1660,11 +1660,6 @@ pref("network.websocket.timeout.open", 20);
|
||||
// close message
|
||||
pref("network.websocket.timeout.close", 20);
|
||||
|
||||
// Setting this to true will clamp the websocket timeout value to a minimum
|
||||
// regardless if there are pending events on the thread.
|
||||
// This is a workaround for runaway polling, see issue #1695
|
||||
pref("network.websocket.timeout.clamped", false);
|
||||
|
||||
// the number of seconds of idle read activity to sustain before sending a
|
||||
// ping probe. 0 to disable.
|
||||
pref("network.websocket.timeout.ping.request", 0);
|
||||
|
||||
@@ -42,7 +42,6 @@ Atomic<PRThread*, Relaxed> gSocketThread;
|
||||
#define KEEPALIVE_PROBE_COUNT_PREF "network.tcp.keepalive.probe_count"
|
||||
#define SOCKET_LIMIT_TARGET 1000U
|
||||
#define SOCKET_LIMIT_MIN 50U
|
||||
#define SOCKET_CLAMP_PREF "network.websocket.timeout.clamped"
|
||||
#define BLIP_INTERVAL_PREF "network.activity.blipIntervalMilliseconds"
|
||||
#define MAX_TIME_BETWEEN_TWO_POLLS "network.sts.max_time_for_events_between_two_polls"
|
||||
#define MAX_TIME_FOR_PR_CLOSE_DURING_SHUTDOWN "network.sts.max_time_for_pr_close_during_shutdown"
|
||||
@@ -121,7 +120,6 @@ nsSocketTransportService::nsSocketTransportService()
|
||||
, mKeepaliveEnabledPref(false)
|
||||
, mServingPendingQueue(false)
|
||||
, mMaxTimePerPollIter(100)
|
||||
, mClampSocketTimeout(false)
|
||||
, mMaxTimeForPrClosePref(PR_SecondsToInterval(5))
|
||||
, mSleepPhase(false)
|
||||
, mProbedMaxCount(false)
|
||||
@@ -488,11 +486,7 @@ nsSocketTransportService::Poll(PRIntervalTime ts)
|
||||
mPollList[0].out_flags = 0;
|
||||
pollList = mPollList;
|
||||
pollCount = mActiveCount + 1;
|
||||
pollTimeout = IsSocketTimeoutClamped() ?
|
||||
PR_MillisecondsToInterval(100) :
|
||||
pendingEvents ?
|
||||
PR_INTERVAL_NO_WAIT :
|
||||
PollTimeout(ts);
|
||||
pollTimeout = pendingEvents ? PR_INTERVAL_NO_WAIT : PollTimeout(ts);
|
||||
}
|
||||
else {
|
||||
// no pollable event, so busy wait...
|
||||
@@ -501,11 +495,8 @@ nsSocketTransportService::Poll(PRIntervalTime ts)
|
||||
pollList = &mPollList[1];
|
||||
else
|
||||
pollList = nullptr;
|
||||
pollTimeout = IsSocketTimeoutClamped() ?
|
||||
PR_MillisecondsToInterval(25) :
|
||||
pendingEvents ?
|
||||
PR_INTERVAL_NO_WAIT :
|
||||
PR_MillisecondsToInterval(25);
|
||||
pollTimeout =
|
||||
pendingEvents ? PR_INTERVAL_NO_WAIT : PR_MillisecondsToInterval(25);
|
||||
}
|
||||
|
||||
SOCKET_LOG((" timeout = %i milliseconds\n",
|
||||
@@ -564,7 +555,6 @@ nsSocketTransportService::Init()
|
||||
tmpPrefService->AddObserver(KEEPALIVE_RETRY_INTERVAL_PREF, this, false);
|
||||
tmpPrefService->AddObserver(KEEPALIVE_PROBE_COUNT_PREF, this, false);
|
||||
tmpPrefService->AddObserver(MAX_TIME_BETWEEN_TWO_POLLS, this, false);
|
||||
tmpPrefService->AddObserver(SOCKET_CLAMP_PREF, this, false);
|
||||
tmpPrefService->AddObserver(MAX_TIME_FOR_PR_CLOSE_DURING_SHUTDOWN, this, false);
|
||||
}
|
||||
UpdatePrefs();
|
||||
@@ -1170,13 +1160,6 @@ nsSocketTransportService::UpdatePrefs()
|
||||
if (NS_SUCCEEDED(rv) && maxTimePref >= 0) {
|
||||
mMaxTimePerPollIter = maxTimePref;
|
||||
}
|
||||
|
||||
bool socketTimeoutClamped = false;
|
||||
rv = tmpPrefService->GetBoolPref(SOCKET_CLAMP_PREF,
|
||||
&socketTimeoutClamped);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mClampSocketTimeout = socketTimeoutClamped;
|
||||
}
|
||||
|
||||
int32_t maxTimeForPrClosePref;
|
||||
rv = tmpPrefService->GetIntPref(MAX_TIME_FOR_PR_CLOSE_DURING_SHUTDOWN,
|
||||
|
||||
@@ -116,9 +116,6 @@ public:
|
||||
|
||||
// Returns true if keepalives are enabled in prefs.
|
||||
bool IsKeepaliveEnabled() { return mKeepaliveEnabledPref; }
|
||||
|
||||
// Returns true if socket timeout clamping is enabled in prefs.
|
||||
bool IsSocketTimeoutClamped() { return mClampSocketTimeout; }
|
||||
|
||||
PRIntervalTime MaxTimeForPrClosePref() {return mMaxTimeForPrClosePref; }
|
||||
protected:
|
||||
@@ -256,8 +253,6 @@ private:
|
||||
int32_t mKeepaliveProbeCount;
|
||||
// True if TCP keepalive is enabled globally.
|
||||
bool mKeepaliveEnabledPref;
|
||||
// True if socket polling should be clamped.
|
||||
bool mClampSocketTimeout;
|
||||
|
||||
Atomic<bool> mServingPendingQueue;
|
||||
Atomic<int32_t, Relaxed> mMaxTimePerPollIter;
|
||||
|
||||
Reference in New Issue
Block a user