diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2010-10-13 23:20:54 +0200 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2010-10-13 23:20:54 +0200 |
commit | b29dda5113a994d2ad18f9e6048d9b69c91a79c7 (patch) | |
tree | 5f8da7b1551bc0dab9bbdac7da162180f9afd509 /server | |
parent | 1a9f93acf57f1528c3e69d9916cdda1836d3550c (diff) | |
download | erlang-b29dda5113a994d2ad18f9e6048d9b69c91a79c7.tar.gz erlang-b29dda5113a994d2ad18f9e6048d9b69c91a79c7.tar.xz erlang-b29dda5113a994d2ad18f9e6048d9b69c91a79c7.zip |
some progress
Diffstat (limited to 'server')
-rw-r--r-- | server/client.erl | 6 | ||||
-rw-r--r-- | server/dispatcher.erl | 11 |
2 files changed, 14 insertions, 3 deletions
diff --git a/server/client.erl b/server/client.erl index 7139e67..9d778f0 100644 --- a/server/client.erl +++ b/server/client.erl @@ -2,12 +2,14 @@ -export([start/1, loop/1, register/2, login/2]). start(Client) -> - spawn(client, loop, Client). + process_flag(trap_exit, true), + spawn(client, loop, [Client]). loop(Client) -> receive {list} -> - Client ! {ok, media ! {all}}; + Client ! {ok, foo}, + loop(Client); true -> Client ! {error, unknown_command}, diff --git a/server/dispatcher.erl b/server/dispatcher.erl index 4cef276..390f9e5 100644 --- a/server/dispatcher.erl +++ b/server/dispatcher.erl @@ -2,10 +2,18 @@ -export([start/0, init/0, handle/3]). start() -> - server:start(dis, dispatcher). code:purge(server), code:load_abs("../common/server"), + case server:start(dis, dispatcher) of + true -> + io:format("Server started... ~n"), + true; + _ -> + io:format("Error starting server! Exiting.~n"), + exit(1) + end. + init() -> dict:new(). @@ -14,6 +22,7 @@ handle(_, {register, {User, Password}}, Dict) -> {ok, _}-> {{error, duplicated_user}, Dict}; _ -> + io:format("User created: ~s~n", [User]), {{ok, user_created}, dict:store(User, Password, Dict)} end; |