From 89f948aeaef34114ec61291ff8ffbebcf85a748e Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 11 Jan 2011 16:01:20 -0800 Subject: event_machine: buffer reads when waiting for async.callback We cannot trigger on_read events and invoke the HTTP parser and modify @env while we're waiting for an application to run async.callback. We also need to clear (and *maybe* re-set) @deferred if we're writing from async.callback --- t/t0402-async-keepalive.sh | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/t0402-async-keepalive.sh b/t/t0402-async-keepalive.sh index fdf4cbc..7b7b2e7 100644 --- a/t/t0402-async-keepalive.sh +++ b/t/t0402-async-keepalive.sh @@ -9,7 +9,7 @@ Coolio|NeverBlock|EventMachine) ;; ;; esac -t_plan 11 "async_chunk_app test for test for $model" +t_plan 12 "async_chunk_app test for test for $model" CONFIG_RU=async_chunk_app.ru @@ -44,6 +44,26 @@ t_begin "async.callback supports pipelining" && { test 3 -eq "$(grep 'World ' $tmp | wc -l)" } +t_begin "async.callback supports delayed pipelining" && { + rm -f $tmp + t0=$(date +%s) + ( + cat $fifo > $tmp & + printf 'GET /0 HTTP/1.1\r\nHost: example.com\r\n\r\n' + sleep 1 + printf 'GET /1 HTTP/1.1\r\nHost: example.com\r\n\r\n' + sleep 1 + printf 'GET /2 HTTP/1.0\r\nHost: example.com\r\n\r\n' + wait + ) | socat - TCP:$listen > $fifo + t1=$(date +%s) + elapsed=$(( $t1 - $t0 )) + t_info "elapsed=$elapsed $model.$0 ($t_current)" + test 3 -eq "$(fgrep 'HTTP/1.1 200 OK' $tmp | wc -l)" + test 3 -eq "$(grep '^Hello ' $tmp | wc -l)" + test 3 -eq "$(grep 'World ' $tmp | wc -l)" +} + t_begin "async.callback supports pipelining with delay $DELAY" && { rm -f $tmp t0=$(date +%s) -- cgit v1.2.3-24-ge0c7