diff options
author | Marco Ziener <mziener@lavabit.com> | 2010-10-15 10:28:16 +0200 |
---|---|---|
committer | Marco Ziener <mziener@lavabit.com> | 2010-10-15 10:28:16 +0200 |
commit | 359418e0b7be058dfe728b5f881e3cda488fdc2c (patch) | |
tree | 050e6da7fe3d68689fe39ef84ef67c3d5f63c60e | |
parent | 7b384b413741a90828a946c7e527f8b2847a17d5 (diff) | |
parent | 4cb05a2b4d5e22a09286718d91d42e141b403e81 (diff) | |
download | erlang-359418e0b7be058dfe728b5f881e3cda488fdc2c.tar.gz erlang-359418e0b7be058dfe728b5f881e3cda488fdc2c.tar.xz erlang-359418e0b7be058dfe728b5f881e3cda488fdc2c.zip |
Merge branch 'master' of ssh://git.animux.de/erlang
-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} |