bug 855185 ResetIPFamily called off socket thread r=honzab

This commit is contained in:
Patrick McManus 2013-04-30 23:43:32 -04:00
Родитель 97fa570e8b
Коммит ae96e7abac
3 изменённых файлов: 24 добавлений и 12 удалений

Просмотреть файл

@ -4515,8 +4515,7 @@ nsHttpChannel::BeginConnect()
if (mLoadFlags & LOAD_FRESH_CONNECTION) {
// just the initial document resets the whole pool
if (mLoadFlags & LOAD_INITIAL_DOCUMENT_URI) {
gHttpHandler->ConnMgr()->ClosePersistentConnections();
gHttpHandler->ConnMgr()->ResetIPFamillyPreference(mConnectionInfo);
gHttpHandler->ConnMgr()->DoShiftReloadConnectionCleanup(mConnectionInfo);
}
// each sub resource gets a fresh connection
mCaps &= ~(NS_HTTP_ALLOW_KEEPALIVE | NS_HTTP_ALLOW_PIPELINING);

Просмотреть файл

@ -311,9 +311,15 @@ nsHttpConnectionMgr::PruneDeadConnections()
}
nsresult
nsHttpConnectionMgr::ClosePersistentConnections()
nsHttpConnectionMgr::DoShiftReloadConnectionCleanup(nsHttpConnectionInfo *aCI)
{
return PostEvent(&nsHttpConnectionMgr::OnMsgClosePersistentConnections);
nsRefPtr<nsHttpConnectionInfo> connInfo(aCI);
nsresult rv = PostEvent(&nsHttpConnectionMgr::OnMsgDoShiftReloadConnectionCleanup,
0, connInfo);
if (NS_SUCCEEDED(rv))
connInfo.forget();
return rv;
}
nsresult
@ -2225,12 +2231,17 @@ nsHttpConnectionMgr::OnMsgPruneDeadConnections(int32_t, void *)
}
void
nsHttpConnectionMgr::OnMsgClosePersistentConnections(int32_t, void *)
nsHttpConnectionMgr::OnMsgDoShiftReloadConnectionCleanup(int32_t, void *param)
{
LOG(("nsHttpConnectionMgr::OnMsgClosePersistentConnections\n"));
LOG(("nsHttpConnectionMgr::OnMsgDoShiftReloadConnectionCleanup\n"));
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
nsRefPtr<nsHttpConnectionInfo> ci =
dont_AddRef(static_cast<nsHttpConnectionInfo *>(param));
mCT.Enumerate(ClosePersistentConnectionsCB, this);
if (ci)
ResetIPFamilyPreference(ci);
}
void
@ -3392,7 +3403,7 @@ nsHttpConnectionMgr::GetConnectionData(nsTArray<mozilla::net::HttpRetParams> *aA
}
void
nsHttpConnectionMgr::ResetIPFamillyPreference(nsHttpConnectionInfo *ci)
nsHttpConnectionMgr::ResetIPFamilyPreference(nsHttpConnectionInfo *ci)
{
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
nsConnectionEntry *ent = LookupConnectionEntry(ci, nullptr, nullptr);

Просмотреть файл

@ -98,8 +98,9 @@ public:
nsresult PruneDeadConnections();
// Close all idle persistent connections and prevent any active connections
// from being reused.
nsresult ClosePersistentConnections();
// from being reused. Optional connection info resets CI specific
// information such as Happy Eyeballs history.
nsresult DoShiftReloadConnectionCleanup(nsHttpConnectionInfo *);
// called to get a reference to the socket transport service. the socket
// transport service is not available when the connection manager is down.
@ -240,7 +241,7 @@ public:
bool GetConnectionData(nsTArray<mozilla::net::HttpRetParams> *);
void ResetIPFamillyPreference(nsHttpConnectionInfo *);
void ResetIPFamilyPreference(nsHttpConnectionInfo *);
private:
virtual ~nsHttpConnectionMgr();
@ -613,7 +614,7 @@ private:
void OnMsgReclaimConnection (int32_t, void *);
void OnMsgCompleteUpgrade (int32_t, void *);
void OnMsgUpdateParam (int32_t, void *);
void OnMsgClosePersistentConnections (int32_t, void *);
void OnMsgDoShiftReloadConnectionCleanup (int32_t, void *);
void OnMsgProcessFeedback (int32_t, void *);
void OnMsgProcessAllSpdyPendingQ (int32_t, void *);
void OnMsgUpdateRequestTokenBucket (int32_t, void *);
@ -645,7 +646,8 @@ private:
// the connection table
//
// this table is indexed by connection key. each entry is a
// nsConnectionEntry object.
// nsConnectionEntry object. It is unlocked and therefore must only
// be accessed from the socket thread.
//
nsClassHashtable<nsCStringHashKey, nsConnectionEntry> mCT;