This commit is contained in:
Feng 2015-10-13 21:04:15 +08:00
parent 5daeac083c
commit 6a66ca90b1
1 changed files with 5 additions and 3 deletions

View File

@ -27,6 +27,8 @@
-module(emqttd_dist). -module(emqttd_dist).
-import(lists, [concat/1]).
-export([parse_node/1]). -export([parse_node/1]).
parse_node(Name) when is_list(Name) -> parse_node(Name) when is_list(Name) ->
@ -40,10 +42,10 @@ parse_node(Name) when is_list(Name) ->
with_domain(Name) -> with_domain(Name) ->
case net_kernel:longnames() of case net_kernel:longnames() of
true -> true ->
Name ++ "@" ++ inet_db:gethostname() ++ concat([Name, "@", inet_db:gethostname(),
"." ++ inet_db:res_option(domain); ".", inet_db:res_option(domain)]);
false -> false ->
Name ++ "@" ++ inet_db:gethostname(); concat([Name, "@", inet_db:gethostname()]);
_ -> _ ->
Name Name
end. end.