Author: rhuijben Date: Tue Oct 20 16:38:25 2015 New Revision: 1709641 URL: http://svn.apache.org/viewvc?rev=1709641&view=rev Log: Following up on r1709631, remove another dependency between EOF and error handling by properly resetting hit_eof before reading again.
This allows removing a dependency on the read result before checking the value... which most likely gave the right result most of the time, but I'm not sure if it always did. The SSL tests often triggered the case that the value was already set. * serf-dev/dev/outgoing.c (write_to_connection): Reset hit_eof before potentially setting it again instead of only resetting it when marking a request as completed. Modified: serf/trunk/outgoing.c Modified: serf/trunk/outgoing.c URL: http://svn.apache.org/viewvc/serf/trunk/outgoing.c?rev=1709641&r1=1709640&r2=1709641&view=diff ============================================================================== --- serf/trunk/outgoing.c (original) +++ serf/trunk/outgoing.c Tue Oct 20 16:38:25 2015 @@ -806,6 +806,7 @@ static apr_status_t write_to_connection( data as available, we probably don't want to read ALL_AVAIL, but a lower number, like the size of one or a few TCP packets, the available TCP buffer size ... */ + conn->hit_eof = 0; read_status = serf_bucket_read_iovec(ostreamh, SERF_READ_ALL_AVAIL, IOV_MAX, @@ -852,8 +853,7 @@ static apr_status_t write_to_connection( if (read_status == SERF_ERROR_WAIT_CONN) { stop_reading = 1; } - else if (request && read_status && conn->hit_eof && - conn->vec_len == 0) { + else if (request && conn->hit_eof && conn->vec_len == 0) { /* If we hit the end of the request bucket and all of its data has * been written, then clear it out to signify that we're done * sending the request. On the next iteration through this loop: @@ -862,7 +862,6 @@ static apr_status_t write_to_connection( * - we'll see if there are other requests that need to be sent * ("pipelining"). */ - conn->hit_eof = 0; serf_bucket_destroy(request->req_bkt); request->req_bkt = NULL;