Commit 1506c5cf authored by Dridi Boukelmoune's avatar Dridi Boukelmoune

Flatten h2_stream_tmo() with an early return

parent d869640b
......@@ -992,25 +992,26 @@ h2_stream_tmo(struct h2_sess *h2, const struct h2_req *r2)
CHECK_OBJ_NOTNULL(h2, H2_SESS_MAGIC);
CHECK_OBJ_NOTNULL(r2, H2_REQ_MAGIC);
if (r2->t_winupd != 0 || r2->t_send != 0) {
Lck_Lock(&h2->sess->mtx);
if (r2->t_winupd != 0 &&
h2->sess->t_idle - r2->t_winupd >
cache_param->idle_send_timeout) {
VSLb(h2->vsl, SLT_Debug,
"H2: stream %u: Hit idle_send_timeout waiting "
"for WINDOW_UPDATE", r2->stream);
r = 1;
}
if (r2->t_winupd == 0 && r2->t_send == 0)
return (0);
if (r == 0 && r2->t_send != 0 &&
h2->sess->t_idle - r2->t_send > cache_param->send_timeout) {
VSLb(h2->vsl, SLT_Debug,
"H2: stream %u: Hit send_timeout", r2->stream);
r = 1;
}
Lck_Unlock(&h2->sess->mtx);
Lck_Lock(&h2->sess->mtx);
if (r2->t_winupd != 0 &&
h2->sess->t_idle - r2->t_winupd >
cache_param->idle_send_timeout) {
VSLb(h2->vsl, SLT_Debug,
"H2: stream %u: Hit idle_send_timeout waiting for"
" WINDOW_UPDATE", r2->stream);
r = 1;
}
if (r == 0 && r2->t_send != 0 &&
h2->sess->t_idle - r2->t_send > cache_param->send_timeout) {
VSLb(h2->vsl, SLT_Debug,
"H2: stream %u: Hit send_timeout", r2->stream);
r = 1;
}
Lck_Unlock(&h2->sess->mtx);
return (r);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment