Commit 72a8e80c authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Make the req.body iterator use same prototype as obj iterator

parent b44b1e94
......@@ -682,8 +682,7 @@ void VBO_waitstate(struct busyobj *bo, enum busyobj_state_e want);
/* cache_req_body.c */
int VRB_Ignore(struct req *req);
ssize_t VRB_Cache(struct req *req, ssize_t maxsize);
typedef int (req_body_iter_f)(struct req *, void *priv,
const void *ptr, size_t);
typedef int req_body_iter_f(void *priv, int flush, const void *ptr, ssize_t len);
ssize_t VRB_Iterate(struct req *req, req_body_iter_f *func, void *priv);
void VRB_Free(struct req *req);
......
......@@ -56,16 +56,15 @@ struct vrb_foo {
ssize_t ll;
};
static int
static int __match_proto__(objiterate_f)
vrb_objiterator(void *priv, int flush, const void *ptr, ssize_t len)
{
struct vrb_foo *foo;
CAST_OBJ_NOTNULL(foo, priv, VRB_FOO_MAGIC);
(void)flush;
foo->ll += len;
return (foo->func(foo->req, foo->priv, ptr, len));
return (foo->func(foo->priv, flush, ptr, len));
}
ssize_t
......@@ -144,7 +143,7 @@ VRB_Iterate(struct req *req, req_body_iter_f *func, void *priv)
req->req_bodybytes += l;
req->acct.req_bodybytes += l;
ll += l;
l = func(req, priv, buf, l);
l = func(priv, 1, buf, l);
if (l) {
req->req_body_status = REQ_BODY_FAIL;
ll = -1;
......@@ -165,11 +164,11 @@ VRB_Iterate(struct req *req, req_body_iter_f *func, void *priv)
*/
static int __match_proto__(req_body_iter_f)
httpq_req_body_discard(struct req *req, void *priv, const void *ptr, size_t len)
httpq_req_body_discard(void *priv, int flush, const void *ptr, ssize_t len)
{
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
(void)priv;
(void)flush;
(void)ptr;
(void)len;
return (0);
......
......@@ -49,16 +49,15 @@
*/
static int __match_proto__(req_body_iter_f)
vbf_iter_req_body(struct req *req, void *priv, const void *ptr, size_t l)
vbf_iter_req_body(void *priv, int flush, const void *ptr, ssize_t l)
{
struct busyobj *bo;
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
CAST_OBJ_NOTNULL(bo, priv, BUSYOBJ_MAGIC);
if (l > 0) {
bo->acct.bereq_bodybytes += V1L_Write(bo->wrk, ptr, l);
if (V1L_Flush(bo->wrk))
if (flush && V1L_Flush(bo->wrk))
return (-1);
}
return (0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment