24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-06-10 21:47:01 +02:00

Send <compressed/> in correct order

This commit is contained in:
Evgeniy Khramtsov 2017-01-21 10:47:55 +03:00
parent 1e968f5487
commit 94b23482a9

View File

@ -696,22 +696,22 @@ process_compress(#compress{methods = HisMethods},
CommonMethods = lists_intersection(MyMethods, HisMethods), CommonMethods = lists_intersection(MyMethods, HisMethods),
case lists:member(<<"zlib">>, CommonMethods) of case lists:member(<<"zlib">>, CommonMethods) of
true -> true ->
State1 = send_pkt(State, #compressed{}), case SockMod:compress(Socket) of
case is_disconnected(State1) of {ok, ZlibSocket} ->
true -> State1; State1 = send_pkt(State, #compressed{}),
false -> case is_disconnected(State1) of
case SockMod:compress(Socket) of true -> State1;
{ok, ZlibSocket} -> false ->
State1#{socket => ZlibSocket, State1#{socket => ZlibSocket,
stream_id => new_id(), stream_id => new_id(),
stream_header_sent => false, stream_header_sent => false,
stream_restarted => true, stream_restarted => true,
stream_state => wait_for_stream, stream_state => wait_for_stream,
stream_compressed => true}; stream_compressed => true}
{error, _} -> end;
Err = #compress_failure{reason = 'setup-failed'}, {error, _} ->
send_pkt(State1, Err) Err = #compress_failure{reason = 'setup-failed'},
end send_pkt(State, Err)
end; end;
false -> false ->
send_pkt(State, #compress_failure{reason = 'unsupported-method'}) send_pkt(State, #compress_failure{reason = 'unsupported-method'})