Back out Bug 846137 for burning this CLOSED TREE.

This commit is contained in:
Kyle Huey 2013-04-09 16:26:43 -07:00
parent 40d2f22a72
commit 1797951e23

View File

@ -1413,49 +1413,14 @@ nsSocketTransport::GetFD_Locked()
return mFD;
}
void
STS_PRCloseOnSocketTransport(PRFileDesc *fd)
{
// FIX - Should use RUN_ON_THREAD once it's generally available
// RUN_ON_THREAD(gSocketTransportService, WrapRunnableNM(&PR_Close, mFD);
class thunkPRClose : public nsRunnable
{
public:
thunkPRClose(PRFileDesc *fd) : mFD(fd) {}
NS_IMETHOD Run() {
PR_Close(mFD);
return NS_OK;
}
private:
PRFileDesc *mFD;
};
if (gSocketTransportService) {
// Can't PR_Close() a socket off STS thread. Thunk it to STS to die
// FIX - Should use RUN_ON_THREAD once it's generally available
// RUN_ON_THREAD(gSocketThread,WrapRunnableNM(&PR_Close, mFD);
gSocketTransportService->Dispatch(new thunkPRClose(fd), NS_DISPATCH_NORMAL);
} else {
// something horrible has happened
NS_ASSERTION(gSocketTransportService, "No STS service");
}
}
void
nsSocketTransport::ReleaseFD_Locked(PRFileDesc *fd)
{
NS_ASSERTION(mFD == fd, "wrong fd");
if (--mFDref == 0) {
if (PR_GetCurrentThread() == gSocketThread) {
SOCKET_LOG(("nsSocketTransport: calling PR_Close [this=%x]\n", this));
PR_Close(mFD);
} else {
// Can't PR_Close() a socket off STS thread. Thunk it to STS to die
STS_PRCloseOnSocketTransport(mFD);
}
SOCKET_LOG(("nsSocketTransport: calling PR_Close [this=%x]\n", this));
PR_Close(mFD);
mFD = nullptr;
}
}