mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-22 07:07:30 +09:00
[Network] Add a socket thread check and early exit for corner cases.
This commit is contained in:
parent
bd80099e2c
commit
e45fbf91ce
2 changed files with 18 additions and 6 deletions
|
|
@ -2638,6 +2638,7 @@ nsHttpConnectionMgr::OnMsgCompleteUpgrade(int32_t, ARefBase *param)
|
||||||
void
|
void
|
||||||
nsHttpConnectionMgr::OnMsgUpdateParam(int32_t inParam, ARefBase *)
|
nsHttpConnectionMgr::OnMsgUpdateParam(int32_t inParam, ARefBase *)
|
||||||
{
|
{
|
||||||
|
MOZ_ASSERT(OnSocketThread(), "not on socket thread");
|
||||||
uint32_t param = static_cast<uint32_t>(inParam);
|
uint32_t param = static_cast<uint32_t>(inParam);
|
||||||
uint16_t name = ((param) & 0xFFFF0000) >> 16;
|
uint16_t name = ((param) & 0xFFFF0000) >> 16;
|
||||||
uint16_t value = param & 0x0000FFFF;
|
uint16_t value = param & 0x0000FFFF;
|
||||||
|
|
@ -2709,9 +2710,18 @@ nsHttpConnectionMgr::ActivateTimeoutTick()
|
||||||
NS_WARNING("failed to create timer for http timeout management");
|
NS_WARNING("failed to create timer for http timeout management");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||||
|
if (!mSocketThreadTarget) {
|
||||||
|
NS_WARNING("HTTP Connection Manager: Cannot activate timout if not initialized or shutdown");
|
||||||
|
return;
|
||||||
|
}
|
||||||
mTimeoutTick->SetTarget(mSocketThreadTarget);
|
mTimeoutTick->SetTarget(mSocketThreadTarget);
|
||||||
}
|
}
|
||||||
|
if (mIsShuttingDown) { // Atomic
|
||||||
|
// don't set a timer to generate an event if we're shutting down
|
||||||
|
// (mSocketThreadTarget might be null or garbage anyway if we're shutting down)
|
||||||
|
return;
|
||||||
|
}
|
||||||
MOZ_ASSERT(!mTimeoutTickArmed, "timer tick armed");
|
MOZ_ASSERT(!mTimeoutTickArmed, "timer tick armed");
|
||||||
mTimeoutTickArmed = true;
|
mTimeoutTickArmed = true;
|
||||||
mTimeoutTick->Init(this, 1000, nsITimer::TYPE_REPEATING_SLACK);
|
mTimeoutTick->Init(this, 1000, nsITimer::TYPE_REPEATING_SLACK);
|
||||||
|
|
|
||||||
|
|
@ -492,8 +492,15 @@ private:
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
ReentrantMonitor mReentrantMonitor;
|
ReentrantMonitor mReentrantMonitor;
|
||||||
|
// This is used as a flag that we're shut down, and no new events should be
|
||||||
|
// dispatched.
|
||||||
nsCOMPtr<nsIEventTarget> mSocketThreadTarget;
|
nsCOMPtr<nsIEventTarget> mSocketThreadTarget;
|
||||||
|
|
||||||
|
Atomic<bool, mozilla::Relaxed> mIsShuttingDown;
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
|
// NOTE: these members are only accessed on the socket transport thread
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
// connection limits
|
// connection limits
|
||||||
uint16_t mMaxConns;
|
uint16_t mMaxConns;
|
||||||
uint16_t mMaxPersistConnsPerHost;
|
uint16_t mMaxPersistConnsPerHost;
|
||||||
|
|
@ -501,11 +508,6 @@ private:
|
||||||
uint16_t mMaxRequestDelay; // in seconds
|
uint16_t mMaxRequestDelay; // in seconds
|
||||||
uint16_t mMaxPipelinedRequests;
|
uint16_t mMaxPipelinedRequests;
|
||||||
uint16_t mMaxOptimisticPipelinedRequests;
|
uint16_t mMaxOptimisticPipelinedRequests;
|
||||||
Atomic<bool, mozilla::Relaxed> mIsShuttingDown;
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
// NOTE: these members are only accessed on the socket transport thread
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
|
|
||||||
bool ProcessPendingQForEntry(nsConnectionEntry *, bool considerAll);
|
bool ProcessPendingQForEntry(nsConnectionEntry *, bool considerAll);
|
||||||
bool IsUnderPressure(nsConnectionEntry *ent,
|
bool IsUnderPressure(nsConnectionEntry *ent,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue