From 865b9c199dbd0cdbec26b2b233117951dcf59113 Mon Sep 17 00:00:00 2001 From: Unbit Date: Wed, 1 Oct 2014 01:35:09 +0200 Subject: [PATCH] improved offload api --- core/offload.c | 6 ++++++ uwsgi.h | 3 +++ 2 files changed, 9 insertions(+) diff --git a/core/offload.c b/core/offload.c index dd7af3c7..d77bc9b9 100644 --- a/core/offload.c +++ b/core/offload.c @@ -162,6 +162,12 @@ static int u_offload_sendfile_prepare(struct wsgi_request *wsgi_req, struct uwsg } static void uwsgi_offload_close(struct uwsgi_thread *ut, struct uwsgi_offload_request *uor) { + + // call the free function asap + if (uor->free) { + uor->free(uor); + } + // close the socket and the file descriptor if (uor->takeover && uor->s > -1) { close(uor->s); diff --git a/uwsgi.h b/uwsgi.h index 119ed38e..cd587f41 100644 --- a/uwsgi.h +++ b/uwsgi.h @@ -4266,6 +4266,9 @@ struct uwsgi_offload_request { int64_t custom6; int64_t custom7; int64_t custom8; + + void *data; + void (*free)(struct uwsgi_offload_request *); }; struct uwsgi_offload_engine {