[master] 3d5911a Give panic access to the sessions transport protocol via the session number.
Poul-Henning Kamp
phk at FreeBSD.org
Fri Feb 12 11:33:13 CET 2016
commit 3d5911a0b2d76b5f5acf728ddca36465a8aa700a
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Fri Feb 12 10:32:42 2016 +0000
Give panic access to the sessions transport protocol via the
session number.
diff --git a/bin/varnishd/cache/cache_acceptor.c b/bin/varnishd/cache/cache_acceptor.c
index ee51e53..42fd3f0 100644
--- a/bin/varnishd/cache/cache_acceptor.c
+++ b/bin/varnishd/cache/cache_acceptor.c
@@ -638,7 +638,7 @@ XPORT_Init(void)
const struct transport *
XPORT_Find(const char *name)
{
- struct transport *xp;
+ const struct transport *xp;
ASSERT_MGT();
@@ -647,3 +647,14 @@ XPORT_Find(const char *name)
return (xp);
return (NULL);
}
+
+const struct transport *
+XPORT_ByNumber(uint16_t no)
+{
+ const struct transport *xp;
+
+ VTAILQ_FOREACH(xp, &transports, list)
+ if (xp->number == no)
+ return (xp);
+ return (NULL);
+}
diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c
index 5f960b4..c2f0db7 100644
--- a/bin/varnishd/cache/cache_panic.c
+++ b/bin/varnishd/cache/cache_panic.c
@@ -445,13 +445,16 @@ pan_sess(struct vsb *vsb, const struct sess *sp)
const char *stp;
const char *ci;
const char *cp;
+ const struct transport *xp;
VSB_printf(vsb, "sp = %p {\n", sp);
if (pan_already(vsb, sp))
return;
VSB_indent(vsb, 2);
- VSB_printf(vsb, "fd = %d, vxid = %u\n",
- sp->fd, VXID(sp->vxid));
+ xp = XPORT_ByNumber(sp->sattr[SA_TRANSPORT]);
+ VSB_printf(vsb, "fd = %d, vxid = %u, transport = %s\n",
+ sp->fd, VXID(sp->vxid),
+ xp == NULL ? "<none>" : xp->name);
ci = SES_Get_String_Attr(sp, SA_CLIENT_IP);
cp = SES_Get_String_Attr(sp, SA_CLIENT_PORT);
VSB_printf(vsb, "client = %s %s,\n", ci, cp);
diff --git a/bin/varnishd/cache/cache_transport.h b/bin/varnishd/cache/cache_transport.h
index c756f07..7048823 100644
--- a/bin/varnishd/cache/cache_transport.h
+++ b/bin/varnishd/cache/cache_transport.h
@@ -59,3 +59,5 @@ struct transport {
extern struct transport PROXY_transport;
extern struct transport HTTP1_transport;
+const struct transport *XPORT_ByNumber(uint16_t no);
+
More information about the varnish-commit
mailing list