sync with imac
This commit is contained in:
parent
c293ccab13
commit
5e0bf3d831
|
@ -51,6 +51,7 @@
|
||||||
username,
|
username,
|
||||||
clientid,
|
clientid,
|
||||||
clean_sess,
|
clean_sess,
|
||||||
|
sessmod,
|
||||||
session, %% session state or session pid
|
session, %% session state or session pid
|
||||||
will_msg,
|
will_msg,
|
||||||
max_clientid_len = ?MAX_CLIENTID_LEN,
|
max_clientid_len = ?MAX_CLIENTID_LEN,
|
||||||
|
|
|
@ -47,7 +47,9 @@
|
||||||
%% API Function Exports
|
%% API Function Exports
|
||||||
-export([start_link/2, pool/0, table/0]).
|
-export([start_link/2, pool/0, table/0]).
|
||||||
|
|
||||||
-export([lookup_session/1, start_session/2, destroy_session/1]).
|
-export([lookup_session/1,
|
||||||
|
start_session/2,
|
||||||
|
destroy_session/1]).
|
||||||
|
|
||||||
%% gen_server Function Exports
|
%% gen_server Function Exports
|
||||||
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
|
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
|
||||||
|
@ -85,6 +87,15 @@ pool() -> ?SM_POOL.
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
table() -> ?SESSION_TAB.
|
table() -> ?SESSION_TAB.
|
||||||
|
|
||||||
|
%%------------------------------------------------------------------------------
|
||||||
|
%% @doc Start a session
|
||||||
|
%% @end
|
||||||
|
%%------------------------------------------------------------------------------
|
||||||
|
-spec start_session(binary(), pid()) -> {ok, pid()} | {error, any()}.
|
||||||
|
start_session(ClientId, ClientPid) ->
|
||||||
|
SmPid = gproc_pool:pick_worker(?SM_POOL, ClientId),
|
||||||
|
gen_server:call(SmPid, {start_session, ClientId, ClientPid}).
|
||||||
|
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
%% @doc Lookup Session Pid
|
%% @doc Lookup Session Pid
|
||||||
%% @end
|
%% @end
|
||||||
|
@ -96,15 +107,6 @@ lookup_session(ClientId) ->
|
||||||
[] -> undefined
|
[] -> undefined
|
||||||
end.
|
end.
|
||||||
|
|
||||||
%%------------------------------------------------------------------------------
|
|
||||||
%% @doc Start a session
|
|
||||||
%% @end
|
|
||||||
%%------------------------------------------------------------------------------
|
|
||||||
-spec start_session(binary(), pid()) -> {ok, pid()} | {error, any()}.
|
|
||||||
start_session(ClientId, ClientPid) ->
|
|
||||||
SmPid = gproc_pool:pick_worker(?SM_POOL, ClientId),
|
|
||||||
gen_server:call(SmPid, {start_session, ClientId, ClientPid}).
|
|
||||||
|
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
%% @doc Destroy a session
|
%% @doc Destroy a session
|
||||||
%% @end
|
%% @end
|
||||||
|
|
Loading…
Reference in New Issue