This commit is contained in:
Ery Lee 2015-03-20 14:44:07 +08:00
parent 53883ae188
commit 7a9c30c2d1
2 changed files with 7 additions and 2 deletions

View File

@ -86,7 +86,8 @@ lookup(ClientId) when is_binary(ClientId) ->
%%------------------------------------------------------------------------------
-spec register(ClientId :: binary(), Pid :: pid()) -> ok.
register(ClientId, Pid) when is_binary(ClientId), is_pid(Pid) ->
gen_server:call(?SERVER, {register, ClientId, Pid}).
%%TODO: infinify to block requests when too many clients, this will be redesinged in 0.9.x...
gen_server:call(?SERVER, {register, ClientId, Pid}, infinity).
%%------------------------------------------------------------------------------
%% @doc

View File

@ -119,8 +119,12 @@ create(Topic) ->
subscribe({Topic, Qos}, SubPid) when is_binary(Topic) and is_pid(SubPid) ->
subscribe([{Topic, Qos}], SubPid);
%% TODO:
%% call will not work when there are 2000K+ clients, 100+ sub requests/sec...
%% will optimize in 0.9.x...
%%
subscribe(Topics, SubPid) when is_list(Topics) and is_pid(SubPid) ->
gen_server:call(?SERVER, {subscribe, Topics, SubPid}).
gen_server:call(?SERVER, {subscribe, Topics, SubPid}, infinity).
%%------------------------------------------------------------------------------
%% @doc