-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* * Start grpcbox server last and clients first * Fix console api to cache device req for 10s * Fix console api to not do any request unless a token is found * Avoiding multiple device updates on device worker startup * Fix dead code in dc_tracker * Avoid issues with device cache in tests * Update src/apis/router_console_api.erl Co-authored-by: Michael Jeffrey <michaeldjeffrey@gmail.com> * Update src/apis/router_console_api.erl Co-authored-by: Michael Jeffrey <michaeldjeffrey@gmail.com> * We do not need xor filter tests anymore * Fix channel_worker_SUITE * More tests fixes * Fix dialyzer * Fix devaddr in routing tests * Fix last tests * Fix ddos_joins_test --------- Co-authored-by: Michael Jeffrey <michaeldjeffrey@gmail.com>
- Loading branch information
1 parent
a380d96
commit 3835896
Showing
21 changed files
with
739 additions
and
580 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
%%%------------------------------------------------------------------- | ||
%% @doc | ||
%% @end | ||
%%%------------------------------------------------------------------- | ||
-module(router_grpc_client_worker). | ||
|
||
-behavior(gen_server). | ||
|
||
%% ------------------------------------------------------------------ | ||
%% API Function Exports | ||
%% ------------------------------------------------------------------ | ||
-export([ | ||
start_link/0 | ||
]). | ||
|
||
%% ------------------------------------------------------------------ | ||
%% gen_server Function Exports | ||
%% ------------------------------------------------------------------ | ||
-export([ | ||
init/1, | ||
handle_call/3, | ||
handle_cast/2, | ||
handle_info/2, | ||
terminate/2, | ||
code_change/3 | ||
]). | ||
|
||
-define(SERVER, ?MODULE). | ||
|
||
-record(state, {}). | ||
|
||
%% ------------------------------------------------------------------ | ||
%% API Function Definitions | ||
%% ------------------------------------------------------------------ | ||
start_link() -> | ||
gen_server:start_link({local, ?SERVER}, ?SERVER, #{}, []). | ||
|
||
%% ------------------------------------------------------------------ | ||
%% gen_server Function Definitions | ||
%% ------------------------------------------------------------------ | ||
init(_Args) -> | ||
lager:info("~p init with ~p", [?SERVER, _Args]), | ||
case application:get_env(grpcbox, client) of | ||
{ok, #{channels := Channels}} -> | ||
lists:foreach( | ||
fun({Name, Endpoints, Options}) -> | ||
R = grpcbox_channel_sup:start_child(Name, Endpoints, Options), | ||
lager:info("started ~p ~p", [{Name, Endpoints, Options}, R]) | ||
end, | ||
Channels | ||
); | ||
_ -> | ||
ok | ||
end, | ||
{ok, #state{}}. | ||
|
||
handle_call(_Msg, _From, State) -> | ||
lager:warning("rcvd unknown call msg: ~p from: ~p", [_Msg, _From]), | ||
{reply, ok, State}. | ||
|
||
handle_cast(_Msg, State) -> | ||
lager:warning("rcvd unknown cast msg: ~p", [_Msg]), | ||
{noreply, State}. | ||
|
||
handle_info(_Msg, State) -> | ||
lager:warning("rcvd unknown info msg: ~p", [_Msg]), | ||
{noreply, State}. | ||
|
||
code_change(_OldVsn, State, _Extra) -> | ||
{ok, State}. | ||
|
||
terminate(_Reason, #state{}) -> | ||
ok. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
%%%------------------------------------------------------------------- | ||
%% @doc | ||
%% @end | ||
%%%------------------------------------------------------------------- | ||
-module(router_grpc_server_worker). | ||
|
||
-behavior(gen_server). | ||
|
||
%% ------------------------------------------------------------------ | ||
%% API Function Exports | ||
%% ------------------------------------------------------------------ | ||
-export([ | ||
start_link/0 | ||
]). | ||
|
||
%% ------------------------------------------------------------------ | ||
%% gen_server Function Exports | ||
%% ------------------------------------------------------------------ | ||
-export([ | ||
init/1, | ||
handle_call/3, | ||
handle_cast/2, | ||
handle_info/2, | ||
terminate/2, | ||
code_change/3 | ||
]). | ||
|
||
-define(SERVER, ?MODULE). | ||
|
||
-record(state, {}). | ||
|
||
%% ------------------------------------------------------------------ | ||
%% API Function Definitions | ||
%% ------------------------------------------------------------------ | ||
start_link() -> | ||
gen_server:start_link({local, ?SERVER}, ?SERVER, #{}, []). | ||
|
||
%% ------------------------------------------------------------------ | ||
%% gen_server Function Definitions | ||
%% ------------------------------------------------------------------ | ||
init(_Args) -> | ||
lager:info("~p init with ~p", [?SERVER, _Args]), | ||
lists:foreach( | ||
fun(ServerOpts) -> | ||
R = grpcbox_services_simple_sup:start_child(ServerOpts), | ||
lager:info("started ~p ~p", [ServerOpts, R]) | ||
end, | ||
application:get_env(grpcbox, servers, []) | ||
), | ||
{ok, #state{}}. | ||
|
||
handle_call(_Msg, _From, State) -> | ||
lager:warning("rcvd unknown call msg: ~p from: ~p", [_Msg, _From]), | ||
{reply, ok, State}. | ||
|
||
handle_cast(_Msg, State) -> | ||
lager:warning("rcvd unknown cast msg: ~p", [_Msg]), | ||
{noreply, State}. | ||
|
||
handle_info(_Msg, State) -> | ||
lager:warning("rcvd unknown info msg: ~p", [_Msg]), | ||
{noreply, State}. | ||
|
||
code_change(_OldVsn, State, _Extra) -> | ||
{ok, State}. | ||
|
||
terminate(_Reason, #state{}) -> | ||
ok. | ||
|
||
%% ------------------------------------------------------------------ | ||
%% Internal Function Definitions | ||
%% ------------------------------------------------------------------ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.