mirror of
https://github.com/valitydev/woody_erlang.git
synced 2024-11-06 02:15:19 +00:00
HG-534: Fix 'unknown message error' in event handler (#130)
* HG-534: Fix 'unknown message error' in event handler * Revert "HG-534: Fix 'unknown message error' in event handler" This reverts commit efd6c51129adeca1369296f360f3e931732f5c76. * HG-534: Fix unknown message error * More accurate test * Fix lint error
This commit is contained in:
parent
ed644d7d70
commit
d55dbf551a
@ -59,13 +59,23 @@ info(StreamID, Info, #{next := Next0} = State) ->
|
||||
terminate(
|
||||
StreamID,
|
||||
{socket_error, _, HumanReadable} = Reason,
|
||||
#{woody_state := WoodyState, next := Next, event_to_emit:= Event}
|
||||
#{woody_state := WoodyState, next := Next, event_to_emit := Event = ?EV_SERVER_RECEIVE}
|
||||
) ->
|
||||
woody_event_handler:handle_event(Event,
|
||||
WoodyState,
|
||||
#{status => error, reason => woody_util:to_binary(HumanReadable)}
|
||||
),
|
||||
cowboy_stream:terminate(StreamID, Reason, Next);
|
||||
terminate(
|
||||
StreamID,
|
||||
{socket_error, _, HumanReadable} = Reason,
|
||||
#{woody_state := WoodyState, next := Next, event_to_emit := Event = ?EV_SERVICE_HANDLER_RESULT}
|
||||
) ->
|
||||
woody_event_handler:handle_event(Event,
|
||||
WoodyState,
|
||||
#{status => error, class => system, result => woody_util:to_binary(HumanReadable)}
|
||||
),
|
||||
cowboy_stream:terminate(StreamID, Reason, Next);
|
||||
terminate(StreamID, Reason, #{next := Next}) ->
|
||||
cowboy_stream:terminate(StreamID, Reason, Next).
|
||||
|
||||
|
@ -65,12 +65,15 @@ init(_) ->
|
||||
|
||||
-spec handle_call({event(), rpc_id(), event_meta(), options()}, _, state()) ->
|
||||
{reply, ok | {ok, pos_integer()}, state()}.
|
||||
handle_call({Event, Rpc, #{status := error, reason := ?SOCKET_CLOSED} = Meta, Opts}, _, #{
|
||||
handle_call({Event = ?EV_SERVICE_HANDLER_RESULT, Rpc,
|
||||
#{status := error, class := system, result := ?SOCKET_CLOSED} = Meta, Opts}, _, #{
|
||||
socket_errors_caught := Caught
|
||||
} = State) when
|
||||
Event =:= ?EV_SERVICE_HANDLER_RESULT orelse
|
||||
Event =:= ?EV_SERVER_RECEIVE
|
||||
->
|
||||
} = State) ->
|
||||
woody_tests_SUITE:handle_event(Event, Rpc, Meta, Opts),
|
||||
{reply, ok, State#{socket_errors_caught => Caught + 1}};
|
||||
handle_call({Event = ?EV_SERVER_RECEIVE, Rpc, #{status := error, reason := ?SOCKET_CLOSED} = Meta, Opts}, _, #{
|
||||
socket_errors_caught := Caught
|
||||
} = State) ->
|
||||
woody_tests_SUITE:handle_event(Event, Rpc, Meta, Opts),
|
||||
{reply, ok, State#{socket_errors_caught => Caught + 1}};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user