kore

An easy to use, scalable and secure web application framework for writing web APIs in C.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit 9ad263e2870964f8ae54fd0511885877b1faf466
parent 9243f409cc5384fde7042dfc86d874b57848c274
Author: Joris Vink <joris@coders.se>
Date:   Thu, 30 May 2013 20:07:06 +0200

do not remove disconnected connections until we actually are ready to disconnect them.

Diffstat:
includes/kore.h | 1+
src/kore.c | 3++-
2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/includes/kore.h b/includes/kore.h @@ -23,6 +23,7 @@ #define errno_s strerror(errno) #define ssl_errno_s ERR_error_string(ERR_get_error(), NULL) +#define KORE_DEBUG 1 #if defined(KORE_DEBUG) #define kore_log(fmt, ...) \ kore_log_internal(__FILE__, __LINE__, fmt, ##__VA_ARGS__) diff --git a/src/kore.c b/src/kore.c @@ -181,7 +181,6 @@ main(int argc, char *argv[]) for (c = TAILQ_FIRST(&disconnected); c != NULL; c = cnext) { cnext = TAILQ_NEXT(c, list); - TAILQ_REMOVE(&disconnected, c, list); kore_server_final_disconnect(c); } @@ -357,6 +356,7 @@ kore_server_final_disconnect(struct connection *c) SSL_free(c->ssl); } + TAILQ_REMOVE(&disconnected, c, list); close(c->fd); if (c->inflate_started) inflateEnd(&(c->z_inflate)); @@ -514,6 +514,7 @@ kore_worker_entry(void *arg) pthread_mutex_lock(&(kw->lock)); for (;;) { if (retry == 0) { + kore_log("worker %d going to sleep", kw->id); pthread_cond_wait(&(kw->cond), &(kw->lock)); kore_log("worker %d woke up with %d reqs", kw->id, kw->load);