On Mon, Jan 12, 2015 at 12:22 PM, Philip Martin
<philip.martin_at_wandisco.com> wrote:
> Lieven Govaerts <lgo_at_mobsol.be> writes:
>
>> You're trying to capture the situation where serf has:
>> - finished writing a request ( req_bkt == NULL && writing_started )
>> - has no more requests in the pending queue
>> - and receives actual bytes of data.
>> Right?
>>
>> Looks like your patch is a correct way to fix the problem. Some
>> comments would be welcome, and if you have the time a test.
>
> I'm not familiar with serf's testsuite. The scenario:
>
> - client sends first request
> - server sends response
> - server sends extra data, say '\n'
> - client handles first request
> - client creates a second request
> - client calls serf to send second, pipelined, request
Is there a reason you specifically mention pipelined here? The first
response has been handled so it's just synchronous communication.
> - serf reads extra data
> - serf attempts to pass the extra data to client's callbacks
>
> At this point serf has not called setup_request so although the client
> has created a request is not ready to receive data.
Ok, clear.
> How do I go about writing such a test?
The easiest way is to use existing tests as a starting point.:
- Test test_serf_connection_request_create sends 2 requests and responses.
This tests sends two pipelined requests, but you can modifiy it to
send the 1st request, then run the serf loop, then send the 2nd
request.
- To add the extra data to the response of the first request, you'll
have to create the raw response body.
Have a look at test test_request_timeout, line:
Respond(WithRawData(RESPONSE_408, strlen(RESPONSE_408)))
hth,
Lieven
>
> --
> Philip Martin | Subversion Committer
> WANdisco // *Non-Stop Data*
>
Received on 2015-01-12 15:12:09 CET