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

ok that was wrong, disconnect http clients whne we're done sending or upon error, not immediately after queueing everything.

Diffstat:
src/http.c | 10+++++++++-
src/kore.c | 18++----------------
2 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/src/http.c b/src/http.c @@ -40,6 +40,7 @@ #include "http.h" static int http_post_data_recv(struct netbuf *); +static int http_send_done(struct netbuf *); int http_request_new(struct connection *c, struct spdy_stream *s, char *host, @@ -187,7 +188,7 @@ http_response(struct http_request *req, int status, u_int8_t *d, u_int32_t len) net_send_queue(req->owner, htext, hlen, 0, NULL, NULL); free(htext); - net_send_queue(req->owner, d, len, 0, NULL, NULL); + net_send_queue(req->owner, d, len, 0, NULL, http_send_done); } return (KORE_RESULT_OK); @@ -439,3 +440,10 @@ http_post_data_recv(struct netbuf *nb) return (KORE_RESULT_OK); } + +static int +http_send_done(struct netbuf *nb) +{ + /* disconnects. */ + return (KORE_RESULT_ERROR); +} diff --git a/src/kore.c b/src/kore.c @@ -388,17 +388,8 @@ kore_server_final_disconnect(struct connection *c) return; } - if (!TAILQ_EMPTY(&(c->send_queue))) - return; - - if (c->ssl != NULL) { - if (SSL_shutdown(c->ssl) == 0) { - pthread_mutex_unlock(&(c->lock)); - return; - } - + if (c->ssl != NULL) SSL_free(c->ssl); - } kore_log("kore_server_final_disconnect(%p) succeeded", c); TAILQ_REMOVE(&disconnected, c, list); @@ -513,10 +504,6 @@ 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); @@ -591,8 +578,7 @@ kore_worker_entry(void *arg) if (r != KORE_RESULT_ERROR) { r = net_send_flush(req->owner); - if (r == KORE_RESULT_ERROR || - req->owner->proto == CONN_PROTO_HTTP) + if (r == KORE_RESULT_ERROR) kore_server_disconnect(req->owner); } else { kore_server_disconnect(req->owner);