mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-26 17:38:45 +01:00
Do read piefxis file fully before starting processing included file
Previous method of processing files, could lead to mixing events generated by parsers for multiple files, where we could get in inconsistant state. After this change we gather all events generated by parser for single file, before we start parsing any included file. This fixes issue #3166
This commit is contained in:
parent
9e1973a238
commit
a19fdb717b
@ -296,17 +296,26 @@ process(#state{xml_stream_state = XMLStreamState, fd = Fd} = State) ->
|
||||
end.
|
||||
|
||||
process_els(State) ->
|
||||
Els = gather_els(State, []),
|
||||
process_els(State, lists:reverse(Els)).
|
||||
|
||||
gather_els(State, List) ->
|
||||
receive
|
||||
{'$gen_event', El} ->
|
||||
gather_els(State, [El | List])
|
||||
after 0 ->
|
||||
List
|
||||
end.
|
||||
|
||||
process_els(State, [El | Tail]) ->
|
||||
case process_el(El, State) of
|
||||
{ok, NewState} ->
|
||||
process_els(NewState);
|
||||
process_els(NewState, Tail);
|
||||
Err ->
|
||||
Err
|
||||
end
|
||||
after 0 ->
|
||||
{ok, State}
|
||||
end.
|
||||
end;
|
||||
process_els(State, []) ->
|
||||
{ok, State}.
|
||||
|
||||
process_el({xmlstreamstart, <<"server-data">>, Attrs}, State) ->
|
||||
case fxml:get_attr_s(<<"xmlns">>, Attrs) of
|
||||
|
Loading…
Reference in New Issue
Block a user