aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Lasseter <nathan.je.lasseter@googlemail.com>2011-01-27 21:48:19 +0000
committerNathan Lasseter <nathan.je.lasseter@googlemail.com>2011-01-27 21:48:19 +0000
commit6d2ccec261ead5f3f3d62aa4d42735930f44e5c8 (patch)
tree7488b44f5f50883530d2a4d0b558382a37140699
parentcf34ae552e7e64d9cf0c2d0faa334d3ee51169b3 (diff)
Added del_node and list_nodes
-rw-r--r--erlbal.erl9
1 files changed, 7 insertions, 2 deletions
diff --git a/erlbal.erl b/erlbal.erl
index f0bca7e..6dfefad 100644
--- a/erlbal.erl
+++ b/erlbal.erl
@@ -26,6 +26,11 @@ bal_loop(Serverlist, Nextserver) ->
receive
{add_node, PID} ->
bal_loop(Serverlist ++ [PID], Nextserver);
+ {del_node, PID} ->
+ bal_loop(Serverlist -- [PID], Nextserver);
+ {list_nodes, From} ->
+ From ! Serverlist,
+ bal_loop(Serverlist, Nextserver);
{request, From, ARGS} ->
Serv = lists:nth(Nextserver, Serverlist),
Serv ! {request, From, ARGS},
@@ -48,6 +53,6 @@ bal_loop(Serverlist, Nextserver) ->
make_request(Balancer, ARGS) ->
Balancer ! {request, self(), ARGS},
receive
- ID ->
- ID
+ Ret ->
+ Ret
end.