To prevent missing disconnect events, i_stream_read() is called once a change in ioloop is detected.
However, if something was actually read into the stream, the input handler was never called.
So, a response could linger in the stream buffer, without being handled, thereby causing the connection to hang indefinitely.
An additional input event could end the hang, but sometimes this doesn't happen before the request times out.
This problem was seen in test-http-payload once in about 10 invocations.
Obox uses nested ioloops, to this applies there.
"EOF"));
return -1;
}
+
+ /* we may have read some data */
+ if (i_stream_get_data_size(conn->conn.input) > 0)
+ i_stream_set_input_pending(conn->conn.input, TRUE);
}
return 1;
}