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

This commit is contained in:
Joris Vink 2013-05-30 20:07:06 +02:00
parent 9243f409cc
commit 9ad263e287
2 changed files with 3 additions and 1 deletions

View File

@ -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__)

View File

@ -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);