Skip to content

Commit

Permalink
Replies for already terminated client are ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
joergen7 committed Aug 27, 2018
1 parent 63cc38c commit 7f5a8d5
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/cre_client.erl
Original file line number Diff line number Diff line change
Expand Up @@ -166,18 +166,23 @@ handle_call( _Request, _From, ClientState ) ->
handle_cast( {cre_reply, From, A, Delta}, ClientState ) ->

#client_state{ reply_map = ReplyMap,
state_map = #{ From := State } } = ClientState,
state_map = StateMap } = ClientState,

case State of
idle -> start_timer( From );
_ -> ok
end,
ClientState1 =
case StateMap of
#{ From := State } ->
case State of
idle -> start_timer( From );
_ -> ok
end,

#{ From := ReplyLst } = ReplyMap,
#{ From := ReplyLst } = ReplyMap,

ClientState1 =
ClientState#client_state{ reply_map = ReplyMap#{ From => [{A, Delta}|ReplyLst] },
state_map = #{ From => primed } },
ClientState#client_state{ reply_map = ReplyMap#{ From => [{A, Delta}|ReplyLst] },
state_map = #{ From => primed } };

_ -> ClientState
end,

{noreply, ClientState1};

Expand Down

0 comments on commit 7f5a8d5

Please sign in to comment.