Skip to content
This repository has been archived by the owner on Nov 2, 2021. It is now read-only.

Uw service pack 0613 #101

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions components/authorize/src/authorize_keys.erl
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,12 @@ normalize_conn(local) ->
local;
normalize_conn({IP, Port} = Conn) when is_binary(IP), is_binary(Port) ->
Conn;
normalize_conn({{A,B,C,D}, Port}) ->
{iolist_to_binary([integer_to_binary(A),<<".">>,
integer_to_binary(B),<<".">>,
integer_to_binary(C),<<".">>,
integer_to_binary(D)]),
to_bin(Port)};
normalize_conn({IP, Port}) ->
{to_bin(IP), to_bin(Port)}.

Expand Down
2 changes: 1 addition & 1 deletion components/authorize/src/authorize_rpc.erl
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ get_credentials(CompSpec) ->

remove_connection(CompSpec, Conn) ->
rvi_common:notification(authorize, ?MODULE, remove_connection,
[{conn, Conn}], [status], CompSpec).
[{conn, Conn}], CompSpec).

store_creds(CompSpec, Creds, Conn) ->
store_creds(CompSpec, Creds, Conn, undefined).
Expand Down
4 changes: 0 additions & 4 deletions components/dlink_tcp/src/connection.erl
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,6 @@ handle_call(_Request, _From, State) ->
%% @end
%%--------------------------------------------------------------------
handle_cast({send, Data}, #st{packet_mod = PMod, packet_st = PSt} = St) ->
?debug("~p:handle_cast(send): Sending: ~p",
[ ?MODULE, Data]),
{ok, Encoded, PSt1} = PMod:encode(Data, PSt),
gen_tcp:send(St#st.sock, Encoded),

Expand All @@ -212,8 +210,6 @@ handle_cast({send, Data, Opts}, #st{sock = Socket,
packet_mod = PMod,
packet_st = PSt,
frag_opts = FragOpts} = St) ->
?debug("handle_cast({send, Data, ~p, ...), FragOpts = ~p",
[Opts, FragOpts]),
{ok, Bin, PSt1} = PMod:encode(Data, PSt),
St1 = St#st{packet_st = PSt1},
rvi_frag:send(Bin, Opts ++ FragOpts, ?MODULE,
Expand Down
11 changes: 10 additions & 1 deletion components/dlink_tls/src/dlink_tls_conn.erl
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
-export([is_connection_up/2]).
-export([terminate_connection/1]).
-export([terminate_connection/2]).
-export([publish_node_id/3]).


-define(SERVER, ?MODULE).
Expand Down Expand Up @@ -127,6 +128,9 @@ is_connection_up(IP, Port) ->
false
end.

publish_node_id(FromPid, NodeId, Cs) ->
gen_server:cast(FromPid, {publish_node_id, NodeId, Cs}).

%%%===================================================================
%%% gen_server callbacks
%%%===================================================================
Expand Down Expand Up @@ -264,7 +268,12 @@ handle_cast({activate_socket, Sock}, #st{} = State) ->
Res = inet:setopts(Sock, [{active, once}]),
?debug("connection:activate_socket(): ~p", [Res]),
{noreply, State};

handle_cast({publish_node_id, NodeId, Cs}, #st{} = St) ->
?debug("publish_node_id (~p)", [NodeId]),
%% Do this from the connection process, so that schedule_rpc can
%% monitor the connection and unpublish when it goes away.
schedule_rpc:publish_node_id(Cs, NodeId, dlink_tls_rpc),
{noreply, St};

handle_cast(_Msg, #st{} = State) ->
?warning("~p:handle_cast(): Unknown cast: ~p~nSt=~p", [ ?MODULE, _Msg, State]),
Expand Down
12 changes: 8 additions & 4 deletions components/dlink_tls/src/dlink_tls_connmgr.erl
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,27 @@
%%%===================================================================

add_connection(IP, Port, Pid) ->
gen_server:call(?SERVER, { add_connection, IP, Port, Pid}).
gen_server:call(?SERVER, { add_connection, ip(IP), Port, Pid}).

delete_connection_by_pid(Pid) ->
gen_server:call(?SERVER, { delete_connection_by_pid, Pid } ).

delete_connection_by_address(IP, Port) ->
gen_server:call(?SERVER, { delete_connection_by_address, IP, Port } ).
gen_server:call(?SERVER, { delete_connection_by_address, ip(IP), Port } ).

find_connection_by_pid(Pid) ->
gen_server:call(?SERVER, { find_connection_by_pid, Pid } ).

find_connection_by_address(IP, Port) ->
gen_server:call(?SERVER, { find_connection_by_address, IP, Port } ).
gen_server:call(?SERVER, { find_connection_by_address, ip(IP), Port } ).

connections() ->
gen_server:call(?SERVER, connections).

ip(IP) ->
{ok, Addr} = inet:ip(IP),
Addr.

%%--------------------------------------------------------------------
%% @doc
%% Starts the server
Expand Down Expand Up @@ -181,7 +185,7 @@ handle_call({find_connection_by_address, IP, Port}, _From, St) ->
end;

handle_call(connections, _From, St) ->
{reply, ets_select(?ADDR_TAB, [{ {'$1','_'}, [], ['$1'] }]), St};
{reply, ets_select(?ADDR_TAB, [{ '_', [], ['$_'] }]), St};

handle_call(_Request, _From, State) ->
?warning("~p:handle_call(): Unknown call: ~p", [ ?MODULE, _Request]),
Expand Down
Loading