Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

do not remember multiple monitors for the same node

  • Loading branch information...
commit ab7a7c65f214796a9a1c2e93918b6fd9baecf65a 1 parent db49b7a
Garret Smith authored January 28, 2011

Showing 1 changed file with 16 additions and 4 deletions. Show diff stats Hide diff stats

  1. 20  src/gen_leader.erl
20  src/gen_leader.erl
@@ -1403,11 +1403,23 @@ mon_nodes(E,Nodes,Server) ->
1403 1403
               mon_node(El, Pid, Server)
1404 1404
       end,E1,Nodes -- [node()]).
1405 1405
 
1406  
-%% Star monitoring one Process
1407  
-mon_node(E,Proc,Server) ->
1408  
-    {Ref,Node} = do_monitor(Proc, Server),
1409  
-    E#election{monitored = [{Ref,Node} | E#election.monitored]}.
  1406
+%% Start monitoring one Process
  1407
+mon_node(E,{_RegName, NodeName} = Proc,Server) ->
  1408
+    case lists:keymember(NodeName, 2, E#election.monitored) of
  1409
+	    true -> E;
  1410
+	    false ->
  1411
+                {Ref,Node} = do_monitor(Proc, Server),
  1412
+                E#election{monitored = [{Ref,Node} | E#election.monitored]}
  1413
+    end;
1410 1414
 
  1415
+mon_node(E,Proc,Server) when is_pid(Proc) ->
  1416
+    case lists:keymember(node(Proc), 2, E#election.monitored) of
  1417
+	    true -> E;
  1418
+	    false ->
  1419
+                {Ref,Node} = do_monitor(Proc, Server),
  1420
+                E#election{monitored = [{Ref,Node} | E#election.monitored]}
  1421
+    end
  1422
+    .
1411 1423
 
1412 1424
 spawn_monitor_proc() ->
1413 1425
     Parent = self(),

0 notes on commit ab7a7c6

Please sign in to comment.
Something went wrong with that request. Please try again.