summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Wiger <ulf@feuerlabs.com>2016-03-15 15:29:04 -0700
committerUlf Wiger <ulf@feuerlabs.com>2016-03-15 15:29:04 -0700
commitc69df631f683c99e8a322a8729bc67d94a355927 (patch)
tree13b94188dd71623e1697c5ef023b250b36ae7545
parent9ec2ee22a28a273ad1ebf7d08b6938f9861551e8 (diff)
downloadrvi_core-c69df631f683c99e8a322a8729bc67d94a355927.tar.gz
fix type errors in JSON-RPC entry points
-rw-r--r--components/dlink_bt/src/dlink_bt_rpc.erl13
-rw-r--r--components/dlink_sms/src/dlink_sms_rpc.erl10
-rw-r--r--components/dlink_tcp/src/dlink_tcp_rpc.erl14
-rw-r--r--components/dlink_tls/src/dlink_tls_rpc.erl16
-rw-r--r--components/proto_bert/src/proto_bert_rpc.erl4
-rw-r--r--components/proto_json/src/proto_json_rpc.erl4
-rw-r--r--components/proto_msgpack/src/proto_msgpack_rpc.erl4
-rw-r--r--components/schedule/src/schedule_rpc.erl4
-rw-r--r--components/service_discovery/src/service_discovery_rpc.erl14
9 files changed, 42 insertions, 41 deletions
diff --git a/components/dlink_bt/src/dlink_bt_rpc.erl b/components/dlink_bt/src/dlink_bt_rpc.erl
index c4276bd..e0835f9 100644
--- a/components/dlink_bt/src/dlink_bt_rpc.erl
+++ b/components/dlink_bt/src/dlink_bt_rpc.erl
@@ -475,7 +475,7 @@ handle_socket(_FromPid, SetupBTAddr, SetupChannel, error, _ExtraArgs) ->
%% JSON-RPC entry point
%% CAlled by local exo http server
-handle_notification("service_available", Args) ->
+handle_notification(<<"service_available">>, Args) ->
{ok, SvcName} = rvi_common:get_json_element(["service"], Args),
{ok, DataLinkModule} = rvi_common:get_json_element(["data_link_module"], Args),
@@ -484,7 +484,7 @@ handle_notification("service_available", Args) ->
DataLinkModule ]}),
ok;
-handle_notification("service_unavailable", Args) ->
+handle_notification(<<"service_unavailable">>, Args) ->
{ok, SvcName} = rvi_common:get_json_element(["service"], Args),
{ok, DataLinkModule} = rvi_common:get_json_element(["data_link_module"], Args),
@@ -498,7 +498,7 @@ handle_notification(Other, _Args) ->
?info("dlink_bt:handle_notification(~p): unknown", [ Other ]),
ok.
-handle_rpc("setup_data_link", Args) ->
+handle_rpc(<<"setup_data_link">>, Args) ->
{ ok, Service } = rvi_common:get_json_element(["service"], Args),
{ ok, Opts } = rvi_common:get_json_element(["opts"], Args),
@@ -508,12 +508,12 @@ handle_rpc("setup_data_link", Args) ->
{ok, [ {status, rvi_common:json_rpc_status(Res)} , { timeout, Timeout }]};
-handle_rpc("disconenct_data_link", Args) ->
+handle_rpc(<<"disconenct_data_link">>, Args) ->
{ ok, NetworkAddress} = rvi_common:get_json_element(["network_address"], Args),
[Res] = gen_server:call(?SERVER, { rvi, disconnect_data_link, [NetworkAddress]}),
{ok, [ {status, rvi_common:json_rpc_status(Res)} ]};
-handle_rpc("send_data", Args) ->
+handle_rpc(<<"send_data">>, Args) ->
{ ok, ProtoMod } = rvi_common:get_json_element(["proto_mod"], Args),
{ ok, Service } = rvi_common:get_json_element(["service"], Args),
{ ok, Data } = rvi_common:get_json_element(["data"], Args),
@@ -602,7 +602,8 @@ handle_call({rvi, send_data, [ProtoMod, Service, Data, DataLinkOpts]}, _From, St
%% FIXME: What to do if we have multiple connections to the same service?
[ConnPid | _T] ->
- ?debug("dlink_bt:send(~p): ~s", [ProtoMod, Data]),
+ ?debug("dlink_bt:send(~p,Pid=~p[~p]): ~p",
+ [ProtoMod, ConnPid, catch is_process_alive(ConnPid), Data]),
Res = bt_connection:send(
ConnPid,
[ { ?DLINK_ARG_TRANSACTION_ID, 1 },
diff --git a/components/dlink_sms/src/dlink_sms_rpc.erl b/components/dlink_sms/src/dlink_sms_rpc.erl
index 2f20d2d..f57a88d 100644
--- a/components/dlink_sms/src/dlink_sms_rpc.erl
+++ b/components/dlink_sms/src/dlink_sms_rpc.erl
@@ -368,7 +368,7 @@ handle_sms(FromPid, Addr, data, Payload, [CompSpec]) ->
%% JSON-RPC entry point
%% CAlled by local exo http server
-handle_notification("service_available", Args) ->
+handle_notification(<<"service_available">>, Args) ->
{ok, SvcName} = rvi_common:get_json_element(["service"], Args),
{ok, DataLinkModule} = rvi_common:get_json_element(["data_link_module"], Args),
@@ -377,7 +377,7 @@ handle_notification("service_available", Args) ->
DataLinkModule ]}),
ok;
-handle_notification("service_unavailable", Args) ->
+handle_notification(<<"service_unavailable">>, Args) ->
{ok, SvcName} = rvi_common:get_json_element(["service"], Args),
{ok, DataLinkModule} = rvi_common:get_json_element(["data_link_module"], Args),
@@ -391,7 +391,7 @@ handle_notification(Other, _Args) ->
?info("dlink_sms:handle_notification(~p): unknown", [ Other ]),
ok.
-handle_rpc("setup_data_link", Args) ->
+handle_rpc(<<"setup_data_link">>, Args) ->
{ ok, Service } = rvi_common:get_json_element(["service"], Args),
{ ok, Opts } = rvi_common:get_json_element(["opts"], Args),
@@ -401,12 +401,12 @@ handle_rpc("setup_data_link", Args) ->
{ok, [ {status, rvi_common:json_rpc_status(Res)} , { timeout, Timeout }]};
-handle_rpc("disconnect_data_link", Args) ->
+handle_rpc(<<"disconnect_data_link">>, Args) ->
{ ok, NetworkAddress} = rvi_common:get_json_element(["network_address"], Args),
[Res] = gen_server:call(?SERVER, { rvi, disconnect_data_link, [NetworkAddress]}),
{ok, [ {status, rvi_common:json_rpc_status(Res)} ]};
-handle_rpc("send_data", Args) ->
+handle_rpc(<<"send_data">>, Args) ->
{ ok, ProtoMod } = rvi_common:get_json_element(["proto_mod"], Args),
{ ok, Service } = rvi_common:get_json_element(["service"], Args),
{ ok, Data } = rvi_common:get_json_element(["data"], Args),
diff --git a/components/dlink_tcp/src/dlink_tcp_rpc.erl b/components/dlink_tcp/src/dlink_tcp_rpc.erl
index f094fff..9a8be64 100644
--- a/components/dlink_tcp/src/dlink_tcp_rpc.erl
+++ b/components/dlink_tcp/src/dlink_tcp_rpc.erl
@@ -385,7 +385,7 @@ handle_socket_(FromPid, PeerIP, PeerPort, data, Elems, CompSpec) ->
%% JSON-RPC entry point
%% CAlled by local exo http server
-handle_notification("service_available", Args) ->
+handle_notification(<<"service_available">>, Args) ->
{ok, SvcName} = rvi_common:get_json_element([<<"service">>], Args),
{ok, DataLinkModule} = rvi_common:get_json_element([<<"data_link_module">>], Args),
@@ -394,7 +394,7 @@ handle_notification("service_available", Args) ->
DataLinkModule ]}),
ok;
-handle_notification("service_unavailable", Args) ->
+handle_notification(<<"service_unavailable">>, Args) ->
{ok, SvcName} = rvi_common:get_json_element([<<"service">>], Args),
{ok, DataLinkModule} = rvi_common:get_json_element([<<"data_link_module">>], Args),
@@ -408,7 +408,7 @@ handle_notification(Other, _Args) ->
?info("dlink_tcp:handle_notification(~p): unknown", [ Other ]),
ok.
-handle_rpc("setup_data_link", Args) ->
+handle_rpc(<<"setup_data_link">>, Args) ->
{ ok, Service } = rvi_common:get_json_element([<<"service">>], Args),
{ ok, Opts } = rvi_common:get_json_element([<<"opts">>], Args),
@@ -418,12 +418,12 @@ handle_rpc("setup_data_link", Args) ->
{ok, [ {status, rvi_common:json_rpc_status(Res)} , { timeout, Timeout }]};
-handle_rpc("disconnect_data_link", Args) ->
+handle_rpc(<<"disconnect_data_link">>, Args) ->
{ ok, NetworkAddress} = rvi_common:get_json_element([<<"network_address">>], Args),
[Res] = gen_server:call(?SERVER, { rvi, disconnect_data_link, [NetworkAddress]}),
{ok, [ {status, rvi_common:json_rpc_status(Res)} ]};
-handle_rpc("send_data", Args) ->
+handle_rpc(<<"send_data">>, Args) ->
{ ok, ProtoMod } = rvi_common:get_json_element([<<"proto_mod">>], Args),
{ ok, Service } = rvi_common:get_json_element([<<"service">>], Args),
{ ok, Data } = rvi_common:get_json_element([<<"data">>], Args),
@@ -431,7 +431,7 @@ handle_rpc("send_data", Args) ->
[ Res ] = gen_server:call(?SERVER, { rvi, send_data, [ProtoMod, Service, Data, DataLinkOpts]}),
{ok, [ {status, rvi_common:json_rpc_status(Res)} ]};
-handle_rpc("connections", []) ->
+handle_rpc(<<"connections">>, []) ->
Res = gen_server:call(?SERVER, connections),
{ok, [ {status, ok} | {connections, Res} ]};
@@ -674,7 +674,7 @@ process_authorize(FromPid, PeerIP, PeerPort,
?debug("dlink_tcp:authorize(): Credentials: ~p", [ [authorize_keys:abbrev_bin(C) || C <- Credentials] ]),
F = fun() ->
- process_authorize_(FromPid, PeerIP, PeerPort,
+ process_authorize_(FromPid, PeerIP, PeerPort,
ProtoVersion, Credentials, CompSpec)
end,
case connection_manager:find_connection_by_address(PeerIP, PeerPort) of
diff --git a/components/dlink_tls/src/dlink_tls_rpc.erl b/components/dlink_tls/src/dlink_tls_rpc.erl
index ad0d512..849271a 100644
--- a/components/dlink_tls/src/dlink_tls_rpc.erl
+++ b/components/dlink_tls/src/dlink_tls_rpc.erl
@@ -125,7 +125,7 @@ setup_initial_listeners([_|_] = TlsOpts, CompSpec) ->
{value, {_, Ports}, Rest} ->
setup_initial_listeners_(Rest, CompSpec),
[setup_initial_listeners_(
- [{port,P}|inherit_opts([ip], TlsOpts, POpts)], CompSpec)
+ [{port,P}|inherit_opts([ip, ifaddr], TlsOpts, POpts)], CompSpec)
|| {P, POpts} <- Ports];
false ->
setup_initial_listeners_(TlsOpts, CompSpec)
@@ -427,7 +427,7 @@ handle_socket(FromPid, PeerIP, PeerPort, data, Elems, CompSpec) ->
%% JSON-RPC entry point
%% CAlled by local exo http server
-handle_notification("service_available", Args) ->
+handle_notification(<<"service_available">>, Args) ->
{ok, SvcName} = rvi_common:get_json_element(["service"], Args),
{ok, DataLinkModule} = rvi_common:get_json_element(["data_link_module"], Args),
@@ -436,7 +436,7 @@ handle_notification("service_available", Args) ->
DataLinkModule ]}),
ok;
-handle_notification("service_unavailable", Args) ->
+handle_notification(<<"service_unavailable">>, Args) ->
{ok, SvcName} = rvi_common:get_json_element(["service"], Args),
{ok, DataLinkModule} = rvi_common:get_json_element(["data_link_module"], Args),
@@ -450,7 +450,7 @@ handle_notification(Other, _Args) ->
?info("dlink_tls:handle_notification(~p): unknown", [ Other ]),
ok.
-handle_rpc("setup_data_link", Args) ->
+handle_rpc(<<"setup_data_link">>, Args) ->
{ ok, Service } = rvi_common:get_json_element(["service"], Args),
{ ok, Opts } = rvi_common:get_json_element(["opts"], Args),
@@ -460,12 +460,12 @@ handle_rpc("setup_data_link", Args) ->
{ok, [ {status, rvi_common:json_rpc_status(Res)} , { timeout, Timeout }]};
-handle_rpc("disconnect_data_link", Args) ->
+handle_rpc(<<"disconnect_data_link">>, Args) ->
{ ok, NetworkAddress} = rvi_common:get_json_element(["network_address"], Args),
[Res] = gen_server:call(?SERVER, { rvi, disconnect_data_link, [NetworkAddress]}),
{ok, [ {status, rvi_common:json_rpc_status(Res)} ]};
-handle_rpc("send_data", Args) ->
+handle_rpc(<<"send_data">>, Args) ->
{ ok, ProtoMod } = rvi_common:get_json_element(["proto_mod"], Args),
{ ok, Service } = rvi_common:get_json_element(["service"], Args),
{ ok, Data } = rvi_common:get_json_element(["data"], Args),
@@ -473,7 +473,7 @@ handle_rpc("send_data", Args) ->
[ Res ] = gen_server:call(?SERVER, { rvi, send_data, [ProtoMod, Service, Data, DataLinkOpts]}),
{ok, [ {status, rvi_common:json_rpc_status(Res)} ]};
-handle_rpc("connections", []) ->
+handle_rpc(<<"connections">>, []) ->
Res = gen_server:call(?SERVER, connections),
{ok, [ {status, ok} | {connections, {array, Res}} ]};
@@ -688,7 +688,7 @@ availability_msg(Availability, Services) ->
status_string(available ) -> ?DLINK_ARG_AVAILABLE;
status_string(unavailable) -> ?DLINK_ARG_UNAVAILABLE.
-process_authorize(FromPid, PeerIP, PeerPort,
+process_authorize(FromPid, PeerIP, PeerPort,
Credentials, ProtoVersion, CompSpec) ->
?info("dlink_tls:authorize(): Peer Address: ~s:~p", [PeerIP, PeerPort ]),
case ProtoVersion of
diff --git a/components/proto_bert/src/proto_bert_rpc.erl b/components/proto_bert/src/proto_bert_rpc.erl
index f1658a3..a3353c7 100644
--- a/components/proto_bert/src/proto_bert_rpc.erl
+++ b/components/proto_bert/src/proto_bert_rpc.erl
@@ -70,7 +70,7 @@ receive_message(CompSpec, {IP,Port}, Data) ->
%% JSON-RPC entry point
%% CAlled by local exo http server
-handle_rpc("send_message", Args) ->
+handle_rpc(<<"send_message">>, Args) ->
LogId = rvi_common:get_json_log_id(Args),
{ok, TID} = rvi_common:get_json_element(["transaction_id"], Args),
{ok, ServiceName} = rvi_common:get_json_element(["service_name"], Args),
@@ -96,7 +96,7 @@ handle_rpc(Other, _Args) ->
?warning("proto_bert_rpc:handle_rpc(~p): Unknown~n", [ Other ]),
{ ok, [ { status, rvi_common:json_rpc_status(invalid_command)} ] }.
-handle_notification("receive_message", Args) ->
+handle_notification(<<"receive_message">>, Args) ->
{ok, Data} = rvi_common:get_json_element(["data"], Args),
{ok, RemoteIP} = rvi_common:get_json_element(["remote_ip"], Args),
{ok, RemotePort} = rvi_common:get_json_element(["remote_port"], Args),
diff --git a/components/proto_json/src/proto_json_rpc.erl b/components/proto_json/src/proto_json_rpc.erl
index 85f1aa6..e01a985 100644
--- a/components/proto_json/src/proto_json_rpc.erl
+++ b/components/proto_json/src/proto_json_rpc.erl
@@ -71,7 +71,7 @@ receive_message(CompSpec, {IP, Port}, Data) ->
%% JSON-RPC entry point
%% CAlled by local exo http server
-handle_rpc("send_message", Args) ->
+handle_rpc(<<"send_message">>, Args) ->
LogId = rvi_common:get_json_log_id(Args),
{ok, TID} = rvi_common:get_json_element(["transaction_id"], Args),
{ok, ServiceName} = rvi_common:get_json_element(["service_name"], Args),
@@ -98,7 +98,7 @@ handle_rpc(Other, _Args) ->
{ ok, [ { status, rvi_common:json_rpc_status(invalid_command)} ] }.
-handle_notification("receive_message", Args) ->
+handle_notification(<<"receive_message">>, Args) ->
LogId = rvi_common:get_json_log_id(Args),
{ok, Data} = rvi_common:get_json_element(["data"], Args),
{ok, RemoteIP} = rvi_common:get_json_element(["remote_ip"], Args),
diff --git a/components/proto_msgpack/src/proto_msgpack_rpc.erl b/components/proto_msgpack/src/proto_msgpack_rpc.erl
index 07352eb..7035353 100644
--- a/components/proto_msgpack/src/proto_msgpack_rpc.erl
+++ b/components/proto_msgpack/src/proto_msgpack_rpc.erl
@@ -74,7 +74,7 @@ receive_message(CompSpec, {IP, Port}, Data) ->
%% JSON-RPC entry point
%% CAlled by local exo http server
-handle_rpc("send_message", Args) ->
+handle_rpc(<<"send_message">>, Args) ->
LogId = rvi_common:get_json_log_id(Args),
{ok, TID} = rvi_common:get_json_element(["transaction_id"], Args),
{ok, ServiceName} = rvi_common:get_json_element(["service_name"], Args),
@@ -100,7 +100,7 @@ handle_rpc(Other, _Args) ->
{ ok, [ { status, rvi_common:json_rpc_status(invalid_command)} ] }.
-handle_notification("receive_message", Args) ->
+handle_notification(<<"receive_message">>, Args) ->
LogId = rvi_common:get_json_log_id(Args),
{ok, Data} = rvi_common:get_json_element(["data"], Args),
{ok, RemoteIP} = rvi_common:get_json_element(["remote_ip"], Args),
diff --git a/components/schedule/src/schedule_rpc.erl b/components/schedule/src/schedule_rpc.erl
index 0faddba..7f5a0a9 100644
--- a/components/schedule/src/schedule_rpc.erl
+++ b/components/schedule/src/schedule_rpc.erl
@@ -178,7 +178,7 @@ handle_rpc(Other, _Args) ->
-handle_notification("service_available", Args) ->
+handle_notification(<<"service_available">>, Args) ->
{ok, SvcName} = rvi_common:get_json_element(["service"], Args),
{ok, DataLinkModule} = rvi_common:get_json_element(["data_link_mod"], Args),
LogId = rvi_common:get_json_log_id(Args),
@@ -189,7 +189,7 @@ handle_notification("service_available", Args) ->
LogId ]}),
ok;
-handle_notification("service_unavailable", Args) ->
+handle_notification(<<"service_unavailable">>, Args) ->
{ok, SvcName} = rvi_common:get_json_element(["service"], Args),
{ok, DataLinkModule} = rvi_common:get_json_element(["data_link_mod"], Args),
LogId = rvi_common:get_json_log_id(Args),
diff --git a/components/service_discovery/src/service_discovery_rpc.erl b/components/service_discovery/src/service_discovery_rpc.erl
index 73673d7..a553e18 100644
--- a/components/service_discovery/src/service_discovery_rpc.erl
+++ b/components/service_discovery/src/service_discovery_rpc.erl
@@ -119,7 +119,7 @@ unsubscribe(CompSpec, SubscribingMod) ->
%% Called by local exo http server
%% Register remote services
-handle_notification("register_services", Args) ->
+handle_notification(<<"register_services">>, Args) ->
LogId = rvi_common:get_json_log_id(Args),
{ok, Services} = rvi_common:get_json_element(["services"], Args),
{ok, DataLinkModule} = rvi_common:get_json_element(["data_link_module"], Args),
@@ -129,7 +129,7 @@ handle_notification("register_services", Args) ->
ok;
-handle_notification("unregister_services", Args) ->
+handle_notification(<<"unregister_services">>, Args) ->
LogId = rvi_common:get_json_log_id(Args),
{ok, Services} = rvi_common:get_json_element(["services"], Args),
{ok, DataLinkModule } = rvi_common:get_json_element(["data_link_module"], Args),
@@ -138,7 +138,7 @@ handle_notification("unregister_services", Args) ->
ok;
-handle_notification("subscribe", Args) ->
+handle_notification(<<"subscribe">>, Args) ->
LogId = rvi_common:get_json_log_id(Args),
{ok, Module } = rvi_common:get_json_element(["subscribing_module"], Args),
@@ -146,7 +146,7 @@ handle_notification("subscribe", Args) ->
gen_server:cast(?SERVER, { rvi, subscribe, [ list_to_atom(Module), LogId ]}),
ok;
-handle_notification("unsubscribe_from_service", Args) ->
+handle_notification(<<"unsubscribe_from_service">>, Args) ->
LogId = rvi_common:get_json_log_id(Args),
{ok, Module } = rvi_common:get_json_element(["subscribing_module"], Args),
@@ -162,14 +162,14 @@ handle_notification( Other, _Args) ->
%%
%% Get all services
%%
-handle_rpc("get_all_services", Args) ->
+handle_rpc(<<"get_all_services">>, Args) ->
?debug("svc_disc:get_all_services(json-rpc)"),
LogId = rvi_common:get_json_log_id(Args),
[ok, Services ] = gen_server:call(?SERVER, { rvi, get_all_services, [LogId]}),
{ok, [ {status, rvi_common:json_rpc_status(ok)} , { services, Services }]};
-handle_rpc("get_services_by_module", Args) ->
+handle_rpc(<<"get_services_by_module">>, Args) ->
LogId = rvi_common:get_json_log_id(Args),
{ok, DataLinkMod } = rvi_common:get_json_element(["data_link_module"], Args),
?debug("svc_disc:get_services_by_module(json-rpc): ~p ", [DataLinkMod]),
@@ -180,7 +180,7 @@ handle_rpc("get_services_by_module", Args) ->
{ok, [ {status, rvi_common:json_rpc_status(ok)} , { services, { array, Services } }]};
-handle_rpc("get_modules_by_service", Args) ->
+handle_rpc(<<"get_modules_by_service">>, Args) ->
LogId = rvi_common:get_json_log_id(Args),
{ok, Service } = rvi_common:get_json_element(["service"], Args),
?debug("svc_disc:get_modules_by_service(json-rpc): ~p ", [Service]),