diff options
author | José Bollo <jose.bollo@iot.bzh> | 2016-04-27 21:25:54 +0200 |
---|---|---|
committer | José Bollo <jose.bollo@iot.bzh> | 2016-04-27 21:30:01 +0200 |
commit | f262b0f726ac0577f40525038b779185f144873f (patch) | |
tree | c6c2e3664cb6082fcb74e7ef26e430ce2371f4fa /src/afb-hreq.c | |
parent | 34acb0f8d191593c9761e027424f13ae42831133 (diff) |
first add of asynchonous handling
Change-Id: Id9159d33937dc23342d32892f77998fb8cef0000
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afb-hreq.c')
-rw-r--r-- | src/afb-hreq.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/afb-hreq.c b/src/afb-hreq.c index c90b2372..6b7d64be 100644 --- a/src/afb-hreq.c +++ b/src/afb-hreq.c @@ -152,6 +152,10 @@ static void afb_hreq_reply_v(struct afb_hreq *hreq, unsigned status, struct MHD_ { char *cookie; const char *k, *v; + + if (hreq->replied != 0) + return; + k = va_arg(args, const char *); while (k != NULL) { v = va_arg(args, const char *); @@ -164,6 +168,14 @@ static void afb_hreq_reply_v(struct afb_hreq *hreq, unsigned status, struct MHD_ } MHD_queue_response(hreq->connection, status, response); MHD_destroy_response(response); + + hreq->replied = 1; + if (hreq->suspended != 0) { + extern void run_micro_httpd(struct afb_hsrv *hsrv); + MHD_resume_connection (hreq->connection); + hreq->suspended = 0; + run_micro_httpd(hreq->hsrv); + } } void afb_hreq_reply(struct afb_hreq *hreq, unsigned status, struct MHD_Response *response, ...) |