mirror of
https://github.com/processone/ejabberd.git
synced 2024-06-14 22:00:16 +02:00
Make sure that we send each time <close> before closing websocket connection
This commit is contained in:
parent
d9ad26b4ec
commit
de26af3fdb
|
@ -187,7 +187,19 @@ handle_sync_event({send_xml, Packet}, _From, StateName,
|
|||
skip ->
|
||||
ok
|
||||
end,
|
||||
{reply, ok, StateName, StateData};
|
||||
SN2 = case Packet2 of
|
||||
{xmlstreamelement, #xmlel{name = <<"close">>}} ->
|
||||
stream_end_sent;
|
||||
_ ->
|
||||
StateName
|
||||
end,
|
||||
{reply, ok, SN2, StateData};
|
||||
handle_sync_event(close, _From, StateName, #state{ws = {_, WsPid}, rfc_compilant = true} = StateData)
|
||||
when StateName /= stream_end_sent ->
|
||||
Close = #xmlel{name = <<"close">>,
|
||||
attrs = [{<<"xmlns">>, <<"urn:ietf:params:xml:ns:xmpp-framing">>}]},
|
||||
WsPid ! {send, xml:element_to_binary(Close)},
|
||||
{stop, normal, StateData};
|
||||
handle_sync_event(close, _From, _StateName, StateData) ->
|
||||
{stop, normal, StateData}.
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user