17633
|
1 |
diff --git a/testing/mochitest/ssltunnel/ssltunnel.cpp b/testing/mochitest/ssltunnel/ssltunnel.cpp
|
|
2 |
--- a/testing/mochitest/ssltunnel/ssltunnel.cpp
|
|
3 |
+++ b/testing/mochitest/ssltunnel/ssltunnel.cpp
|
17797
|
4 |
@@ -421,6 +421,7 @@
|
17633
|
5 |
{ci->client_sock, PR_POLL_READ, 0},
|
|
6 |
{other_sock, PR_POLL_READ, 0}
|
|
7 |
};
|
|
8 |
+ PRBool socketErrorState[2] = {PR_FALSE, PR_FALSE};
|
|
9 |
|
|
10 |
while (!((client_error||client_done) && buffers[0].empty() && buffers[1].empty()))
|
|
11 |
{
|
17797
|
12 |
@@ -448,6 +449,7 @@
|
17633
|
13 |
if (out_flags & (PR_POLL_EXCEPT | PR_POLL_ERR | PR_POLL_HUP))
|
|
14 |
{
|
|
15 |
client_error = true;
|
|
16 |
+ socketErrorState[s] = PR_TRUE;
|
|
17 |
// We got a fatal error state on the socket. Clear the output buffer
|
|
18 |
// for this socket to break the main loop, we will never more be able
|
|
19 |
// to send those data anyway.
|
17797
|
20 |
@@ -468,10 +470,22 @@
|
17633
|
21 |
else if (bytesRead < 0)
|
|
22 |
{
|
|
23 |
if (PR_GetError() != PR_WOULD_BLOCK_ERROR)
|
17797
|
24 |
- client_error = true;
|
17633
|
25 |
+ {
|
17797
|
26 |
+ // We are in error state, indicate that the connection was
|
|
27 |
+ // not closed gracefully
|
|
28 |
+ client_error = true;
|
|
29 |
+ socketErrorState[s] = PR_TRUE;
|
|
30 |
+ // Wipe out our send buffer, we cannot send it anyway.
|
|
31 |
+ buffers[s2].bufferhead = buffers[s2].buffertail = buffers[s2].buffer;
|
17633
|
32 |
+ }
|
|
33 |
}
|
|
34 |
else
|
|
35 |
{
|
|
36 |
+ // If the other socket is in error state (unable to send/receive)
|
|
37 |
+ // throw this data away and continue loop
|
|
38 |
+ if (socketErrorState[s2])
|
|
39 |
+ continue;
|
|
40 |
+
|
|
41 |
buffers[s].buffertail += bytesRead;
|
|
42 |
|
|
43 |
// We have to accept and handle the initial CONNECT request here
|
17797
|
44 |
@@ -528,6 +542,7 @@
|
17633
|
45 |
{
|
|
46 |
if (PR_GetError() != PR_WOULD_BLOCK_ERROR) {
|
|
47 |
client_error = true;
|
|
48 |
+ socketErrorState[s] = PR_TRUE;
|
|
49 |
// We got a fatal error while writting the buffer. Clear it to break
|
|
50 |
// the main loop, we will never more be able to send it.
|
|
51 |
buffers[s2].bufferhead = buffers[s2].buffertail = buffers[s2].buffer;
|