Bug 522684 - Test timed out for /tests/security/ssl/mixedcontent/test_bug472986.html, fixing another ssltunnel hang, r=ted

This commit is contained in:
Honza Bambas 2009-10-31 13:53:54 +01:00
parent 6fb3a1a51c
commit fd4ae1cbce

View File

@ -378,6 +378,7 @@ void HandleConnection(void* data)
{ci->client_sock, PR_POLL_READ, 0},
{other_sock, PR_POLL_READ, 0}
};
PRBool socketErrorState[2] = {PR_FALSE, PR_FALSE};
while (!((client_error||client_done) && buffers[0].empty() && buffers[1].empty()))
{
@ -405,6 +406,7 @@ void HandleConnection(void* data)
if (out_flags & (PR_POLL_EXCEPT | PR_POLL_ERR | PR_POLL_HUP))
{
client_error = true;
socketErrorState[s] = PR_TRUE;
// We got a fatal error state on the socket. Clear the output buffer
// for this socket to break the main loop, we will never more be able
// to send those data anyway.
@ -425,10 +427,22 @@ void HandleConnection(void* data)
else if (bytesRead < 0)
{
if (PR_GetError() != PR_WOULD_BLOCK_ERROR)
{
// We are in error state, indicate that the connection was
// not closed gracefully
client_error = true;
socketErrorState[s] = PR_TRUE;
// Wipe out our send buffer, we cannot send it anyway.
buffers[s2].bufferhead = buffers[s2].buffertail = buffers[s2].buffer;
}
}
else
{
// If the other socket is in error state (unable to send/receive)
// throw this data away and continue loop
if (socketErrorState[s2])
continue;
buffers[s].buffertail += bytesRead;
// We have to accept and handle the initial CONNECT request here
@ -485,6 +499,7 @@ void HandleConnection(void* data)
{
if (PR_GetError() != PR_WOULD_BLOCK_ERROR) {
client_error = true;
socketErrorState[s] = PR_TRUE;
// We got a fatal error while writting the buffer. Clear it to break
// the main loop, we will never more be able to send it.
buffers[s2].bufferhead = buffers[s2].buffertail = buffers[s2].buffer;