mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 06:11:32 +02:00
MINOR: frontend: don't retrieve ALPN on the critical path
It's pointless to read it on each and every accept(), as we only need it for reporting in debugging mode a few lines later. Let's move this part to the relevant block.
This commit is contained in:
parent
04b9286933
commit
20814ff1fc
@ -56,14 +56,6 @@ int frontend_accept(struct stream *s)
|
|||||||
struct connection *conn = objt_conn(sess->origin);
|
struct connection *conn = objt_conn(sess->origin);
|
||||||
struct listener *l = sess->listener;
|
struct listener *l = sess->listener;
|
||||||
struct proxy *fe = sess->fe;
|
struct proxy *fe = sess->fe;
|
||||||
const char *alpn_str = NULL;
|
|
||||||
int alpn_len;
|
|
||||||
|
|
||||||
/* check if we're in HTTP mode, directly connected to the connection,
|
|
||||||
* and with ALPN advertising H2.
|
|
||||||
*/
|
|
||||||
if (conn && conn->owner == &s->si[0])
|
|
||||||
conn_get_alpn(conn, &alpn_str, &alpn_len);
|
|
||||||
|
|
||||||
if ((fe->mode == PR_MODE_TCP || fe->mode == PR_MODE_HTTP)
|
if ((fe->mode == PR_MODE_TCP || fe->mode == PR_MODE_HTTP)
|
||||||
&& (!LIST_ISEMPTY(&fe->logsrvs))) {
|
&& (!LIST_ISEMPTY(&fe->logsrvs))) {
|
||||||
@ -102,13 +94,19 @@ int frontend_accept(struct stream *s)
|
|||||||
(!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)))) {
|
(!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)))) {
|
||||||
char pn[INET6_ADDRSTRLEN];
|
char pn[INET6_ADDRSTRLEN];
|
||||||
char alpn[16] = "<none>";
|
char alpn[16] = "<none>";
|
||||||
|
const char *alpn_str = NULL;
|
||||||
|
int alpn_len;
|
||||||
|
|
||||||
conn_get_from_addr(conn);
|
conn_get_from_addr(conn);
|
||||||
|
|
||||||
if (alpn_str) {
|
/* try to report the ALPN value when available (also works for NPN) */
|
||||||
int len = MIN(alpn_len, sizeof(alpn) - 1);
|
|
||||||
memcpy(alpn, alpn_str, len);
|
if (conn && conn->owner == &s->si[0]) {
|
||||||
alpn[len] = 0;
|
if (conn_get_alpn(conn, &alpn_str, &alpn_len) && alpn_str) {
|
||||||
|
int len = MIN(alpn_len, sizeof(alpn) - 1);
|
||||||
|
memcpy(alpn, alpn_str, len);
|
||||||
|
alpn[len] = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (addr_to_str(&conn->addr.from, pn, sizeof(pn))) {
|
switch (addr_to_str(&conn->addr.from, pn, sizeof(pn))) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user