diff --git a/apps/iot/src/http_protocol.erl b/apps/iot/src/http_handler/http_protocol.erl similarity index 100% rename from apps/iot/src/http_protocol.erl rename to apps/iot/src/http_handler/http_protocol.erl diff --git a/apps/iot/src/iot.app.src b/apps/iot/src/iot.app.src index 9d1ffb3..27c94f7 100644 --- a/apps/iot/src/iot.app.src +++ b/apps/iot/src/iot.app.src @@ -13,7 +13,7 @@ parse_trans, hackney, poolboy, - + emqtt, mnesia, crypto, public_key, diff --git a/apps/iot/src/iot_host.erl b/apps/iot/src/iot_host.erl index d03f63b..d7904ce 100644 --- a/apps/iot/src/iot_host.erl +++ b/apps/iot/src/iot_host.erl @@ -35,7 +35,7 @@ get_name(HostId) when is_binary(HostId) -> -spec(start_link(Name :: atom(), Host :: #host{}) -> {ok, Pid :: pid()} | ignore | {error, Reason :: term()}). start_link(Name, Host = #host{}) -> - gen_server:start_link({local, Name}, ?MODULE, [Host], []). + gen_server:start_link({global, Name}, ?MODULE, [Host], []). %%%=================================================================== %%% gen_server callbacks diff --git a/apps/iot/src/iot_http_client.erl b/apps/iot/src/iot_http_client.erl index f1f73f6..1fd5fad 100644 --- a/apps/iot/src/iot_http_client.erl +++ b/apps/iot/src/iot_http_client.erl @@ -21,7 +21,7 @@ post(Url, Body) when is_list(Url), is_binary(Body) -> ok; {error, Reason} -> lager:warning("[iot_http_client] url: ~p, get error: ~p", [Url, Reason]), - {error, failed} + {error, Reason} end; {ok, HttpCode, _, ClientRef} -> @@ -31,10 +31,10 @@ post(Url, Body) when is_list(Url), is_binary(Body) -> ok; {error, Reason} -> lager:warning("[iot_http_client] url: ~p, http_code: ~p, get error: ~p", [Url, HttpCode, Reason]), - {error, failed} + {error, Reason} end; {error, Reason} -> lager:warning("[iot_http_client] url: ~p, get error: ~p", [Url, Reason]), - {error, failed} + {error, Reason} end. \ No newline at end of file