diff options
author | Michael Wittig <michael.wittig@fu-berlin.de> | 2010-10-14 15:26:47 +0200 |
---|---|---|
committer | Michael Wittig <michael.wittig@fu-berlin.de> | 2010-10-14 15:26:47 +0200 |
commit | 6eef92b9297377aeb1fdd1e55fbb89ea38d1be78 (patch) | |
tree | ac65aeb55c634d8cf8cdb6a53f33875cb53549d5 /server | |
parent | a844b69799ad2a223da778a3ce68ccd9102c3816 (diff) | |
parent | 097d7f7dda9c405fb796e3228631a07192f36bd1 (diff) | |
download | erlang-6eef92b9297377aeb1fdd1e55fbb89ea38d1be78.tar.gz erlang-6eef92b9297377aeb1fdd1e55fbb89ea38d1be78.tar.xz erlang-6eef92b9297377aeb1fdd1e55fbb89ea38d1be78.zip |
Merge branch 'master' of ssh://git.animux.de/erlang
Diffstat (limited to 'server')
-rw-r--r-- | server/Makefile | 5 | ||||
-rw-r--r-- | server/dispatcher.erl | 27 |
2 files changed, 26 insertions, 6 deletions
diff --git a/server/Makefile b/server/Makefile new file mode 100644 index 0000000..a1c185b --- /dev/null +++ b/server/Makefile @@ -0,0 +1,5 @@ +all: + -$(MAKE) -C.. server + +clean: + -$(MAKE) -C.. clean-server diff --git a/server/dispatcher.erl b/server/dispatcher.erl index 77e4ab9..e5e0572 100644 --- a/server/dispatcher.erl +++ b/server/dispatcher.erl @@ -2,15 +2,29 @@ -export([start/0, init/0, handle/2]). start() -> + %% load server module from common directory, + %% used form server and client code:purge(server), code:load_abs("../common/server"), - spawn(media, init, []), + %% spawn media backend in seperat process + try spawn(media, init, []) of + _ -> + io:format("Media-Backend started!~n") + catch + _: Why -> + io:format("Error starting media backend: ~w! Exiting.~n", [Why]), + exit(1) + end, - case server:start(dis, dispatcher) of + %% start server (registered as dis) + %% server-module will call handle if message arrives and init to + %% initialize the status + try server:start(dis, dispatcher) of true -> - io:format("Server started... ~n"), - true; + io:format("Server started!~n"), + true + catch _ -> io:format("Error starting server! Exiting.~n"), exit(1) @@ -44,5 +58,6 @@ handle({login, {Node, User, Password}}, Dict) -> handle({'EXIT', _, _}, Dict) -> Dict; -handle(_, Dict) -> - {{error, unknown_command}, Dict}. +handle(Cmd, Dict) -> + %% standard command, to find transmission errors + {{error, {unknown_command, Cmd}}, Dict}. |