fix format
This commit is contained in:
parent
980f6ff4d5
commit
b3d795c523
@ -90,6 +90,7 @@ init([]) ->
|
|||||||
%% 同一个SubscriberPid只能订阅同一个topic一次
|
%% 同一个SubscriberPid只能订阅同一个topic一次
|
||||||
handle_call(get_subscribers, _From, State = #state{subscribers = Subscribers}) ->
|
handle_call(get_subscribers, _From, State = #state{subscribers = Subscribers}) ->
|
||||||
{reply, {ok, Subscribers}, State};
|
{reply, {ok, Subscribers}, State};
|
||||||
|
|
||||||
handle_call({subscribe, Topic, SubscriberPid}, _From, State = #state{subscribers = Subscribers}) ->
|
handle_call({subscribe, Topic, SubscriberPid}, _From, State = #state{subscribers = Subscribers}) ->
|
||||||
Components = of_components(Topic),
|
Components = of_components(Topic),
|
||||||
case is_valid_components(Components) of
|
case is_valid_components(Components) of
|
||||||
@ -112,6 +113,7 @@ handle_call({subscribe, Topic, SubscriberPid}, _From, State = #state{subscribers
|
|||||||
false ->
|
false ->
|
||||||
{reply, {error, <<"invalid topic name">>}, State}
|
{reply, {error, <<"invalid topic name">>}, State}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
handle_call({unsubscribe, Topic, SubscriberPid}, _From, State = #state{subscribers = Subscribers}) ->
|
handle_call({unsubscribe, Topic, SubscriberPid}, _From, State = #state{subscribers = Subscribers}) ->
|
||||||
{Removed, Reserved} = lists:partition(fun(#subscriber{topic = Topic0, subscriber_pid = SubscriberPid0}) ->
|
{Removed, Reserved} = lists:partition(fun(#subscriber{topic = Topic0, subscriber_pid = SubscriberPid0}) ->
|
||||||
Topic =:= Topic0 andalso SubscriberPid =:= SubscriberPid0
|
Topic =:= Topic0 andalso SubscriberPid =:= SubscriberPid0
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user