Skip to content

Commit

Permalink
Rename once again.
Browse files Browse the repository at this point in the history
  • Loading branch information
majek committed Feb 10, 2012
1 parent cd30776 commit 5cb09d5
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/sockjs_session.erl
Expand Up @@ -14,7 +14,7 @@
-record(session, {id :: session() | undefined,
outbound_queue = queue:new(),
response_pid,
session_tref,
disconnect_tref,
disconnect_delay,
ready_state = connecting,
close_msg,
Expand Down Expand Up @@ -91,22 +91,22 @@ spid(SessionId) ->
[{_, SPid}] -> SPid
end.

mark_waiting(Pid, State = #session{response_pid = undefined,
session_tref = Ref}) ->
mark_waiting(Pid, State = #session{response_pid = undefined,
disconnect_tref = Ref}) ->
link(Pid),
_ = case Ref of
undefined -> ok;
_ -> erlang:cancel_timer(Ref)
end,
State#session{response_pid = Pid,
session_tref = undefined};
mark_waiting(Pid, State = #session{response_pid = Pid,
session_tref = undefined}) ->
State#session{response_pid = Pid,
disconnect_tref = undefined};
mark_waiting(Pid, State = #session{response_pid = Pid,
disconnect_tref = undefined}) ->
%% The same process may ask for messages multiple times.
State.

unmark_waiting(State = #session{response_pid = RPid,
session_tref = undefined,
unmark_waiting(State = #session{response_pid = RPid,
disconnect_tref = undefined,
disconnect_delay = DisconnectDelay}) ->
case RPid of
undefined -> ok;
Expand All @@ -115,13 +115,13 @@ unmark_waiting(State = #session{response_pid = RPid,
end,
Ref = erlang:send_after(DisconnectDelay, self(), session_timeout),
State#session{response_pid = undefined,
session_tref = Ref};
unmark_waiting(State = #session{response_pid = undefined,
session_tref = Ref,
disconnect_tref = Ref};
unmark_waiting(State = #session{response_pid = undefined,
disconnect_tref = Ref,
disconnect_delay = DisconnectDelay}) ->
_ = erlang:cancel_timer(Ref),
Ref1 = erlang:send_after(DisconnectDelay, self(), session_timeout),
State#session{session_tref = Ref1}.
State#session{disconnect_tref = Ref1}.

emit(What, #session{callback = Callback,
handle = Handle}) ->
Expand Down

0 comments on commit 5cb09d5

Please sign in to comment.