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