diff options
Diffstat (limited to '')
-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} |