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 ca1c884e43ccc18734ae1ab47060acd1012e5889
parent 791aba1e82ad223cbee4996f3d2f06c805e595e1
Author: Joris Vink <joris@coders.se>
Date:   Thu, 30 May 2013 21:39:01 +0200

attempt to clear out send buffer before we shutdown ssl connection.
remove superfleaous debug

Diffstat:
src/kore.c | 10++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/kore.c b/src/kore.c @@ -215,7 +215,6 @@ main(int argc, char *argv[]) pthread_mutex_unlock(&(sched->c->lock)); - kore_log("handled rescheduled %p", sched->c); TAILQ_REMOVE(&reschedule_list, sched, list); free(sched); } @@ -389,7 +388,8 @@ kore_server_final_disconnect(struct connection *c) return; } - kore_log("kore_server_final_disconnect(%p)", c); + if (!TAILQ_EMPTY(&(c->send_queue))) + return; if (c->ssl != NULL) { if (SSL_shutdown(c->ssl) == 0) { @@ -513,6 +513,10 @@ kore_connection_handle(struct connection *c, int flags) } break; case CONN_STATE_DISCONNECTING: + if (c->flags & CONN_WRITE_POSSIBLE) { + if (!net_send_flush(c)) + return (KORE_RESULT_ERROR); + } break; default: kore_log("unknown state on %d (%d)", c->fd, c->state); @@ -662,8 +666,6 @@ kore_reschedule(struct connection *c, int reason, int events) { struct reschedule *sched; - kore_log("kore_reschedule(%p, %d, %d)", c, reason, events); - sched = (struct reschedule *)kore_malloc(sizeof(*sched)); sched->c = c; sched->reason = reason;