diff options
author | Jakob Pfender <jpfender@zedat.fu-berlin.de> | 2010-10-15 10:22:26 +0200 |
---|---|---|
committer | Jakob Pfender <jpfender@zedat.fu-berlin.de> | 2010-10-15 10:22:26 +0200 |
commit | 4cb05a2b4d5e22a09286718d91d42e141b403e81 (patch) | |
tree | 6f2b6b86b48063fd10788576e93617f1292e2f44 /server | |
parent | e64206c54ce24d2346215c61cc7997b2009e446e (diff) | |
download | erlang-4cb05a2b4d5e22a09286718d91d42e141b403e81.tar.gz erlang-4cb05a2b4d5e22a09286718d91d42e141b403e81.tar.xz erlang-4cb05a2b4d5e22a09286718d91d42e141b403e81.zip |
documentation for server/client.erl
Diffstat (limited to 'server')
-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 c5beda7..6c81349 100644 --- a/server/client.erl +++ b/server/client.erl @@ -2,7 +2,7 @@ -export([start/2, loop/2, register/2, login/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} |