diff options
author | Glenn Strauss <gstrauss@gluelogic.com> | 2022-04-17 20:39:34 -0400 |
---|---|---|
committer | Glenn Strauss <gstrauss@gluelogic.com> | 2022-05-05 13:35:18 -0400 |
commit | 59b9a9a73d1d47c72483e040b8a45dcdac05f4cd (patch) | |
tree | ff1910e60f1cb8cbfcc24e41817263060be9ea65 /src/h2.c | |
parent | d48947ffa0dbf706076632fb8b894863dce54bab (diff) | |
download | lighttpd-git-59b9a9a73d1d47c72483e040b8a45dcdac05f4cd.tar.gz |
[core] h2 prio sort urgency, incr, then stream id
h2 priority sort based on urgency, incremental, then stream id
Diffstat (limited to 'src/h2.c')
-rw-r--r-- | src/h2.c | 20 |
1 files changed, 14 insertions, 6 deletions
@@ -575,21 +575,29 @@ h2_recv_ping (connection * const con, uint8_t * const s, const uint32_t len) static void -h2_apply_priority_update (h2con * const h2c, request_st * const r, const uint32_t rpos) +h2_apply_priority_update (h2con * const h2c, const request_st * const r, const uint32_t rpos) { + const request_st ** const rr = (const request_st **)h2c->r; uint32_t npos = rpos; - while (npos && h2c->r[npos-1]->h2_prio > r->h2_prio) --npos; + while (npos + && (rr[npos-1]->h2_prio > r->h2_prio + || (rr[npos-1]->h2_prio == r->h2_prio + && rr[npos-1]->h2id > r->h2id))) + --npos; if (rpos - npos) { - memmove(h2c->r+npos+1, h2c->r+npos, (rpos - npos)*sizeof(request_st *)); + memmove(rr+npos+1, rr+npos, (rpos - npos)*sizeof(request_st *)); } else { - while (npos+1 < h2c->rused && h2c->r[npos+1]->h2_prio <= r->h2_prio) + while (npos+1 < h2c->rused + && (rr[npos+1]->h2_prio < r->h2_prio + || (rr[npos+1]->h2_prio == r->h2_prio + && rr[npos+1]->h2id < r->h2id))) ++npos; if (npos - rpos == 0) return; /*(no movement)*/ - memmove(h2c->r+rpos, h2c->r+rpos+1, (npos - rpos)*sizeof(request_st *)); + memmove(rr+rpos, rr+rpos+1, (npos - rpos)*sizeof(request_st *)); } - h2c->r[npos] = r; + rr[npos] = r; } |