1
0
Fork 0
mirror of https://github.com/processone/ejabberd synced 2025-10-03 17:59:31 +02:00

Fix processing order

This commit is contained in:
Evgeniy Khramtsov 2017-12-17 20:19:44 +03:00
parent 5b42fc1d0d
commit bd1ff0e897

View file

@ -314,16 +314,10 @@ handle_info({'$gen_event', {xmlstreamstart, Name, Attrs}},
send_pkt(State1, Err) send_pkt(State1, Err)
end end
end); end);
handle_info({'$gen_event', El}, #{stream_state := wait_for_stream} = State) -> handle_info({'$gen_event', {xmlstreamend, _}}, State) ->
%% TODO: find and fix this in fast_xml noreply(process_stream_end({stream, reset}, State));
error_logger:error_msg("unexpected event from receiver: ~p; " handle_info({'$gen_event', closed}, State) ->
"xmlstreamstart was expected", [El]), noreply(process_stream_end({socket, closed}, State));
State1 = send_header(State),
noreply(
case is_disconnected(State1) of
true -> State1;
false -> send_pkt(State1, xmpp:serr_invalid_xml())
end);
handle_info({'$gen_event', {xmlstreamerror, Reason}}, #{lang := Lang}= State) -> handle_info({'$gen_event', {xmlstreamerror, Reason}}, #{lang := Lang}= State) ->
State1 = send_header(State), State1 = send_header(State),
noreply( noreply(
@ -338,6 +332,16 @@ handle_info({'$gen_event', {xmlstreamerror, Reason}}, #{lang := Lang}= State) ->
end, end,
send_pkt(State1, Err) send_pkt(State1, Err)
end); end);
handle_info({'$gen_event', El}, #{stream_state := wait_for_stream} = State) ->
%% TODO: find and fix this in fast_xml
error_logger:error_msg("unexpected event from receiver: ~p; "
"xmlstreamstart was expected", [El]),
State1 = send_header(State),
noreply(
case is_disconnected(State1) of
true -> State1;
false -> send_pkt(State1, xmpp:serr_invalid_xml())
end);
handle_info({'$gen_event', {xmlstreamelement, El}}, handle_info({'$gen_event', {xmlstreamelement, El}},
#{xmlns := NS, mod := Mod} = State) -> #{xmlns := NS, mod := Mod} = State) ->
noreply( noreply(
@ -364,10 +368,6 @@ handle_info({'$gen_all_state_event', {xmlstreamcdata, Data}},
noreply(try Mod:handle_cdata(Data, State) noreply(try Mod:handle_cdata(Data, State)
catch _:undef -> State catch _:undef -> State
end); end);
handle_info({'$gen_event', {xmlstreamend, _}}, State) ->
noreply(process_stream_end({stream, reset}, State));
handle_info({'$gen_event', closed}, State) ->
noreply(process_stream_end({socket, closed}, State));
handle_info(timeout, #{mod := Mod} = State) -> handle_info(timeout, #{mod := Mod} = State) ->
Disconnected = is_disconnected(State), Disconnected = is_disconnected(State),
noreply(try Mod:handle_timeout(State) noreply(try Mod:handle_timeout(State)