From cba35d3d1d6c2532f3e4340cb0936ce54bc77a6e Mon Sep 17 00:00:00 2001 From: Mariano Guerra Date: Wed, 12 Aug 2015 22:26:52 +0100 Subject: match against ok and close instead of crashing on close --- src/bullet_handler.erl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/bullet_handler.erl b/src/bullet_handler.erl index c576bda..f2fea5a 100644 --- a/src/bullet_handler.erl +++ b/src/bullet_handler.erl @@ -198,8 +198,10 @@ reply_get_mode(eventsource, Data, Req) -> Bin = iolist_to_binary(Data), Event = [[<<"data: ">>, Line, <<"\n">>] || Line <- binary:split(Bin, [<<"\r\n">>, <<"\r">>, <<"\n">>], [global])], - ok = cowboy_req:chunk([Event, <<"\n">>], Req), - {loop, Req}. + case cowboy_req:chunk([Event, <<"\n">>], Req) of + ok -> {loop, Req}; + close -> {ok, Req} + end. %% Internal. -- cgit v1.2.3