/* per-thread accept queues */
struct quic_accept_queue *quic_accept_queues;
+/* Closes <qc> whose handshake is complete but which cannot be accepted
+ * anymore.
+ */
+static void quic_accept_refuse_qc(struct quic_conn *qc)
+{
+ TRACE_STATE("refusing connection on unbound listener", QUIC_EV_CONN_CLOSE, qc);
+ quic_set_connection_close(qc, quic_err_transport(QC_ERR_CONNECTION_REFUSED));
+ tasklet_wakeup(qc->wait_event.tasklet);
+}
+
/* Install <qc> on the queue ready to be accepted. The queue task is then woken
* up.
*/
BUG_ON(qc->flags & QUIC_FL_CONN_ACCEPT_REGISTERED);
BUG_ON(MT_LIST_INLIST(&qc->accept_list));
- HA_ATOMIC_INC(&l->rx.quic_curr_accept);
-
qc->flags |= QUIC_FL_CONN_ACCEPT_REGISTERED;
+
+ /* the listener was unbound meanwhile, e.g. by a soft-stop */
+ if (!(l->rx.flags & RX_F_BOUND)) {
+ quic_accept_refuse_qc(qc);
+ return;
+ }
+
+ HA_ATOMIC_INC(&l->rx.quic_curr_accept);
/* 1. insert the listener in the accept queue
*
* Use TRY_APPEND as there is a possible race even with INLIST if
struct quic_accept_queue *queue = &quic_accept_queues[tid];
MT_LIST_FOR_EACH_ENTRY_LOCKED(lthr, &queue->listeners, quic_accept.list, back) {
- listener_accept(lthr->li);
+ if (!(lthr->li->rx.flags & RX_F_BOUND)) {
+ struct quic_conn *qc;
+
+ /* the listener was unbound, nothing can be accepted anymore */
+ while ((qc = MT_LIST_POP(<hr->quic_accept.conns, struct quic_conn *, accept_list))) {
+ BUG_ON(lthr->li->rx.quic_curr_accept <= 0);
+ HA_ATOMIC_DEC(<hr->li->rx.quic_curr_accept);
+ quic_accept_refuse_qc(qc);
+ }
+ }
+ else
+ listener_accept(lthr->li);
+
if (!MT_LIST_ISEMPTY(<hr->quic_accept.conns)) {
/* entry is left in queue */
tasklet_wakeup((struct tasklet*)t);