diff options
author | Nathan Lasseter <nathan.je.lasseter@googlemail.com> | 2011-01-27 21:48:19 +0000 |
---|---|---|
committer | Nathan Lasseter <nathan.je.lasseter@googlemail.com> | 2011-01-27 21:48:19 +0000 |
commit | 6d2ccec261ead5f3f3d62aa4d42735930f44e5c8 (patch) | |
tree | 7488b44f5f50883530d2a4d0b558382a37140699 | |
parent | cf34ae552e7e64d9cf0c2d0faa334d3ee51169b3 (diff) |
Added del_node and list_nodes
-rw-r--r-- | erlbal.erl | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -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. |