зеркало из https://github.com/mozilla/pjs.git
bug 631801 - workaround pr_available() assert r=honzab sr=biesi r=bsmith
This commit is contained in:
Родитель
878adae8a7
Коммит
155bf1b553
|
@ -304,6 +304,16 @@ nsSocketInputStream::Available(PRUint32 *avail)
|
|||
// mistakenly try to re-enter this code.)
|
||||
PRInt32 n = PR_Available(fd);
|
||||
|
||||
// PSM does not implement PR_Available() so do a best approximation of it
|
||||
// with MSG_PEEK
|
||||
if ((n == -1) && (PR_GetError() == PR_NOT_IMPLEMENTED_ERROR)) {
|
||||
char c;
|
||||
|
||||
n = PR_Recv(fd, &c, 1, PR_MSG_PEEK, 0);
|
||||
SOCKET_LOG(("nsSocketInputStream::Available [this=%x] "
|
||||
"using PEEK backup n=%d]\n", this, n));
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
{
|
||||
MutexAutoLock lock(mTransport->mLock);
|
||||
|
|
|
@ -458,11 +458,10 @@ nsHttpConnection::CanReuse()
|
|||
// An idle persistent connection should not have data waiting to be read
|
||||
// before a request is sent. Data here is likely a 408 timeout response
|
||||
// which we would deal with later on through the restart logic, but that
|
||||
// path is more expensive than just closing the socket now. SSL check can
|
||||
// be removed with fixing of 631801
|
||||
// path is more expensive than just closing the socket now.
|
||||
|
||||
PRUint32 dataSize;
|
||||
if (canReuse && mSocketIn && !mConnInfo->UsingSSL() && !mUsingSpdy &&
|
||||
if (canReuse && mSocketIn && !mUsingSpdy &&
|
||||
NS_SUCCEEDED(mSocketIn->Available(&dataSize)) && dataSize) {
|
||||
LOG(("nsHttpConnection::CanReuse %p %s"
|
||||
"Socket not reusable because read data pending (%d) on it.\n",
|
||||
|
|
|
@ -2249,6 +2249,20 @@ static PRStatus PR_CALLBACK PSMConnectcontinue(PRFileDesc *fd, PRInt16 out_flags
|
|||
return fd->lower->methods->connectcontinue(fd, out_flags);
|
||||
}
|
||||
|
||||
static PRIntn PSMAvailable(void)
|
||||
{
|
||||
// This is called through PR_Available(), but is not implemented in PSM
|
||||
PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static PRInt64 PSMAvailable64(void)
|
||||
{
|
||||
// This is called through PR_Available(), but is not implemented in PSM
|
||||
PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
nsresult nsSSLIOLayerHelpers::Init()
|
||||
{
|
||||
if (!nsSSLIOLayerInitialized) {
|
||||
|
@ -2256,8 +2270,8 @@ nsresult nsSSLIOLayerHelpers::Init()
|
|||
nsSSLIOLayerIdentity = PR_GetUniqueIdentity("NSS layer");
|
||||
nsSSLIOLayerMethods = *PR_GetDefaultIOMethods();
|
||||
|
||||
nsSSLIOLayerMethods.available = (PRAvailableFN)_PSM_InvalidInt;
|
||||
nsSSLIOLayerMethods.available64 = (PRAvailable64FN)_PSM_InvalidInt64;
|
||||
nsSSLIOLayerMethods.available = (PRAvailableFN)PSMAvailable;
|
||||
nsSSLIOLayerMethods.available64 = (PRAvailable64FN)PSMAvailable64;
|
||||
nsSSLIOLayerMethods.fsync = (PRFsyncFN)_PSM_InvalidStatus;
|
||||
nsSSLIOLayerMethods.seek = (PRSeekFN)_PSM_InvalidInt;
|
||||
nsSSLIOLayerMethods.seek64 = (PRSeek64FN)_PSM_InvalidInt64;
|
||||
|
|
Загрузка…
Ссылка в новой задаче