Commit 0664f1da authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Give TCP Pools a panic function.

parent 629c3f17
......@@ -464,11 +464,7 @@ vbe_panic(const struct director *d, struct vsb *vsb)
CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC);
CAST_OBJ_NOTNULL(bp, d->priv, BACKEND_MAGIC);
if (bp->ipv4_addr != NULL)
VSB_printf(vsb, "ipv4 = %s,\n", bp->ipv4_addr);
if (bp->ipv6_addr != NULL)
VSB_printf(vsb, "ipv6 = %s,\n", bp->ipv6_addr);
VSB_printf(vsb, "port = %s,\n", bp->port);
VTP_panic(vsb, bp->tcp_pool);
VSB_printf(vsb, "hosthdr = %s,\n", bp->hosthdr);
VSB_printf(vsb, "n_conn = %u,\n", bp->n_conn);
}
......
......@@ -816,6 +816,33 @@ VTP_getip(struct pfd *pfd)
/*--------------------------------------------------------------------*/
void
VTP_panic(struct vsb *vsb, struct tcp_pool *tp)
{
char h[VTCP_ADDRBUFSIZE];
char p[VTCP_PORTBUFSIZE];
if (PAN_dump_struct(vsb, tp, TCP_POOL_MAGIC, "tcp_pool"))
return;
VSB_printf(vsb, "id = 0x%jx,\n", tp->cp->id);
if (tp->uds)
VSB_printf(vsb, "uds = %s,\n", tp->uds);
if (tp->ip4 && VSA_Sane(tp->ip4)) {
VTCP_name(tp->ip4, h, sizeof h, p, sizeof p);
VSB_printf(vsb, "ipv4 = %s, ", h);
VSB_printf(vsb, "port = %s,\n", p);
}
if (tp->ip6 && VSA_Sane(tp->ip6)) {
VTCP_name(tp->ip4, h, sizeof h, p, sizeof p);
VSB_printf(vsb, "ipv6 = %s, ", h);
VSB_printf(vsb, "port = %s,\n", p);
}
VSB_indent(vsb, -2);
VSB_cat(vsb, "},\n");
}
/*--------------------------------------------------------------------*/
void
VTP_Init(void)
{
......
......@@ -103,5 +103,7 @@ int VTP_Wait(struct worker *, struct pfd *, vtim_real tmo);
* function before attempting to receive on the connection.
*/
void VTP_panic(struct vsb *, struct tcp_pool *);
const struct suckaddr *VTP_getip(struct pfd *);
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