Permalink
Browse files

Add error-checking to sockjs_filers:reply_loop to detect disconnection

  • Loading branch information...
1 parent 9c14c5c commit e51adf506e12e24a1c7a4ca2e9b39c5d35eb16a0 @sridatta sridatta committed Feb 2, 2012
Showing with 8 additions and 2 deletions.
  1. +8 −2 src/sockjs_filters.erl
View
@@ -310,8 +310,14 @@ reply_loop(Req, SessionId, Once, Fmt) ->
wait -> receive
go -> reply_loop(Req, SessionId, Once, Fmt)
after Heartbeat ->
- chunk(Req, <<"h">>, Fmt),
- reply_loop0(Req, SessionId, Once, Fmt)
+ % connection might have died in the
+ % meantime. Check before proceeeding
+ case chunk(Req, <<"h">>, Fmt) of
+ ok -> reply_loop0(Req, SessionId,
+ Once, Fmt);
+ error ->
+ error
+ end
end;
session_in_use -> Err = sockjs_util:encode_list([{close, ?STILL_OPEN}]),
chunk(Req, Err, Fmt),

0 comments on commit e51adf5

Please sign in to comment.