Feng 10 lat temu
rodzic
commit
6209d47aae
1 zmienionych plików z 4 dodań i 1 usunięć
  1. 4 1
      src/emqttd_sm.erl

+ 4 - 1
src/emqttd_sm.erl

@@ -85,7 +85,10 @@ mnesia(copy) ->
 %%------------------------------------------------------------------------------
 -spec start_link(Id :: pos_integer()) -> {ok, pid()} | ignore | {error, any()}.
 start_link(Id) ->
-    gen_server2:start_link(?MODULE, [Id], []).
+    gen_server2:start_link({local, name(Id)}, ?MODULE, [Id], []).
+
+name(Id) ->
+    list_to_atom("emqttd_sm_" ++ integer_to_list(Id)).
 
 %%------------------------------------------------------------------------------
 %% @doc Pool name.