Bug 942152, r=dkeeler, r=honzab

--HG--
extra : rebase_source : 7f0bab4efa26e9c185b29fdb14d846035147fd2f
This commit is contained in:
Brian Smith 2013-12-05 20:33:49 -08:00
parent a1c4cb2548
commit 25cf163695

View File

@ -1036,7 +1036,8 @@ int32_t checkHandshake(int32_t bytesTransfered, bool wasReading,
PRFileDesc* ssl_layer_fd,
nsNSSSocketInfo *socketInfo)
{
PRErrorCode err = PR_GetError();
const PRErrorCode originalError = PR_GetError();
PRErrorCode err = originalError;
// This is where we work around all of those SSL servers that don't
// conform to the SSL spec and shutdown a connection when we request
@ -1114,6 +1115,14 @@ int32_t checkHandshake(int32_t bytesTransfered, bool wasReading,
}
if (bytesTransfered < 0) {
// Remember that we encountered an error so that getSocketInfoIfRunning
// will correctly cause us to fail if another part of Gecko
// (erroneously) calls an I/O function (PR_Send/PR_Recv/etc.) again on
// this socket. Note that we use the original error because if we use
// PR_CONNECT_RESET_ERROR, we'll repeated try to reconnect.
if (originalError != PR_WOULD_BLOCK_ERROR && !socketInfo->GetErrorCode()) {
socketInfo->SetCanceled(originalError, PlainErrorMessage);
}
PR_SetError(err, 0);
}