diff options
author | florian | 2013-10-18 14:48:54 +0000 |
---|---|---|
committer | Wynn Wolf Arbor | 2020-05-24 12:33:55 +0200 |
commit | da0da57b202826af381c742d75db2330f4f52ea6 (patch) | |
tree | c54b6d6088d994978fc89f17659ffe02f3cd68ef | |
parent | 49e2e9cf1e8551591ed92de0b971c8780b6c313c (diff) | |
download | slowcgi-da0da57b202826af381c742d75db2330f4f52ea6.tar.gz |
Do not fiddle with the response queue directly but go through a new slowcgi_add_response() function. This ensures that we always do an event_add. OK blambert
Diffstat (limited to '')
-rw-r--r-- | slowcgi.c | 21 |
1 files changed, 12 insertions, 9 deletions
@@ -1,4 +1,4 @@ -/* $OpenBSD: slowcgi.c,v 1.16 2013/10/18 14:47:47 florian Exp $ */ +/* $OpenBSD: slowcgi.c,v 1.17 2013/10/18 14:48:54 florian Exp $ */ /* * Copyright (c) 2013 David Gwynne <dlg@openbsd.org> * Copyright (c) 2013 Florian Obser <florian@openbsd.org> @@ -157,6 +157,7 @@ void slowcgi_paused(int, short, void *); void slowcgi_accept(int, short, void *); void slowcgi_request(int, short, void *); void slowcgi_response(int, short, void *); +void slowcgi_add_response(struct request *, struct fcgi_response *); void slowcgi_timeout(int, short, void *); void slowcgi_sig_handler(int, short, void *); size_t parse_record(uint8_t * , size_t, struct request *); @@ -422,7 +423,7 @@ slowcgi_accept(int fd, short events, void *arg) event_set(&c->ev, s, EV_READ | EV_PERSIST, slowcgi_request, c); event_add(&c->ev, NULL); - + event_set(&c->resp_ev, s, EV_WRITE | EV_PERSIST, slowcgi_response, c); event_set(&c->tmo, s, 0, slowcgi_timeout, c); event_add(&c->tmo, &timeout); requests->request = c; @@ -481,6 +482,13 @@ slowcgi_sig_handler(int sig, short event, void *arg) } void +slowcgi_add_response(struct request *c, struct fcgi_response *resp) +{ + TAILQ_INSERT_TAIL(&c->response_head, resp, entry); + event_add(&c->resp_ev, NULL); +} + +void slowcgi_response(int fd, short events, void *arg) { struct request *c; @@ -865,7 +873,7 @@ create_end_record(struct request *c) resp->data_pos = 0; resp->data_len = sizeof(struct fcgi_end_request_body) + sizeof(struct fcgi_record_header); - TAILQ_INSERT_TAIL(&c->response_head, resp, entry); + slowcgi_add_response(c, resp); } void @@ -902,12 +910,7 @@ script_in(int fd, struct event *ev, struct request *c, uint8_t type) header->content_len = htons(n); resp->data_pos = 0; resp->data_len = n + sizeof(struct fcgi_record_header); - TAILQ_INSERT_TAIL(&c->response_head, resp, entry); - - event_del(&c->resp_ev); - event_set(&c->resp_ev, EVENT_FD(&c->ev), EV_WRITE | EV_PERSIST, - slowcgi_response, c); - event_add(&c->resp_ev, NULL); + slowcgi_add_response(c, resp); if (n == 0) { if (type == FCGI_STDOUT) |