JID,
case ejabberd_sm:get_session_pid(User, Server, Resource)
of
- Pid when is_pid(Pid) -> ejabberd_c2s:close(Pid);
+ Pid when is_pid(Pid) -> ejabberd_c2s:close(Pid, _SendTrailer = false);
_ -> ok
end;
_ -> ok
noreply(send_pkt(State, Pkt));
handle_cast(stop, State) ->
{stop, normal, State};
+handle_cast({close, SendTrailer}, #{mod := Mod} = State) ->
+ noreply(
+ case is_disconnected(State) of
+ true -> State;
+ false ->
+ State1 = close(State, SendTrailer),
+ try Mod:handle_stream_end({socket, closed}, State1)
+ catch _:undef -> stop(State1)
+ end
+ end);
handle_cast(Cast, #{mod := Mod} = State) ->
noreply(try Mod:handle_cast(Cast, State)
catch _:undef -> State
noreply(send_pkt(State, Pkt));
handle_cast(stop, State) ->
{stop, normal, State};
+handle_cast({close, SendTrailer}, #{mod := Mod} = State) ->
+ noreply(
+ case is_disconnected(State) of
+ true -> State;
+ false ->
+ State1 = close(State, SendTrailer),
+ try Mod:handle_stream_end({socket, closed}, State1)
+ catch _:undef -> stop(State1)
+ end
+ end);
handle_cast(Cast, #{mod := Mod} = State) ->
noreply(try Mod:handle_cast(Cast, State)
catch _:undef -> State