From d967054a9fed9e639747d8105af0a7eb98a39763 Mon Sep 17 00:00:00 2001 From: Evgeniy Khramtsov Date: Mon, 10 Aug 2009 02:20:05 +0000 Subject: [PATCH] do not forget to close TLS socket SVN Revision: 2451 --- src/stun/ejabberd_stun.erl | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/stun/ejabberd_stun.erl b/src/stun/ejabberd_stun.erl index ca880c175..d5085821f 100644 --- a/src/stun/ejabberd_stun.erl +++ b/src/stun/ejabberd_stun.erl @@ -143,15 +143,14 @@ handle_info({tcp, Sock, TLSData}, wait_for_tls, State) -> <<_:16, 1, _/binary>> -> TLSOpts = [{certfile, State#state.certfile}], {ok, TLSSock} = tls:tcp_to_tls(Sock, TLSOpts), + NewState = State#state{sock = TLSSock, + buf = <<>>, + sock_mod = tls}, case tls:recv_data(TLSSock, Buf) of {ok, Data} -> - process_data(session_established, - State#state{sock = TLSSock, - buf = <<>>, - sock_mod = tls}, - Data); + process_data(session_established, NewState, Data); _Err -> - {stop, normal, State} + {stop, normal, NewState} end; _ -> process_data(session_established, State, TLSData)