Commit da216f85 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Clean up session messages a bit


git-svn-id: http://www.varnish-cache.org/svn/trunk@184 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 4cb449c0
......@@ -61,7 +61,7 @@ extern struct stevedore *stevedore;
void vca_write(struct sess *sp, void *ptr, size_t len);
void vca_flush(struct sess *sp);
void vca_return_session(struct sess *sp);
void vca_close_session(struct sess *sp);
void vca_close_session(struct sess *sp, const char *why);
void VCA_Init(void);
/* cache_backend.c */
......
......@@ -63,11 +63,8 @@ vca_flush(struct sess *sp)
if (sp->fd < 0 || sp->mem->niov == 0)
return;
i = writev(sp->fd, sp->mem->iov, sp->mem->niov);
if (i != sp->mem->liov) {
VSL(SLT_SessionClose, sp->fd, "Premature %d of %d",
i, sp->mem->liov);
vca_close_session(sp);
}
if (i != sp->mem->liov)
vca_close_session(sp, "remote closed");
sp->mem->liov = 0;
sp->mem->niov = 0;
}
......@@ -180,10 +177,10 @@ vca_main(void *arg)
/*--------------------------------------------------------------------*/
void
vca_close_session(struct sess *sp)
vca_close_session(struct sess *sp, const char *why)
{
VSL(SLT_SessionClose, sp->fd, "%s", sp->addr);
VSL(SLT_SessionClose, sp->fd, why);
close(sp->fd);
sp->fd = -1;
}
......
......@@ -255,10 +255,13 @@ http_read_f(int fd, short event, void *arg)
i = read(fd, hp->v, hp->e - hp->v);
if (i <= 0) {
if (hp->v != hp->s)
VSL(SLT_SessionClose, fd,
"remote had %d bytes errno %d", hp->v - hp->s, errno);
VSL(SLT_HttpError, fd,
"Received (only) %d bytes, errno %d",
hp->v - hp->s, errno);
else if (errno == 0)
VSL(SLT_HttpError, fd, "Received nothing");
else
VSL(SLT_SessionClose, fd, "remote errno %d", errno);
VSL(SLT_HttpError, fd, "Received errno %d", errno);
hp->t = NULL;
event_del(&hp->ev);
if (hp->callback != NULL)
......
......@@ -75,6 +75,6 @@ PipeSession(struct worker *w, struct sess *sp)
event_add(&e2.ev, NULL);
event_base_loop(w->eb, 0);
close (fd);
vca_close_session(sp);
vca_close_session(sp, "pipe");
VBE_ClosedFd(fd_token);
}
......@@ -158,8 +158,7 @@ CacheWorker(void *priv)
}
if (http_GetHdr(sp->http, "Connection", &b) &&
!strcmp(b, "close")) {
VSL(SLT_SessionClose, sp->fd, "hdr");
vca_close_session(sp);
vca_close_session(sp, "Connection header");
}
AZ(pthread_mutex_lock(&sessmtx));
......@@ -175,7 +174,7 @@ DealWithSession(void *arg, int good)
struct sess *sp = arg;
if (!good) {
vca_close_session(sp);
vca_close_session(sp, "no request");
vca_return_session(sp);
return;
}
......
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