mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-11-28 14:21:00 +01:00
MINOR: stconn/channel: Move CF_READ_DONTWAIT into the SC and rename it
The channel flag CF_READ_DONTWAIT is renamed to SC_FL_RCV_ONCE and moved into the stream-connector.
This commit is contained in:
parent
9bce9724ec
commit
9a790f63ed
@ -106,7 +106,7 @@
|
||||
#define CF_WROTE_DATA 0x00040000 /* some data were sent from this buffer */
|
||||
/* unused 0x00080000 - 0x00100000 */
|
||||
#define CF_KERN_SPLICING 0x00200000 /* kernel splicing desired for this channel */
|
||||
#define CF_READ_DONTWAIT 0x00400000 /* wake the task up after every read (eg: HTTP request) */
|
||||
/* unused 0x00400000 */
|
||||
#define CF_AUTO_CONNECT 0x00800000 /* consumer may attempt to establish a new connection */
|
||||
|
||||
#define CF_DONT_READ 0x01000000 /* disable reading for now */
|
||||
@ -140,10 +140,10 @@ static forceinline char *chn_show_flags(char *buf, size_t len, const char *delim
|
||||
_(CF_WRITE_TIMEOUT,
|
||||
_(CF_WAKE_WRITE, _(CF_SHUTW, _(CF_SHUTW_NOW, _(CF_AUTO_CLOSE,
|
||||
_(CF_STREAMER, _(CF_STREAMER_FAST, _(CF_WROTE_DATA,
|
||||
_(CF_KERN_SPLICING, _(CF_READ_DONTWAIT,
|
||||
_(CF_KERN_SPLICING,
|
||||
_(CF_AUTO_CONNECT, _(CF_DONT_READ, _(CF_EXPECT_MORE,
|
||||
_(CF_SEND_DONTWAIT, _(CF_NEVER_WAIT, _(CF_WAKE_ONCE, _(CF_FLT_ANALYZE,
|
||||
_(CF_EOI, _(CF_ISRESP))))))))))))))))))))))));
|
||||
_(CF_EOI, _(CF_ISRESP)))))))))))))))))))))));
|
||||
/* epilogue */
|
||||
_(~0U);
|
||||
return buf;
|
||||
|
||||
@ -125,6 +125,8 @@ enum sc_flags {
|
||||
SC_FL_WONT_READ = 0x00000080, /* SC doesn't want to read data */
|
||||
SC_FL_NEED_BUFF = 0x00000100, /* SC waits for an rx buffer allocation to complete */
|
||||
SC_FL_NEED_ROOM = 0x00000200, /* SC needs more room in the rx buffer to store incoming data */
|
||||
|
||||
SC_FL_RCV_ONCE = 0x00000400, /* Don't loop to receive data. cleared after a sucessful receive */
|
||||
};
|
||||
|
||||
/* This function is used to report flags in debugging tools. Please reflect
|
||||
@ -139,7 +141,8 @@ static forceinline char *sc_show_flags(char *buf, size_t len, const char *delim,
|
||||
/* flags */
|
||||
_(SC_FL_ISBACK, _(SC_FL_NOLINGER, _(SC_FL_NOHALF,
|
||||
_(SC_FL_DONT_WAKE, _(SC_FL_INDEP_STR, _(SC_FL_WONT_READ,
|
||||
_(SC_FL_NEED_BUFF, _(SC_FL_NEED_ROOM))))))));
|
||||
_(SC_FL_NEED_BUFF, _(SC_FL_NEED_ROOM,
|
||||
_(SC_FL_RCV_ONCE)))))))));
|
||||
/* epilogue */
|
||||
_(~0U);
|
||||
return buf;
|
||||
|
||||
@ -1039,7 +1039,7 @@ static void cli_io_handler(struct appctx *appctx)
|
||||
|
||||
/* re-adjust req buffer */
|
||||
co_skip(sc_oc(sc), reql);
|
||||
req->flags |= CF_READ_DONTWAIT; /* we plan to read small requests */
|
||||
sc_opposite(sc)->flags |= SC_FL_RCV_ONCE; /* we plan to read small requests */
|
||||
}
|
||||
else { /* output functions */
|
||||
struct cli_print_ctx *ctx;
|
||||
@ -2636,7 +2636,7 @@ read_again:
|
||||
/* We don't know yet to which server we will connect */
|
||||
channel_dont_connect(req);
|
||||
|
||||
req->flags |= CF_READ_DONTWAIT;
|
||||
s->scf->flags |= SC_FL_RCV_ONCE;
|
||||
|
||||
/* need more data */
|
||||
if (!ci_data(req))
|
||||
@ -2738,7 +2738,7 @@ int pcli_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
|
||||
s->res.analysers &= ~AN_RES_WAIT_CLI;
|
||||
return 0;
|
||||
}
|
||||
rep->flags |= CF_READ_DONTWAIT; /* try to get back here ASAP */
|
||||
s->scb->flags |= SC_FL_RCV_ONCE; /* try to get back here ASAP */
|
||||
rep->flags |= CF_NEVER_WAIT;
|
||||
|
||||
/* don't forward the close */
|
||||
@ -2869,7 +2869,7 @@ int pcli_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
|
||||
s->store_count = 0;
|
||||
s->uniq_id = global.req_count++;
|
||||
|
||||
s->req.flags |= CF_READ_DONTWAIT; /* one read is usually enough */
|
||||
s->scf->flags |= SC_FL_RCV_ONCE; /* one read is usually enough */
|
||||
|
||||
s->req.flags |= CF_WAKE_ONCE; /* need to be called again if there is some command left in the request */
|
||||
|
||||
|
||||
@ -832,14 +832,13 @@ static int dns_session_init(struct appctx *appctx)
|
||||
|
||||
s = appctx_strm(appctx);
|
||||
s->scb->dst = addr;
|
||||
s->scb->flags |= SC_FL_NOLINGER;
|
||||
s->scb->flags |= (SC_FL_RCV_ONCE|SC_FL_NOLINGER);
|
||||
s->target = &ds->dss->srv->obj_type;
|
||||
s->flags = SF_ASSIGNED;
|
||||
|
||||
s->do_log = NULL;
|
||||
s->uniq_id = 0;
|
||||
|
||||
s->res.flags |= CF_READ_DONTWAIT;
|
||||
applet_expect_no_data(appctx);
|
||||
ds->appctx = appctx;
|
||||
return 0;
|
||||
|
||||
@ -1245,7 +1245,7 @@ spoe_init_appctx(struct appctx *appctx)
|
||||
applet_need_more_data(appctx);
|
||||
|
||||
s->do_log = NULL;
|
||||
s->res.flags |= CF_READ_DONTWAIT;
|
||||
s->scb->flags |= SC_FL_RCV_ONCE;
|
||||
|
||||
HA_SPIN_LOCK(SPOE_APPLET_LOCK, &agent->rt[tid].lock);
|
||||
LIST_APPEND(&agent->rt[tid].applets, &spoe_appctx->list);
|
||||
|
||||
@ -138,7 +138,7 @@ int frontend_accept(struct stream *s)
|
||||
}
|
||||
|
||||
if (fe->mode == PR_MODE_HTTP)
|
||||
s->req.flags |= CF_READ_DONTWAIT; /* one read is usually enough */
|
||||
s->scf->flags |= SC_FL_RCV_ONCE; /* one read is usually enough */
|
||||
|
||||
if (unlikely(fe->nb_req_cap > 0)) {
|
||||
if ((s->req_cap = pool_zalloc(fe->req_cap_pool)) == NULL)
|
||||
|
||||
@ -1368,7 +1368,7 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
|
||||
}
|
||||
|
||||
channel_dont_close(rep);
|
||||
rep->flags |= CF_READ_DONTWAIT; /* try to get back here ASAP */
|
||||
s->scb->flags |= SC_FL_RCV_ONCE; /* try to get back here ASAP */
|
||||
DBG_TRACE_DEVEL("waiting for more data",
|
||||
STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA, s, txn);
|
||||
return 0;
|
||||
|
||||
@ -1071,9 +1071,8 @@ static int httpclient_applet_init(struct appctx *appctx)
|
||||
s->scb->dst = addr;
|
||||
}
|
||||
|
||||
s->scb->flags |= SC_FL_NOLINGER;
|
||||
s->scb->flags |= (SC_FL_RCV_ONCE|SC_FL_NOLINGER);
|
||||
s->flags |= SF_ASSIGNED;
|
||||
s->res.flags |= CF_READ_DONTWAIT;
|
||||
|
||||
/* applet is waiting for data */
|
||||
applet_need_more_data(appctx);
|
||||
|
||||
@ -1096,15 +1096,13 @@ static int peer_session_init(struct appctx *appctx)
|
||||
|
||||
/* initiate an outgoing connection */
|
||||
s->scb->dst = addr;
|
||||
s->scb->flags |= SC_FL_NOLINGER;
|
||||
s->scb->flags |= (SC_FL_RCV_ONCE|SC_FL_NOLINGER);
|
||||
s->flags = SF_ASSIGNED;
|
||||
s->target = peer_session_target(peer, s);
|
||||
|
||||
s->do_log = NULL;
|
||||
s->uniq_id = 0;
|
||||
|
||||
s->res.flags |= CF_READ_DONTWAIT;
|
||||
|
||||
_HA_ATOMIC_INC(&active_peers);
|
||||
return 0;
|
||||
|
||||
@ -3200,7 +3198,7 @@ send_msgs:
|
||||
}
|
||||
}
|
||||
out:
|
||||
sc_oc(sc)->flags |= CF_READ_DONTWAIT;
|
||||
sc_opposite(sc)->flags |= SC_FL_RCV_ONCE;
|
||||
|
||||
if (curpeer)
|
||||
HA_SPIN_UNLOCK(PEER_LOCK, &curpeer->lock);
|
||||
|
||||
@ -601,7 +601,7 @@ static int sink_forward_session_init(struct appctx *appctx)
|
||||
|
||||
s = appctx_strm(appctx);
|
||||
s->scb->dst = addr;
|
||||
s->scb->flags |= SC_FL_NOLINGER;
|
||||
s->scb->flags |= (SC_FL_RCV_ONCE|SC_FL_NOLINGER);
|
||||
|
||||
s->target = &sft->srv->obj_type;
|
||||
s->flags = SF_ASSIGNED;
|
||||
@ -609,7 +609,6 @@ static int sink_forward_session_init(struct appctx *appctx)
|
||||
s->do_log = NULL;
|
||||
s->uniq_id = 0;
|
||||
|
||||
s->res.flags |= CF_READ_DONTWAIT;
|
||||
applet_expect_no_data(appctx);
|
||||
sft->appctx = appctx;
|
||||
|
||||
|
||||
@ -1116,7 +1116,7 @@ static void sc_notify(struct stconn *sc)
|
||||
}
|
||||
|
||||
if (ic->flags & CF_READ_EVENT)
|
||||
ic->flags &= ~CF_READ_DONTWAIT;
|
||||
sc->flags &= ~SC_FL_RCV_ONCE;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1382,8 +1382,8 @@ static int sc_conn_recv(struct stconn *sc)
|
||||
if (sc_ep_test(sc, SE_FL_EOI))
|
||||
break;
|
||||
|
||||
if ((ic->flags & CF_READ_DONTWAIT) || --read_poll <= 0) {
|
||||
/* we're stopped by the channel's policy */
|
||||
if ((sc->flags & SC_FL_RCV_ONCE) || --read_poll <= 0) {
|
||||
/* we don't expect to read more data */
|
||||
sc_wont_read(sc);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -921,7 +921,7 @@ static void back_establish(struct stream *s)
|
||||
}
|
||||
}
|
||||
else {
|
||||
rep->flags |= CF_READ_DONTWAIT; /* a single read is enough to get response headers */
|
||||
s->scb->flags |= SC_FL_RCV_ONCE; /* a single read is enough to get response headers */
|
||||
}
|
||||
|
||||
rep->analysers |= strm_fe(s)->fe_rsp_ana | s->be->be_rsp_ana;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user