aboutsummaryrefslogtreecommitdiffstats
path: root/test/http_handler_long_polling.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2013-02-11 09:03:13 +0100
committerLoïc Hoguin <[email protected]>2013-02-11 09:03:13 +0100
commit40b8d0befcd8b310a7a48e07df7d629153903cca (patch)
treeedd79574d4a9f6f01fbafe9295814dccd9528e52 /test/http_handler_long_polling.erl
parent65ed13d2da2e6bab65fcde7db2e46060c33be71f (diff)
downloadcowboy-40b8d0befcd8b310a7a48e07df7d629153903cca.tar.gz
cowboy-40b8d0befcd8b310a7a48e07df7d629153903cca.tar.bz2
cowboy-40b8d0befcd8b310a7a48e07df7d629153903cca.zip
Better handle socket closing with loop handlers
We now read from the socket to be able to detect errors or TCP close events, and buffer the data if any. Once the data receive goes over a certain limit, which defaults to 5000 bytes, we simply close the connection with an {error, overflow} reason.
Diffstat (limited to 'test/http_handler_long_polling.erl')
-rw-r--r--test/http_handler_long_polling.erl2
1 files changed, 2 insertions, 0 deletions
diff --git a/test/http_handler_long_polling.erl b/test/http_handler_long_polling.erl
index 763e1fe..e8cf610 100644
--- a/test/http_handler_long_polling.erl
+++ b/test/http_handler_long_polling.erl
@@ -19,4 +19,6 @@ info(timeout, Req, State) ->
{loop, Req, State - 1, hibernate}.
terminate({normal, shutdown}, _, _) ->
+ ok;
+terminate({error, overflow}, _, _) ->
ok.