Skip to content

Commit

Permalink
Fix handling of the undefined host type for stream errors
Browse files Browse the repository at this point in the history
Stream errors are often sent before the host type is known.
The 'host_type' in the c2s state is then undefined, not '<<>>'.

By fixing this line:
- There are no more errors in the logs about running hooks for
  undefined host type.
- The line should be covered by the tests now.
  • Loading branch information
chrzaszcz committed Jul 3, 2023
1 parent 6021247 commit 3f3dae4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/c2s/mongoose_c2s.erl
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,7 @@ sm_unset_reason(_) ->

%% @doc This is the termination point - from here stanza is sent to the user
-spec do_send_element(data(), exml:element(), mongoose_acc:t()) -> mongoose_acc:t().
do_send_element(StateData = #c2s_data{host_type = <<>>}, El, Acc) ->
do_send_element(StateData = #c2s_data{host_type = undefined}, El, Acc) ->
send_xml(StateData, El),
Acc;
do_send_element(StateData = #c2s_data{host_type = HostType}, #xmlel{} = El, Acc) ->
Expand Down

0 comments on commit 3f3dae4

Please sign in to comment.