|
|
@ -416,17 +416,9 @@ pxy_conn_free(pxy_conn_ctx_t *ctx, int by_requestor)
|
|
|
|
// If srvdst has been xferred to the first child conn, the child should free it, not the parent
|
|
|
|
// If srvdst has been xferred to the first child conn, the child should free it, not the parent
|
|
|
|
if (ctx->divert && !ctx->srvdst_xferred) {
|
|
|
|
if (ctx->divert && !ctx->srvdst_xferred) {
|
|
|
|
ctx->srvdst.free(ctx->srvdst.bev, ctx);
|
|
|
|
ctx->srvdst.free(ctx->srvdst.bev, ctx);
|
|
|
|
} else /*if (!ctx->divert || ctx->srvdst_xferred)*/ {
|
|
|
|
} else if (ctx->srvdst_xferred) {
|
|
|
|
// We reuse srvdst as dst or child dst, so srvdst == dst or child_dst.
|
|
|
|
// @see prototcp_setup_dst()
|
|
|
|
// But if we don't NULL the callbacks of srvdst in split mode,
|
|
|
|
// It does not seem to happen with srvdst_xferred, but just to be safe we do the same for it too.
|
|
|
|
// we randomly but rarely get a second eof event for srvdst during conn termination (especially on arm64),
|
|
|
|
|
|
|
|
// which crashes us with signal 11 or 10, because the first eof event for dst frees the ctx.
|
|
|
|
|
|
|
|
// Note that we don't free anything here, but just disable callbacks and events.
|
|
|
|
|
|
|
|
// This does not seem to happen with srvdst_xferred, but just to be safe we do the same for it too.
|
|
|
|
|
|
|
|
// This seems to be an issue with libevent.
|
|
|
|
|
|
|
|
// @todo Why does libevent raise the same event again for an already disabled and freed conn end?
|
|
|
|
|
|
|
|
// Note again that srvdst == dst or child_dst here.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct bufferevent *ubev = bufferevent_get_underlying(ctx->srvdst.bev);
|
|
|
|
struct bufferevent *ubev = bufferevent_get_underlying(ctx->srvdst.bev);
|
|
|
|
|
|
|
|
|
|
|
|
bufferevent_setcb(ctx->srvdst.bev, NULL, NULL, NULL, NULL);
|
|
|
|
bufferevent_setcb(ctx->srvdst.bev, NULL, NULL, NULL, NULL);
|
|
|
@ -437,6 +429,7 @@ pxy_conn_free(pxy_conn_ctx_t *ctx, int by_requestor)
|
|
|
|
bufferevent_disable(ubev, EV_READ|EV_WRITE);
|
|
|
|
bufferevent_disable(ubev, EV_READ|EV_WRITE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// else if (!ctx->divert) {}
|
|
|
|
ctx->srvdst.bev = NULL;
|
|
|
|
ctx->srvdst.bev = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|