From: Evgeniy Khramtsov Date: Sat, 21 Jan 2017 07:47:55 +0000 (+0300) Subject: Send in correct order X-Git-Tag: 17.03-beta~87 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=94b23482a98f92e65dcfbf9c0485519b5160d8a4;p=ejabberd Send in correct order --- diff --git a/src/xmpp_stream_in.erl b/src/xmpp_stream_in.erl index 63a4d4c7f..cb3dbcb66 100644 --- a/src/xmpp_stream_in.erl +++ b/src/xmpp_stream_in.erl @@ -696,22 +696,22 @@ process_compress(#compress{methods = HisMethods}, CommonMethods = lists_intersection(MyMethods, HisMethods), case lists:member(<<"zlib">>, CommonMethods) of true -> - State1 = send_pkt(State, #compressed{}), - case is_disconnected(State1) of - true -> State1; - false -> - case SockMod:compress(Socket) of - {ok, ZlibSocket} -> + case SockMod:compress(Socket) of + {ok, ZlibSocket} -> + State1 = send_pkt(State, #compressed{}), + case is_disconnected(State1) of + true -> State1; + false -> State1#{socket => ZlibSocket, stream_id => new_id(), stream_header_sent => false, stream_restarted => true, stream_state => wait_for_stream, - stream_compressed => true}; - {error, _} -> - Err = #compress_failure{reason = 'setup-failed'}, - send_pkt(State1, Err) - end + stream_compressed => true} + end; + {error, _} -> + Err = #compress_failure{reason = 'setup-failed'}, + send_pkt(State, Err) end; false -> send_pkt(State, #compress_failure{reason = 'unsupported-method'})