};
struct backend {
+ const char *vcl_name;
const char *hostname;
const char *portname;
unsigned ip;
fd = VBE_GetFd(sp->backend, &fd_token);
assert(fd != -1);
- VSL(SLT_Handling, sp->fd, "Fetch fd %d", fd);
+ VSL(SLT_Backend, sp->fd, "%d %s", fd, sp->backend->vcl_name);
hp = http_New();
http_BuildSbuf(1, w->sb, sp->http);
for (done = 0; !done; ) {
switch(sp->handling) {
case VCL_RET_LOOKUP:
- VSL(SLT_Handling, sp->fd, "Lookup");
done = LookupSession(&w, sp);
break;
case VCL_RET_FETCH:
done = FetchSession(&w, sp);
break;
case VCL_RET_DELIVER:
- VSL(SLT_Handling, sp->fd, "Deliver");
done = DeliverSession(&w, sp);
break;
case VCL_RET_PIPE:
- VSL(SLT_Handling, sp->fd, "Pipe");
PipeSession(&w, sp);
done = 1;
break;
case VCL_RET_PASS:
- VSL(SLT_Handling, sp->fd, "Pass");
PassSession(&w, sp);
done = 1;
break;
u = sp->handling;
n = HandlingName(u);
- if (n != NULL)
- VSL(SLT_Handling, sp->fd, "%s(): %s", func, n);
- else
- VSL(SLT_Handling, sp->fd, "%s(): Illegal: 0x%x", func, u);
if (u & (u - 1))
- VSL(SLT_Debug, sp->fd,
+ VSL(SLT_Error, sp->fd,
"Illegal handling after %s function: 0x%x", func, u);
else if (!(u & bitmap))
- VSL(SLT_Debug, sp->fd,
+ VSL(SLT_Error, sp->fd,
"Wrong handling after %s function: 0x%x", func, u);
else
return;
sp->handling = 0; \
sp->vcl->func##_func(sp); \
CheckHandling(sp, #func, (bitmap)); \
+ VSL(SLT_vcl_##func, sp->fd, "%s", HandlingName(sp->handling)); \
}
#define VCL_RET_MAC(l,u,b)
be->portname = p;
}
+void
+VRT_set_backend_name(struct backend *be, const char *p)
+{
+ be->vcl_name = p;
+}
+
void
VRT_alloc_backends(struct VCL_conf *cp)
{
*/
SLTM(Debug)
+SLTM(Error)
SLTM(CLI)
SLTM(SessionOpen)
SLTM(SessionReuse)
SLTM(BackendClose)
SLTM(HttpError)
SLTM(ClientAddr)
-SLTM(Handling)
+#define VCL_RET_MAC(l,u,b)
+#define VCL_MET_MAC(l,u,b) SLTM(vcl_##l)
+#include "vcl_returns.h"
+#undef VCL_MET_MAC
+#undef VCL_RET_MAC
+SLTM(Backend)
SLTM(Request)
SLTM(Response)
SLTM(Status)
int VRT_obj_valid(struct sess *);
int VRT_obj_cacheable(struct sess *);
+void VRT_set_backend_name(struct backend *, const char *);
void VRT_set_backend_hostname(struct backend *, const char *);
void VRT_set_backend_portname(struct backend *, const char *);
#include <errno.h>
#include <fcntl.h>
#include <netdb.h>
-#include <sbuf.h>
#include <stdio.h>
+#include <sbuf.h>
#include <stdlib.h>
#include <string.h>
#include <queue.h>
tl->t->e - tl->t->b,
tl->t->e - tl->t->b, tl->t->b);
I(tl); sbuf_printf(tl->fc, "\tconst char *p;\n");
+ I(tl); sbuf_printf(tl->fc, "\n");
+ I(tl); sbuf_printf(tl->fc,
+ "\tVRT_set_backend_name(backend, \"%*.*s\");\n",
+ tl->t->e - tl->t->b,
+ tl->t->e - tl->t->b, tl->t->b);
NextToken(tl);
ExpectErr(tl, '{');
NextToken(tl);
fputs("int VRT_obj_valid(struct sess *);\n", f);
fputs("int VRT_obj_cacheable(struct sess *);\n", f);
fputs("\n", f);
+ fputs("void VRT_set_backend_name(struct backend *, const char *);\n", f);
fputs("void VRT_set_backend_hostname(struct backend *, const char *);\n", f);
fputs("void VRT_set_backend_portname(struct backend *, const char *);\n", f);
fputs("\n", f);