25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +01:00

* src/ejabberd_receiver.erl: Avoid crash to appear in log, when trying to close a stream with an undefined state.

SVN Revision: 1182
This commit is contained in:
Mickaël Rémond 2008-02-11 15:36:56 +00:00
parent 7f6cdc6cfe
commit 4b5632a260
2 changed files with 13 additions and 9 deletions

View File

@ -1,3 +1,8 @@
2008-02-11 Mickael Remond <mremond@process-one.net>
* src/ejabberd_receiver.erl: Avoid crash to appear in log, when
trying to close a stream with an undefined state.
2008-02-11 Christophe Romain <christophe.romain@process-one.net>
* src/mod_pubsub/mod_pubsub.erl: Bugfix: event used in place of x when

View File

@ -134,12 +134,7 @@ handle_call({starttls, TLSSocket}, _From,
#state{xml_stream_state = XMLStreamState,
c2s_pid = C2SPid,
max_stanza_size = MaxStanzaSize} = State) ->
if
XMLStreamState /= undefined ->
xml_stream:close(XMLStreamState);
true ->
ok
end,
close_stream(XMLStreamState),
NewXMLStreamState = xml_stream:new(C2SPid, MaxStanzaSize),
NewState = State#state{socket = TLSSocket,
sock_mod = tls,
@ -154,7 +149,7 @@ handle_call({compress, ZlibSocket}, _From,
#state{xml_stream_state = XMLStreamState,
c2s_pid = C2SPid,
max_stanza_size = MaxStanzaSize} = State) ->
xml_stream:close(XMLStreamState),
close_stream(XMLStreamState),
NewXMLStreamState = xml_stream:new(C2SPid, MaxStanzaSize),
NewState = State#state{socket = ZlibSocket,
sock_mod = ejabberd_zlib,
@ -169,7 +164,7 @@ handle_call(reset_stream, _From,
#state{xml_stream_state = XMLStreamState,
c2s_pid = C2SPid,
max_stanza_size = MaxStanzaSize} = State) ->
xml_stream:close(XMLStreamState),
close_stream(XMLStreamState),
NewXMLStreamState = xml_stream:new(C2SPid, MaxStanzaSize),
Reply = ok,
{reply, Reply, State#state{xml_stream_state = NewXMLStreamState}};
@ -252,7 +247,7 @@ handle_info(_Info, State) ->
%%--------------------------------------------------------------------
terminate(_Reason, #state{xml_stream_state = XMLStreamState,
c2s_pid = C2SPid} = State) ->
xml_stream:close(XMLStreamState),
close_stream(XMLStreamState),
if
C2SPid /= undefined ->
gen_fsm:send_event(C2SPid, closed);
@ -306,3 +301,7 @@ process_data(Data,
State#state{xml_stream_state = XMLStreamState1,
shaper_state = NewShaperState}.
close_stream(undefined) ->
ok;
close_stream(XMLStreamState) ->
xml_stream:close(XMLStreamState).