diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2010-10-15 10:51:15 +0200 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2010-10-15 10:51:15 +0200 |
commit | 32abe1a28b74263e12afd4475fd7896d9c4e6a9d (patch) | |
tree | 596d84005dbaa7df801f477b58bb39b16f0b8e5b /server/client.erl | |
parent | 8ce78ba045474b606267e351e945ef6be1b969c0 (diff) | |
parent | ebbf2038b2e131cc43eae1d4c98fbd6efb548f0a (diff) | |
download | erlang-32abe1a28b74263e12afd4475fd7896d9c4e6a9d.tar.gz erlang-32abe1a28b74263e12afd4475fd7896d9c4e6a9d.tar.xz erlang-32abe1a28b74263e12afd4475fd7896d9c4e6a9d.zip |
Merge branch 'master' of ssh://git.animux.de/erlang
Diffstat (limited to 'server/client.erl')
-rw-r--r-- | server/client.erl | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/server/client.erl b/server/client.erl index 3f9ece2..03f6276 100644 --- a/server/client.erl +++ b/server/client.erl @@ -2,7 +2,7 @@ -export([start/2, loop/2]). start(Node, User) -> - %% start linked processes on client and server to get noticed if + %% start linked processes on client and server to get notice if %% client disconnects and properly handle the logged in status process_flag(trap_exit, true), Client = server:start_on_node(Node, client, undef), @@ -13,7 +13,7 @@ start(Node, User) -> Server = spawn_link(client, loop, [Client, User]), %% update the server process_id in the state of the client process, - %% so that the client process know directly its counterpart on the + %% so that the client process knows its direct counterpart on the %% server case server:rpc(Client, {change_state, Server}) of {ok} -> @@ -34,7 +34,7 @@ execute(Client, F) -> end. loop(Client, User) -> - %% mainloop for client modul in server, handle the commands form + %% main loop for client module in server, handle the commands from %% the logged_in client receive {register, Name, Password} -> @@ -50,14 +50,14 @@ loop(Client, User) -> execute(Client, fun() -> cldb:get_votes(User) end); {vote, Artist, Title} -> - %% only allow vote if user has vote to give away + %% only allow voting if user has at least one vote case cldb:dec_vote(User) of {ok} -> execute(Client, fun() -> media:vote(Artist, Title) end); _ -> Client ! {error, no_votes_available} end; {devote, Artist, Title} -> - %% only allow devote if user has vote to give away + %% only allow devoting if user has at least one vote case cldb:dec_vote(User) of {ok} -> execute(Client, fun() -> media:devote(Artist, Title) end); _ -> Client ! {error, no_votes_available} |