Skip to content

Commit

Permalink
Enforce the contract in dialyzer
Browse files Browse the repository at this point in the history
  • Loading branch information
NelsonVides committed Mar 6, 2023
1 parent 27b1da7 commit 5a6a6da
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion include/mod_bosh.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@

-record(bosh_socket, {sid :: mod_bosh:sid(),
pid :: pid(),
peer :: {inet:ip_address(), inet:port_number()},
peer :: mongoose_transport:peer(),
peercert :: undefined | binary()}).
3 changes: 3 additions & 0 deletions src/c2s/mongoose_c2s.erl
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@
max_stanza_size := non_neg_integer(),
backwards_compatible_session := boolean(),
c2s_state_timeout := non_neg_integer(),
port := inet:port_number(),
ip_tuple := inet:ip_address(),
proto := tcp,
term() => term()}.

-export_type([packet/0, data/0, state/0, state/1, listener_opts/0]).
Expand Down
7 changes: 4 additions & 3 deletions src/mod_bosh_socket.erl
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,11 @@
start(HostType, Sid, Peer, PeerCert) ->
supervisor:start_child(?BOSH_SOCKET_SUP, [HostType, Sid, Peer, PeerCert]).


-spec start_link(mongooseim:host_type(), mod_bosh:sid(), mongoose_transport:peer(),
binary() | undefined) ->
'ignore' | {'error', _} | {'ok', pid()}.
start_link(HostType, Sid, Peer, PeerCert) ->
gen_fsm_compat:start_link(?MODULE, [HostType, Sid, Peer, PeerCert], []).
gen_fsm_compat:start_link(?MODULE, [{HostType, Sid, Peer, PeerCert}], []).

-spec start_supervisor() -> {ok, pid()} | {error, any()}.
start_supervisor() ->
Expand Down Expand Up @@ -193,7 +192,9 @@ get_cached_responses(Pid) ->
%% {stop, StopReason}
%% @end
%%--------------------------------------------------------------------
init([HostType, Sid, {IPTuple, Port} = Peer, PeerCert]) ->
-spec init([{mongooseim:host_type(), mod_bosh:sid(), mongoose_transport:peer(), undefined | binary()}]) ->
{ok, accumulate, state()}.
init([{HostType, Sid, Peer = {IPTuple, Port}, PeerCert}]) ->
BoshSocket = #bosh_socket{sid = Sid, pid = self(), peer = Peer, peercert = PeerCert},
C2SOpts = #{access => all,
shaper => none,
Expand Down

0 comments on commit 5a6a6da

Please sign in to comment.