* XXX: this is probably one we should handle
* XXX: accept, emit error NNN and close
*/
+ VSL_stats->n_sess++;
sp = &sm->s;
sp->rd_e = &sm->e;
} else {
if (sp->http != NULL)
http_Delete(sp->http);
+ VSL_stats->n_sess--;
free(sp->mem);
}
}
memset(&hint, 0, sizeof hint);
hint.ai_family = PF_UNSPEC;
hint.ai_socktype = SOCK_STREAM;
+ res = NULL;
error = getaddrinfo(bp->hostname,
bp->portname == NULL ? "http" : bp->portname,
&hint, &res);
if (error) {
+ if (res != NULL)
+ freeaddrinfo(res);
fprintf(stderr, "getaddrinfo: %s\n",
gai_strerror(error));
return;
if (vc->fd < 0) {
vc->vbe->nconn--;
free(vc);
+ VSL_stats->n_vbe_conn--;
} else {
vc->inuse = 0;
event_add(&vc->ev, NULL);
event_del(&vc->ev);
close(vc->fd);
free(vc);
+ VSL_stats->n_vbe_conn--;
}
/* Backend monitoring thread -----------------------------------------*/
if (vp == NULL) {
vp = calloc(sizeof *vp, 1);
assert(vp != NULL);
+ VSL_stats->n_vbe++;
TAILQ_INIT(&vp->fconn);
TAILQ_INIT(&vp->bconn);
vp->ip = bp->ip;
AZ(pthread_mutex_unlock(&vbemtx));
} else {
vc = calloc(sizeof *vc, 1);
+ VSL_stats->n_vbe_conn++;
assert(vc != NULL);
vc->vbe = vp;
vc->fd = -1;
cls = 0;
sbuf_finish(w->sb);
sp->obj->header = strdup(sbuf_data(w->sb));
+ VSL_stats->n_header++;
vca_write_obj(w, sp);
assert(w->nobjhead != NULL);
TAILQ_INIT(&w->nobjhead->objects);
AZ(pthread_mutex_init(&w->nobjhead->mtx, NULL));
+ VSL_stats->n_objecthead++;
}
if (w->nobj == NULL) {
w->nobj = calloc(sizeof *w->nobj, 1);
w->nobj->busy = 1;
TAILQ_INIT(&w->nobj->store);
AZ(pthread_cond_init(&w->nobj->cv, NULL));
+ VSL_stats->n_object++;
}
assert(http_GetURL(h, &b));
if (o == NULL)
return;
- free(o->header);
+ if (o->header != NULL) {
+ free(o->header);
+ VSL_stats->n_header--;
+ }
AZ(pthread_cond_destroy(&o->cv));
TAILQ_FOREACH_SAFE(st, &o->store, list, stn) {
st->stevedore->free(st);
}
free(o);
+ VSL_stats->n_object--;
/* Drop our ref on the objhead */
if (hash->deref(oh))
return;
assert(TAILQ_EMPTY(&oh->objects));
AZ(pthread_mutex_destroy(&oh->mtx));
+ VSL_stats->n_objecthead--;
free(oh);
}
hp = calloc(sizeof *hp, 1);
assert(hp != NULL);
+ VSL_stats->n_http++;
hp->s = malloc(http_bufsize);
assert(hp->s != NULL);
free(hp->hdr);
free(hp->s);
free(hp);
+ VSL_stats->n_http--;
}
/*--------------------------------------------------------------------*/
unsigned l;
assert(hp != NULL);
+ VSL(SLT_Debug, fd, "Recv t %u v %u", hp->t - hp->s, hp->v - hp->s);
if (hp->t > hp->s && hp->t < hp->v) {
l = hp->v - hp->t;
memmove(hp->s, hp->t, l);
hp->v = hp->s + l;
+ hp->t = hp->s;
if (http_header_complete(hp)) {
func(arg, 1);
return;
#include <sys/socket.h>
#include "libvarnish.h"
+#include "shmlog.h"
#include "cache.h"
#define MINPAGES 128
/* Split from front */
sp2 = malloc(sizeof *sp2);
assert(sp2 != NULL);
+ VSL_stats->n_smf++;
*sp2 = *sp;
sp->offset += bytes;
TAILQ_REMOVE(&sc->order, sp2, order);
TAILQ_REMOVE(&sc->free, sp2, status);
free(sp2);
+ VSL_stats->n_smf--;
}
sp2 = TAILQ_PREV(sp, smfhead, order);
sp2->age = sp->age;
TAILQ_REMOVE(&sc->order, sp, order);
free(sp);
+ VSL_stats->n_smf--;
TAILQ_REMOVE(&sc->free, sp2, status);
sp = sp2;
}
assert(bytes > 0);
sp2 = malloc(sizeof *sp2);
assert(sp2 != NULL);
+ VSL_stats->n_smf++;
*sp2 = *sp;
sp2->size -= bytes;
sp = calloc(sizeof *sp, 1);
assert(sp != NULL);
+ VSL_stats->n_smf++;
sp->sc = sc;
MAC_STAT(backend_conn, uint64_t, "u", "Backend connections initiated")
MAC_STAT(backend_recycle, uint64_t, "u", "Backend connections recyles")
+MAC_STAT(n_sess, uint64_t, "u", "N struct sess");
+MAC_STAT(n_object, uint64_t, "u", "N struct object");
+MAC_STAT(n_objecthead, uint64_t, "u", "N struct objecthead");
+MAC_STAT(n_header, uint64_t, "u", "N struct header");
+MAC_STAT(n_smf, uint64_t, "u", "N struct smf");
+MAC_STAT(n_http, uint64_t, "u", "N struct http");
+MAC_STAT(n_vbe, uint64_t, "u", "N struct vbe");
+MAC_STAT(n_vbe_conn, uint64_t, "u", "N struct vbe_conn");
+
+