Commit 000f1991 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp Committed by Tollef Fog Heen

Make EXP_NukeOne() make do with a struct worker arg instead of sess.

parent f85a52c0
...@@ -714,7 +714,7 @@ void EXP_Inject(struct objcore *oc, struct lru *lru, double when); ...@@ -714,7 +714,7 @@ void EXP_Inject(struct objcore *oc, struct lru *lru, double when);
void EXP_Init(void); void EXP_Init(void);
void EXP_Rearm(const struct object *o); void EXP_Rearm(const struct object *o);
int EXP_Touch(struct objcore *oc); int EXP_Touch(struct objcore *oc);
int EXP_NukeOne(const struct sess *sp, struct lru *lru); int EXP_NukeOne(struct worker *w, struct lru *lru);
/* cache_fetch.c */ /* cache_fetch.c */
struct storage *FetchStorage(const struct sess *sp, ssize_t sz); struct storage *FetchStorage(const struct sess *sp, ssize_t sz);
......
...@@ -441,8 +441,8 @@ cnt_error(struct sess *sp) ...@@ -441,8 +441,8 @@ cnt_error(struct sess *sp)
&w->exp, (uint16_t)params->http_max_hdr); &w->exp, (uint16_t)params->http_max_hdr);
if (sp->obj == NULL) if (sp->obj == NULL)
sp->obj = STV_NewObject(sp, TRANSIENT_STORAGE, sp->obj = STV_NewObject(sp, TRANSIENT_STORAGE,
params->http_resp_size , &w->exp, params->http_resp_size, &w->exp,
(uint16_t)params->http_max_hdr); (uint16_t)params->http_max_hdr);
if (sp->obj == NULL) { if (sp->obj == NULL) {
sp->doclose = "Out of objects"; sp->doclose = "Out of objects";
sp->director = NULL; sp->director = NULL;
......
...@@ -417,7 +417,7 @@ exp_timer(struct sess *sp, void *priv) ...@@ -417,7 +417,7 @@ exp_timer(struct sess *sp, void *priv)
*/ */
int int
EXP_NukeOne(const struct sess *sp, struct lru *lru) EXP_NukeOne(struct worker *w, struct lru *lru)
{ {
struct objcore *oc; struct objcore *oc;
struct object *o; struct object *o;
...@@ -449,9 +449,9 @@ EXP_NukeOne(const struct sess *sp, struct lru *lru) ...@@ -449,9 +449,9 @@ EXP_NukeOne(const struct sess *sp, struct lru *lru)
return (-1); return (-1);
/* XXX: bad idea for -spersistent */ /* XXX: bad idea for -spersistent */
o = oc_getobj(sp->wrk, oc); o = oc_getobj(w, oc);
WSL(sp->wrk, SLT_ExpKill, 0, "%u LRU", o->xid); WSL(w, SLT_ExpKill, 0, "%u LRU", o->xid);
(void)HSH_Deref(sp->wrk, NULL, &o); (void)HSH_Deref(w, NULL, &o);
return (1); return (1);
} }
......
...@@ -1003,7 +1003,6 @@ http_PutResponse(struct worker *w, int fd, const struct http *to, ...@@ -1003,7 +1003,6 @@ http_PutResponse(struct worker *w, int fd, const struct http *to,
if (to->hd[HTTP_HDR_RESPONSE].b == NULL) if (to->hd[HTTP_HDR_RESPONSE].b == NULL)
http_SetH(to, HTTP_HDR_RESPONSE, "Lost Response"); http_SetH(to, HTTP_HDR_RESPONSE, "Lost Response");
Tcheck(to->hd[HTTP_HDR_RESPONSE]); Tcheck(to->hd[HTTP_HDR_RESPONSE]);
} }
void void
......
...@@ -183,7 +183,7 @@ stv_alloc(const struct sess *sp, size_t size) ...@@ -183,7 +183,7 @@ stv_alloc(const struct sess *sp, size_t size)
} }
/* no luck; try to free some space and keep trying */ /* no luck; try to free some space and keep trying */
if (EXP_NukeOne(sp, stv->lru) == -1) if (EXP_NukeOne(sp->wrk, stv->lru) == -1)
break; break;
/* Enough is enough: try another if we have one */ /* Enough is enough: try another if we have one */
...@@ -335,7 +335,7 @@ STV_NewObject(struct sess *sp, const char *hint, unsigned wsl, struct exp *ep, ...@@ -335,7 +335,7 @@ STV_NewObject(struct sess *sp, const char *hint, unsigned wsl, struct exp *ep,
if (o == NULL) { if (o == NULL) {
/* no luck; try to free some space and keep trying */ /* no luck; try to free some space and keep trying */
for (i = 0; o == NULL && i < params->nuke_limit; i++) { for (i = 0; o == NULL && i < params->nuke_limit; i++) {
if (EXP_NukeOne(sp, stv->lru) == -1) if (EXP_NukeOne(sp->wrk, stv->lru) == -1)
break; break;
o = stv->allocobj(stv, sp, ltot, &soc); o = stv->allocobj(stv, sp, ltot, &soc);
} }
......
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