Skip to content
This repository has been archived by the owner on Jul 30, 2021. It is now read-only.

Commit

Permalink
Give panic access to the sessions transport protocol via the
Browse files Browse the repository at this point in the history
session number.
  • Loading branch information
bsdphk committed Feb 12, 2016
1 parent 604d0fb commit 3d5911a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
13 changes: 12 additions & 1 deletion bin/varnishd/cache/cache_acceptor.c
Expand Up @@ -638,7 +638,7 @@ XPORT_Init(void)
const struct transport *
XPORT_Find(const char *name)
{
struct transport *xp;
const struct transport *xp;

ASSERT_MGT();

Expand All @@ -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);
}
7 changes: 5 additions & 2 deletions bin/varnishd/cache/cache_panic.c
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions bin/varnishd/cache/cache_transport.h
Expand Up @@ -59,3 +59,5 @@ struct transport {
extern struct transport PROXY_transport;
extern struct transport HTTP1_transport;

const struct transport *XPORT_ByNumber(uint16_t no);

0 comments on commit 3d5911a

Please sign in to comment.