From 94b23482a98f92e65dcfbf9c0485519b5160d8a4 Mon Sep 17 00:00:00 2001 From: Evgeniy Khramtsov Date: Sat, 21 Jan 2017 10:47:55 +0300 Subject: [PATCH] Send in correct order --- src/xmpp_stream_in.erl | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) 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'})