kore

Kore is a web application platform for writing scalable, concurrent web based processes in C or Python.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit 428818c76b88dfec0c596dabdecf98effd28a21a
parent 21035cd3f2ccce0dde7ffde2e806e953c66dcab6
Author: Joris Vink <joris@coders.se>
Date:   Thu, 28 May 2015 19:58:06 +0200

Correct the module its init() function.

Diffstat:
examples/video_stream/src/stream.c | 17++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/examples/video_stream/src/stream.c b/examples/video_stream/src/stream.c @@ -37,7 +37,7 @@ struct video { TAILQ_ENTRY(video) list; }; -void init(int); +int init(int); int serve_page(struct http_request *); int video_stream(struct http_request *); @@ -48,17 +48,16 @@ static int video_open(struct http_request *, struct video **); TAILQ_HEAD(, video) videos; -void +int init(int state) { - switch (state) { - case KORE_MODULE_LOAD: - TAILQ_INIT(&videos); - break; - case KORE_MODULE_UNLOAD: - fatal("cannot reload this module, i should fix this"); - break; + if (state == KORE_MODULE_UNLOAD) { + kore_log(LOG_NOTICE, "not reloading module"); + return (KORE_RESULT_ERROR); } + + TAILQ_INIT(&videos); + return (KORE_RESULT_OK); } int