Remove redundant srvdst_xferred flag in child ctx

pull/48/head
Soner Tari 2 years ago
parent dc40f74c13
commit 02a6cc12e6

@ -1530,9 +1530,8 @@ protossl_setup_dst_child(pxy_conn_child_ctx_t *ctx)
{
if (!ctx->conn->srvdst_xferred) {
// Reuse srvdst of parent in the first child conn
ctx->conn->srvdst_xferred = 1;
ctx->srvdst_xferred = 1;
ctx->dst = ctx->conn->srvdst;
ctx->conn->srvdst_xferred = 1;
// See the comments in prototcp_setup_dst()
prototcp_disable_events_srvdst(ctx->conn);

@ -205,9 +205,8 @@ prototcp_setup_dst_child(pxy_conn_child_ctx_t *ctx)
{
if (!ctx->conn->srvdst_xferred) {
// Reuse srvdst of parent in the first child conn
ctx->conn->srvdst_xferred = 1;
ctx->srvdst_xferred = 1;
ctx->dst = ctx->conn->srvdst;
ctx->conn->srvdst_xferred = 1;
// See the comments in prototcp_setup_dst()
prototcp_disable_events_srvdst(ctx->conn);

@ -258,7 +258,7 @@ pxy_conn_free_child(pxy_conn_child_ctx_t *ctx)
// Save conn and srvdst_xferred before freeing ctx
pxy_conn_ctx_t *conn = ctx->conn;
unsigned int srvdst_xferred = ctx->srvdst_xferred;
unsigned int srvdst_xferred = conn->srvdst_xferred;
pxy_conn_detach_child(ctx);
pxy_conn_ctx_free_child(ctx);

@ -255,6 +255,8 @@ struct pxy_conn_ctx {
unsigned int term : 1; /* 0 until term requested */
unsigned int term_requestor : 1; /* 1 client, 0 server side */
// srvdst_xferred flag is important not to access srvdst.bev
// after the first child is freed
unsigned int srvdst_xferred : 1; /* 1 if srvdst xferred to child */
struct pxy_conn_desc srvdst;
@ -391,8 +393,6 @@ struct pxy_conn_child_ctx {
/* status flags */
unsigned int connected : 1; /* 0 until both ends are connected */
unsigned int term : 1; /* 0 until term requested */
// srvdst_xferred flag is important not to access the srvdst.bev of parent after the first child is freed
unsigned int srvdst_xferred : 1; /* 1 if srvdst xferred from parent */
// For statistics only
evutil_socket_t dst_fd;

Loading…
Cancel
Save