diff options
author | Michael Wittig <michael.wittig@fu-berlin.de> | 2010-10-14 10:36:37 +0200 |
---|---|---|
committer | Michael Wittig <michael.wittig@fu-berlin.de> | 2010-10-14 10:36:37 +0200 |
commit | 1b6c636b0584d1264209fab522c4476082f0e0fd (patch) | |
tree | d38b97c98f36c2bcc8fded4837d0394e9d2fba97 /server | |
parent | 0dc60dd485a35b2c2336cf56595c2731b4634877 (diff) | |
parent | 2a672cf96dc272213a36d15f78ec19b6579de4df (diff) | |
download | erlang-1b6c636b0584d1264209fab522c4476082f0e0fd.tar.gz erlang-1b6c636b0584d1264209fab522c4476082f0e0fd.tar.xz erlang-1b6c636b0584d1264209fab522c4476082f0e0fd.zip |
Merge branch 'master' of ssh://git.animux.de/erlang
Diffstat (limited to 'server')
-rw-r--r-- | server/client.erl | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/server/client.erl b/server/client.erl index 31d382f..bf8bc22 100644 --- a/server/client.erl +++ b/server/client.erl @@ -3,13 +3,13 @@ start(Node) -> process_flag(trap_exit, true), - {Client, Ref} = server:start_on_node(Node, client, undef), + Client = server:start_on_node(Node, client, undef), link(Client), - Server = spawn_link(client, loop, [{Client, Ref}]), + Server = spawn_link(client, loop, [Client]), - case server:rpc({Client, Ref}, {change_state, Server}) of + case server:rpc(Client, {change_state, Server}) of {ok} -> - {ok, {Client, Ref}}; + {ok, Client}; _ -> {error, unknown_error} end. @@ -17,11 +17,11 @@ start(Node) -> loop(Client) -> receive list -> - server:send(Client, {ok, {foo}}), + Client ! {ok, {foo}}, loop(Client); Cmd -> - server:send(Client, {error, {unknown_command, Cmd}}), + Client ! {error, {unknown_command, Cmd}}, loop(Client) end. @@ -30,3 +30,16 @@ register(Client, {Name, Password}) -> login(Client, {Node, Name, Password}) -> dis ! {Client, {login, {Node, Name, Password}}}. + +getVotes() -> + media:getVotes(self()), + receive + Msg -> + Client ! Msg + end. + +vote(Artist,Title) -> + media:vote(Artist, Title). + +devote(Artist,Title) -> + media:devote(Artist, Title). |