Commit 2608703b authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Give WRW a hint about which vsl to log to.

Consequent Constification
parent e65be4b1
......@@ -773,7 +773,7 @@ void VGZ_UpdateObj(const struct vgz*, struct object *);
int VGZ_WrwInit(struct vgz *vg);
int VGZ_WrwGunzip(struct worker *w, struct vgz *, const void *ibuf,
ssize_t ibufl);
void VGZ_WrwFlush(struct worker *wrk, struct vgz *vg);
void VGZ_WrwFlush(const struct worker *wrk, struct vgz *vg);
/* Return values */
#define VGZ_ERROR -1
......@@ -789,7 +789,7 @@ const char *http_StatusMessage(unsigned);
unsigned http_EstimateWS(const struct http *fm, unsigned how, uint16_t *nhd);
void HTTP_Init(void);
void http_ClrHeader(struct http *to);
unsigned http_Write(struct worker *w, const struct http *hp, int resp);
unsigned http_Write(const struct worker *w, const struct http *hp, int resp);
void http_SetResp(struct http *to, const char *proto, uint16_t status,
const char *response);
void http_FilterReq(const struct sess *sp, unsigned how);
......@@ -885,13 +885,13 @@ int Pool_Task(struct pool *pp, struct pool_task *task, enum pool_how how);
#define WRW_IsReleased(w) ((w)->wrw == NULL)
int WRW_Error(const struct worker *w);
void WRW_Chunked(struct worker *w);
void WRW_EndChunk(struct worker *w);
void WRW_Reserve(struct worker *w, int *fd, double t0);
unsigned WRW_Flush(struct worker *w);
void WRW_Chunked(const struct worker *w);
void WRW_EndChunk(const struct worker *w);
void WRW_Reserve(struct worker *w, int *fd, struct vsl_log *, double t0);
unsigned WRW_Flush(const struct worker *w);
unsigned WRW_FlushRelease(struct worker *w);
unsigned WRW_Write(struct worker *w, const void *ptr, int len);
unsigned WRW_WriteH(struct worker *w, const txt *hh, const char *suf);
unsigned WRW_Write(const struct worker *w, const void *ptr, int len);
unsigned WRW_WriteH(const struct worker *w, const txt *hh, const char *suf);
/* cache_session.c [SES] */
void SES_Close(struct sess *sp, const char *reason);
......
......@@ -113,7 +113,7 @@ ved_include(struct sess *sp, const char *src, const char *host)
WS_Reset(sp->req->ws, sp_ws_wm);
WS_Reset(w->aws, wrk_ws_wm); /* XXX ? */
WRW_Reserve(sp->wrk, &sp->fd, sp->req->t_resp);
WRW_Reserve(sp->wrk, &sp->fd, sp->req->vsl, sp->req->t_resp);
if (sp->req->res_mode & RES_CHUNKED)
WRW_Chunked(sp->wrk);
}
......
......@@ -428,7 +428,7 @@ FetchHdr(struct sess *sp, int need_host_hdr, int sendbody)
VDI_AddHostHeader(bo->bereq, vc);
(void)VTCP_blocking(vc->fd); /* XXX: we should timeout instead */
WRW_Reserve(wrk, &vc->fd, sp->t_req); /* XXX t_resp ? */
WRW_Reserve(wrk, &vc->fd, bo->vsl, sp->t_req); /* XXX t_resp ? */
(void)http_Write(wrk, hp, 0); /* XXX: stats ? */
/* Deal with any message-body the request might have */
......
......@@ -356,7 +356,7 @@ VGZ_WrwGunzip(struct worker *wrk, struct vgz *vg, const void *ibuf,
/*--------------------------------------------------------------------*/
void
VGZ_WrwFlush(struct worker *wrk, struct vgz *vg)
VGZ_WrwFlush(const struct worker *wrk, struct vgz *vg)
{
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC);
......
......@@ -1061,7 +1061,7 @@ HTTP_Copy(struct http *to, const struct http * const fm)
/*--------------------------------------------------------------------*/
unsigned
http_Write(struct worker *w, const struct http *hp, int resp)
http_Write(const struct worker *w, const struct http *hp, int resp)
{
unsigned u, l;
......
......@@ -80,7 +80,7 @@ PipeSession(struct sess *sp)
bo->vbc = vc; /* For panic dumping */
(void)VTCP_blocking(vc->fd);
WRW_Reserve(wrk, &vc->fd, sp->t_req);
WRW_Reserve(wrk, &vc->fd, bo->vsl, sp->t_req);
sp->wrk->acct_tmp.hdrbytes +=
http_Write(wrk, bo->bereq, 0);
......
......@@ -237,7 +237,7 @@ RES_WriteObj(struct sess *sp)
req = sp->req;
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
WRW_Reserve(sp->wrk, &sp->fd, sp->req->t_resp);
WRW_Reserve(sp->wrk, &sp->fd, sp->req->vsl, sp->req->t_resp);
if (req->obj->response == 200 &&
req->http->conds &&
......
......@@ -57,6 +57,7 @@ struct wrw {
ssize_t cliov;
unsigned ciov; /* Chunked header marker */
double t0;
struct vsl_log *vsl;
};
/*--------------------------------------------------------------------
......@@ -70,7 +71,7 @@ WRW_Error(const struct worker *wrk)
}
void
WRW_Reserve(struct worker *wrk, int *fd, double t0)
WRW_Reserve(struct worker *wrk, int *fd, struct vsl_log *vsl, double t0)
{
struct wrw *wrw;
unsigned u;
......@@ -95,6 +96,7 @@ WRW_Reserve(struct worker *wrk, int *fd, double t0)
wrw->niov = 0;
wrw->wfd = fd;
wrw->t0 = t0;
wrw->vsl = vsl;
wrk->wrw = wrw;
}
......@@ -136,7 +138,7 @@ wrw_prune(struct wrw *wrw, ssize_t bytes)
}
unsigned
WRW_Flush(struct worker *wrk)
WRW_Flush(const struct worker *wrk)
{
ssize_t i;
struct wrw *wrw;
......@@ -179,7 +181,7 @@ WRW_Flush(struct worker *wrk)
*/
if (VTIM_real() - wrw->t0 > cache_param->send_timeout) {
WSL(wrk->vsl, SLT_Debug, *wrw->wfd,
VSLb(wrw->vsl, SLT_Debug,
"Hit total send timeout, "
"wrote = %zd/%zd; not retrying",
i, wrw->liov);
......@@ -187,7 +189,7 @@ WRW_Flush(struct worker *wrk)
break;
}
WSL(wrk->vsl, SLT_Debug, *wrw->wfd,
VSLb(wrw->vsl, SLT_Debug,
"Hit send timeout, wrote = %zd/%zd; retrying",
i, wrw->liov);
......@@ -196,7 +198,7 @@ WRW_Flush(struct worker *wrk)
}
if (i <= 0) {
wrw->werr++;
WSL(wrk->vsl, SLT_Debug, *wrw->wfd,
VSLb(wrw->vsl, SLT_Debug,
"Write error, retval = %zd, len = %zd, errno = %s",
i, wrw->liov, strerror(errno));
}
......@@ -222,7 +224,7 @@ WRW_FlushRelease(struct worker *wrk)
}
unsigned
WRW_WriteH(struct worker *wrk, const txt *hh, const char *suf)
WRW_WriteH(const struct worker *wrk, const txt *hh, const char *suf)
{
unsigned u;
......@@ -239,7 +241,7 @@ WRW_WriteH(struct worker *wrk, const txt *hh, const char *suf)
}
unsigned
WRW_Write(struct worker *wrk, const void *ptr, int len)
WRW_Write(const struct worker *wrk, const void *ptr, int len)
{
struct wrw *wrw;
......@@ -265,7 +267,7 @@ WRW_Write(struct worker *wrk, const void *ptr, int len)
}
void
WRW_Chunked(struct worker *wrk)
WRW_Chunked(const struct worker *wrk)
{
struct wrw *wrw;
......@@ -294,7 +296,7 @@ WRW_Chunked(struct worker *wrk)
*/
void
WRW_EndChunk(struct worker *wrk)
WRW_EndChunk(const struct worker *wrk)
{
struct wrw *wrw;
......
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