Commit 2592b945 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

VFP_update_length() was misnamed: It is not a VFP function at all,

it is a VBO function which extends the busy object with data which
streaming clients can access.

Name it VBO_extend() instead and move it home to the rest of the
VBO functions.
parent 691e8839
...@@ -268,7 +268,7 @@ struct dstat { ...@@ -268,7 +268,7 @@ struct dstat {
/* Fetch processors --------------------------------------------------*/ /* Fetch processors --------------------------------------------------*/
void VFP_update_length(const struct busyobj *, ssize_t); void VBO_extend(const struct busyobj *, ssize_t);
typedef void vfp_begin_f(struct busyobj *, size_t ); typedef void vfp_begin_f(struct busyobj *, size_t );
typedef int vfp_bytes_f(struct busyobj *, struct http_conn *, ssize_t); typedef int vfp_bytes_f(struct busyobj *, struct http_conn *, ssize_t);
......
...@@ -189,3 +189,15 @@ VBO_DerefBusyObj(struct worker *wrk, struct busyobj **pbo) ...@@ -189,3 +189,15 @@ VBO_DerefBusyObj(struct worker *wrk, struct busyobj **pbo)
else else
VBO_Free(&bo); VBO_Free(&bo);
} }
void
VBO_extend(const struct busyobj *bo, ssize_t l)
{
CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
CHECK_OBJ_NOTNULL(bo->fetch_obj, OBJECT_MAGIC);
if (l == 0)
return;
assert(l > 0);
bo->fetch_obj->len += l;
}
...@@ -103,7 +103,7 @@ vfp_esi_bytes_uu(struct busyobj *bo, const struct vef_priv *vef, ...@@ -103,7 +103,7 @@ vfp_esi_bytes_uu(struct busyobj *bo, const struct vef_priv *vef,
return (wl); return (wl);
VEP_Parse(bo, (const char *)st->ptr + st->len, wl); VEP_Parse(bo, (const char *)st->ptr + st->len, wl);
st->len += wl; st->len += wl;
VFP_update_length(bo, wl); VBO_extend(bo, wl);
bytes -= wl; bytes -= wl;
} }
return (1); return (1);
...@@ -142,7 +142,7 @@ vfp_esi_bytes_gu(struct busyobj *bo, const struct vef_priv *vef, ...@@ -142,7 +142,7 @@ vfp_esi_bytes_gu(struct busyobj *bo, const struct vef_priv *vef,
return (-1); return (-1);
if (dl > 0) { if (dl > 0) {
VEP_Parse(bo, dp, dl); VEP_Parse(bo, dp, dl);
VFP_update_length(bo, dl); VBO_extend(bo, dl);
} }
} }
return (1); return (1);
...@@ -220,7 +220,7 @@ vfp_vep_callback(struct busyobj *bo, ssize_t l, enum vgz_flag flg) ...@@ -220,7 +220,7 @@ vfp_vep_callback(struct busyobj *bo, ssize_t l, enum vgz_flag flg)
} }
i = VGZ_Gzip(vef->vgz, &dp, &dl, flg); i = VGZ_Gzip(vef->vgz, &dp, &dl, flg);
vef->tot += dl; vef->tot += dl;
VFP_update_length(bo, dl); VBO_extend(bo, dl);
} while (!VGZ_IbufEmpty(vef->vgz) || } while (!VGZ_IbufEmpty(vef->vgz) ||
(flg != VGZ_NORMAL && VGZ_ObufFull(vef->vgz))); (flg != VGZ_NORMAL && VGZ_ObufFull(vef->vgz)));
assert(VGZ_IbufEmpty(vef->vgz)); assert(VGZ_IbufEmpty(vef->vgz));
......
...@@ -113,18 +113,6 @@ VFP_End(struct busyobj *bo) ...@@ -113,18 +113,6 @@ VFP_End(struct busyobj *bo)
assert(bo->state == BOS_FAILED); assert(bo->state == BOS_FAILED);
} }
void
VFP_update_length(const struct busyobj *bo, ssize_t l)
{
CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
CHECK_OBJ_NOTNULL(bo->fetch_obj, OBJECT_MAGIC);
if (l == 0)
return;
assert(l > 0);
bo->fetch_obj->len += l;
}
/*-------------------------------------------------------------------- /*--------------------------------------------------------------------
* VFP_NOP * VFP_NOP
* *
...@@ -176,7 +164,7 @@ vfp_nop_bytes(struct busyobj *bo, struct http_conn *htc, ssize_t bytes) ...@@ -176,7 +164,7 @@ vfp_nop_bytes(struct busyobj *bo, struct http_conn *htc, ssize_t bytes)
if (wl <= 0) if (wl <= 0)
return (wl); return (wl);
st->len += wl; st->len += wl;
VFP_update_length(bo, wl); VBO_extend(bo, wl);
bytes -= wl; bytes -= wl;
} }
return (1); return (1);
......
...@@ -480,7 +480,7 @@ vfp_gunzip_bytes(struct busyobj *bo, struct http_conn *htc, ssize_t bytes) ...@@ -480,7 +480,7 @@ vfp_gunzip_bytes(struct busyobj *bo, struct http_conn *htc, ssize_t bytes)
i = VGZ_Gunzip(vg, &dp, &dl); i = VGZ_Gunzip(vg, &dp, &dl);
if (i != VGZ_OK && i != VGZ_END) if (i != VGZ_OK && i != VGZ_END)
return(FetchError(bo, "Gunzip data error")); return(FetchError(bo, "Gunzip data error"));
VFP_update_length(bo, dl); VBO_extend(bo, dl);
} }
assert(i == Z_OK || i == Z_STREAM_END); assert(i == Z_OK || i == Z_STREAM_END);
return (1); return (1);
...@@ -555,7 +555,7 @@ vfp_gzip_bytes(struct busyobj *bo, struct http_conn *htc, ssize_t bytes) ...@@ -555,7 +555,7 @@ vfp_gzip_bytes(struct busyobj *bo, struct http_conn *htc, ssize_t bytes)
return(-1); return(-1);
i = VGZ_Gzip(vg, &dp, &dl, VGZ_NORMAL); i = VGZ_Gzip(vg, &dp, &dl, VGZ_NORMAL);
assert(i == Z_OK); assert(i == Z_OK);
VFP_update_length(bo, dl); VBO_extend(bo, dl);
} }
return (1); return (1);
} }
...@@ -581,7 +581,7 @@ vfp_gzip_end(struct busyobj *bo) ...@@ -581,7 +581,7 @@ vfp_gzip_end(struct busyobj *bo)
if (VGZ_ObufStorage(bo, vg)) if (VGZ_ObufStorage(bo, vg))
return(-1); return(-1);
i = VGZ_Gzip(vg, &dp, &dl, VGZ_FINISH); i = VGZ_Gzip(vg, &dp, &dl, VGZ_FINISH);
VFP_update_length(bo, dl); VBO_extend(bo, dl);
} while (i != Z_STREAM_END); } while (i != Z_STREAM_END);
VGZ_UpdateObj(vg, bo->fetch_obj); VGZ_UpdateObj(vg, bo->fetch_obj);
if (VGZ_Destroy(&vg) != VGZ_END) if (VGZ_Destroy(&vg) != VGZ_END)
...@@ -639,7 +639,7 @@ vfp_testgzip_bytes(struct busyobj *bo, struct http_conn *htc, ssize_t bytes) ...@@ -639,7 +639,7 @@ vfp_testgzip_bytes(struct busyobj *bo, struct http_conn *htc, ssize_t bytes)
bytes -= wl; bytes -= wl;
VGZ_Ibuf(vg, st->ptr + st->len, wl); VGZ_Ibuf(vg, st->ptr + st->len, wl);
st->len += wl; st->len += wl;
VFP_update_length(bo, wl); VBO_extend(bo, wl);
while (!VGZ_IbufEmpty(vg)) { while (!VGZ_IbufEmpty(vg)) {
VGZ_Obuf(vg, vg->m_buf, vg->m_sz); VGZ_Obuf(vg, vg->m_buf, vg->m_sz);
......
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