mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 840612 - Part 3: refactor the Reset method. r=mayhemer
This commit is contained in:
parent
7fffefb66d
commit
1f5855d289
@ -685,31 +685,31 @@ nsSocketTransportService::Run()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsSocketTransportService::DetachSocketWithGuard(bool aGuardLocals,
|
||||
SocketContext *socketList,
|
||||
int32_t index)
|
||||
{
|
||||
bool isGuarded = false;
|
||||
if (aGuardLocals) {
|
||||
socketList[index].mHandler->IsLocal(&isGuarded);
|
||||
if (!isGuarded)
|
||||
socketList[index].mHandler->KeepWhenOffline(&isGuarded);
|
||||
}
|
||||
if (!isGuarded)
|
||||
DetachSocket(socketList, &socketList[index]);
|
||||
}
|
||||
|
||||
void
|
||||
nsSocketTransportService::Reset(bool aGuardLocals)
|
||||
{
|
||||
// detach any sockets
|
||||
int32_t i;
|
||||
bool isGuarded;
|
||||
for (i = mActiveCount - 1; i >= 0; --i) {
|
||||
isGuarded = false;
|
||||
if (aGuardLocals) {
|
||||
mActiveList[i].mHandler->IsLocal(&isGuarded);
|
||||
if (!isGuarded)
|
||||
mActiveList[i].mHandler->KeepWhenOffline(&isGuarded);
|
||||
}
|
||||
if (!isGuarded)
|
||||
DetachSocket(mActiveList, &mActiveList[i]);
|
||||
DetachSocketWithGuard(aGuardLocals, mActiveList, i);
|
||||
}
|
||||
for (i = mIdleCount - 1; i >= 0; --i) {
|
||||
isGuarded = false;
|
||||
if (aGuardLocals) {
|
||||
mIdleList[i].mHandler->IsLocal(&isGuarded);
|
||||
if (!isGuarded)
|
||||
mIdleList[i].mHandler->KeepWhenOffline(&isGuarded);
|
||||
}
|
||||
if (!isGuarded)
|
||||
DetachSocket(mIdleList, &mIdleList[i]);
|
||||
DetachSocketWithGuard(aGuardLocals, mIdleList, i);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -192,6 +192,9 @@ private:
|
||||
SocketContext *context, bool aActive);
|
||||
|
||||
void ClosePrivateConnections();
|
||||
void DetachSocketWithGuard(bool aGuardLocals,
|
||||
SocketContext *socketList,
|
||||
int32_t index);
|
||||
};
|
||||
|
||||
extern nsSocketTransportService *gSocketTransportService;
|
||||
|
Loading…
Reference in New Issue
Block a user