Fred T-H  committed 494ef2b

moving the event monitor unlinking to a place that makes way more sense.

  • Participants
  • Parent commits 44653bf

Comments (0)

Files changed (2)

File src/client.erl

 %% Description: Removes a client's listener from a given user.
 disconnect(Id, HandlerId) ->
-    usr:unsubscribe(Id, HandlerId),
-    %% leftover link from the event manager. Total break of
-    %% encapsulation here, but is needed to deal with process pools.
-    unlink(global:whereis_name({manager,Id})).
+    usr:unsubscribe(Id, HandlerId).
 %% Function: message(From, To, Message) -> ok

File src/usr_listen_handler.erl

 %% handler is removed. This is a call that's a bit ugly, because it
 %% goes straight to the fsm in order to make sure no dead handlers
 %% are counted.
+%% It also removes the link between the client and the manager to avoid
+%% killing process pools for no reason.
-terminate({stop,_}, {UserId,_,HandlerId}) ->
+terminate({stop,_}, {UserId, SubscriberPid, HandlerId}) ->
   usr_monitor:delete_handler(UserId, HandlerId),
+  unlink(SubscriberPid),
 terminate(_Reason, _State) ->