
phk at varnish-cache
Jul 19, 2012, 1:30 AM
Post #1 of 1
(37 views)
Permalink
|
|
[master] 1172fc9 Various minor cleanups for code clarity.
|
|
commit 1172fc93e4d5d3827fcc2dc9abceaef96b1f5cb1 Author: Poul-Henning Kamp <phk [at] FreeBSD> Date: Thu Jul 19 08:29:54 2012 +0000 Various minor cleanups for code clarity. diff --git a/bin/varnishd/cache/cache_center.c b/bin/varnishd/cache/cache_center.c index 1fcaff4..c200bd3 100644 --- a/bin/varnishd/cache/cache_center.c +++ b/bin/varnishd/cache/cache_center.c @@ -175,8 +175,8 @@ cnt_wait(struct sess *sp, struct worker *wrk, struct req *req) } } } - AZ(req->vcl); SES_ReleaseReq(req); + assert(why != SC_NULL); SES_Delete(sp, why, now); return (1); } @@ -254,14 +254,8 @@ cnt_sess_done(struct sess *sp, struct worker *wrk, struct req *req) req->hash_always_miss = 0; req->hash_ignore_busy = 0; - if (sp->fd >= 0 && req->doclose != SC_NULL) { - /* - * This is an orderly close of the connection; ditch nolinger - * before we close, to get queued data transmitted. - */ - // XXX: not yet (void)VTCP_linger(sp->fd, 0); + if (sp->fd >= 0 && req->doclose != SC_NULL) SES_Close(sp, req->doclose); - } if (sp->fd < 0) { wrk->stats.sess_closed++; diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c index 5e994f7..6478a00 100644 --- a/bin/varnishd/cache/cache_session.c +++ b/bin/varnishd/cache/cache_session.c @@ -133,12 +133,9 @@ static void ses_req_pool_task(struct worker *wrk, void *arg) { struct req *req; - struct sess *sp; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CAST_OBJ_NOTNULL(req, arg, REQ_MAGIC); - sp = req->sp; - CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); THR_SetRequest(req); AZ(wrk->aws->r); @@ -180,6 +177,9 @@ ses_sess_pool_task(struct worker *wrk, void *arg) * * We use VSL() to get the sessions vxid and to make sure tha this * VSL comes before anything else for this session. + * + * This is a separate procedure only to isolate the two stack buffers. + * */ static void @@ -317,12 +317,7 @@ SES_Close(struct sess *sp, enum sess_close reason) } /*-------------------------------------------------------------------- - * (Close &) Free or Recycle a session. - * - * If the workspace has changed, deleted it, otherwise wash it, and put - * it up for adoption. - * - * XXX: We should also check nhttp + * Report and dismantle a session. */ void @@ -338,27 +333,18 @@ SES_Delete(struct sess *sp, enum sess_close reason, double now) if (reason != SC_NULL) SES_Close(sp, reason); + assert(sp->fd < 0); + if (isnan(now)) now = VTIM_real(); assert(!isnan(sp->t_open)); - assert(sp->fd < 0); - - if (*sp->addr == '\0') - strcpy(sp->addr, "-"); - if (*sp->port == '\0') - strcpy(sp->addr, "-"); b = &sp->acct_ses; - - VSL(SLT_SessClose, sp->vxid, - "%s %.3f %ju %ju %ju %ju %ju %ju", - sess_close_str(sp->reason, 0), - now - sp->t_open, - b->req, b->pipe, b->pass, - b->fetch, b->hdrbytes, b->bodybytes); + VSL(SLT_SessClose, sp->vxid, "%s %.3f %ju %ju %ju %ju %ju %ju", + sess_close_str(sp->reason, 0), now - sp->t_open, b->req, + b->pipe, b->pass, b->fetch, b->hdrbytes, b->bodybytes); MPL_Free(pp->mpl_sess, sp); - } /*-------------------------------------------------------------------- _______________________________________________ varnish-commit mailing list varnish-commit [at] varnish-cache https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit
|