BUG/MINOR: mux-quic: handle null timeout
Do not initialize mux task timeout if timeout client is set to 0 in the
configuration. Check for the task before queuing it in qc_io_cb() or
qc_detach().
This fix a crash when timeout client is 0 or undefined.
diff --git a/src/mux_quic.c b/src/mux_quic.c
index 31ef6d5..c0ab615 100644
--- a/src/mux_quic.c
+++ b/src/mux_quic.c
@@ -1028,7 +1028,7 @@
if (qcc_is_dead(qcc)) {
qc_release(qcc);
}
- else {
+ else if (qcc->task) {
if (qcc_may_expire(qcc))
qcc->task->expire = tick_add(now_ms, qcc->timeout);
else
@@ -1150,13 +1150,16 @@
qcc->wait_event.events = 0;
/* haproxy timeouts */
+ qcc->task = NULL;
qcc->timeout = prx->timeout.client;
- qcc->task = task_new_here();
- if (!qcc->task)
- goto fail_no_timeout_task;
- qcc->task->process = qc_timeout_task;
- qcc->task->context = qcc;
- qcc->task->expire = tick_add(now_ms, qcc->timeout);
+ if (tick_isset(qcc->timeout)) {
+ qcc->task = task_new_here();
+ if (!qcc->task)
+ goto fail_no_timeout_task;
+ qcc->task->process = qc_timeout_task;
+ qcc->task->context = qcc;
+ qcc->task->expire = tick_add(now_ms, qcc->timeout);
+ }
if (!conn_is_back(conn)) {
if (!LIST_INLIST(&conn->stopping_list)) {
@@ -1210,7 +1213,7 @@
if (qcc_is_dead(qcc)) {
qc_release(qcc);
}
- else {
+ else if (qcc->task) {
if (qcc_may_expire(qcc))
qcc->task->expire = tick_add(now_ms, qcc->timeout);
else