25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

Make dialyzer happy

This commit is contained in:
Paweł Chmielowski 2023-01-13 20:34:49 +01:00
parent 4311a5646f
commit 5592f8df1a

View File

@ -128,6 +128,8 @@ handle_cast(Msg, State) ->
?WARNING_MSG("Unexpected cast: ~p", [Msg]), ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
{noreply, State}. {noreply, State}.
-spec handle_info(term(), state()) ->
{noreply, state()} | {noreply, state(), timeout()} | {stop, term(), state()}.
handle_info({Tag, TCPSock, TCPData}, handle_info({Tag, TCPSock, TCPData},
#state{ws_codec = {init, Hash, Auth, Last}} = State) #state{ws_codec = {init, Hash, Auth, Last}} = State)
when (Tag == tcp orelse Tag == ssl) -> when (Tag == tcp orelse Tag == ssl) ->
@ -191,30 +193,26 @@ handle_info({Tag, TCPSock, TCPData},
{Packets, Acc0} = {Packets, Acc0} =
case ejabberd_websocket_codec:decode(WSCodec, TCPData) of case ejabberd_websocket_codec:decode(WSCodec, TCPData) of
{ok, NewWSCodec, Packets0} -> {ok, NewWSCodec, Packets0} ->
{Packets0, {State#state{ws_codec = NewWSCodec}, ok}}; {Packets0, {noreply, ok, State#state{ws_codec = NewWSCodec}}};
{error, _Error, Packets0} -> {error, _Error, Packets0} ->
{Packets0, {State, stop}} {Packets0, {stop_after, {socket, closed}, State}}
end, end,
Res2 = Res2 =
lists:foldl( lists:foldl(
fun(_, {stop, _, _} = Res) -> Res; fun(_, {stop, _, _} = Res) -> Res;
({_Op, Data}, {S, Res}) -> ({_Op, Data}, {Tag, Res, S}) ->
case handle_info({tcp_decoded, TCPSock, Data}, S) of case handle_info({tcp_decoded, TCPSock, Data}, S) of
{stop, _, _} = Stop -> {stop, _, _} = Stop ->
Stop; Stop;
{_, NewState, _} ->
{NewState, Res};
{_, NewState} -> {_, NewState} ->
{NewState, Res} {Tag, Res, NewState}
end end
end, Acc0, Packets), end, Acc0, Packets),
case Res2 of case Res2 of
{stop, _, _} -> {noreply, _, State} ->
Res2; {noreply, State};
{NewState2, ok} -> _ ->
{noreply, NewState2}; Res2
{NewState2, stop} ->
stop(NewState2, {socket, closed})
end; end;
handle_info({Tag, TCPSock, TCPData}, handle_info({Tag, TCPSock, TCPData},
#state{codec = Codec} = State) #state{codec = Codec} = State)