sockjs / sockjs-erlang

WebSocket emulation - Erlang server
http://sockjs.org
Other
266 stars 120 forks source link

Dev #18

Closed rounce closed 12 years ago

rounce commented 12 years ago

tiny commits

majek commented 12 years ago

Merged, but I removed this changed:

handle_info(heartbeat_triggered, State) -> {stop, normal, State};

I guess you're fighting some exception. This solution is not obviously correct - in theory heartbeat_tref is only set when response_pid !== undefined. Please explain when this assertion is broken.

rounce commented 12 years ago

in theory heartbeat_tref is only set when response_pid !== undefined.

It's true. However State can vary between mark_waiting and heartbeat_triggered.

** When Server state == {session,undefined,
                            {[],[]},
                            undefined,#Ref<0.0.19.86335>,5000,undefined,25000,
                            open,undefined,#Fun<k.0.64006013>,state,
                            {sockjs_session,
                                {<0.20760.6>,
                                 [{peername,{{},4337}},
                                  {sockname,{{},9000}},
                                  {path,"/user/203/c6fgiiqi/websocket"},
                                  {headers,[]}]}}}

I suppose the timing is wrong. unmark_waiting cancel timer, but

http://www.erlang.org/documentation/doc-5.3.6.13/lib/kernel-2.9.6.12/doc/html/erlang.html Note: usually, cancelling a timer does not guarantee that the message has not already been delivered to the message queue.

I'll try https://github.com/rounce/sockjs-erlang/commit/77320452c2707f1c330e0a3cbe9618886975e1d6