Skip to content

Commit

Permalink
* NEW [quic] Add nni_quic_listener_fini to finite quic listener.
Browse files Browse the repository at this point in the history
* FIX [quic] Add some comments (maybe rules) about quic_listener_doclose.

Signed-off-by: wanghaemq <wangwei@emqx.io>
  • Loading branch information
wanghaEMQ committed Oct 30, 2023
1 parent 84c27b4 commit 635dff1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/supplemental/quic/msquic_listen.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ nni_quic_listener_init(void **argp)
return 0;
}

// All the instructments here should be done within guard of lock of listener.
// And also could be done repeatly.
static void
quic_listener_doclose(nni_quic_listener *l)
{
Expand Down Expand Up @@ -280,6 +282,24 @@ nni_quic_listener_accept(nni_quic_listener *l, nni_aio *aio)
nni_mtx_unlock(&l->mtx);
}

void
nni_quic_listener_fini(nni_quic_listener *l)
{
HQUIC ql;

nni_mtx_lock(&l->mtx);
quic_listener_doclose(l);
ql = l->ql;
nni_mtx_unlock(&l->mtx);

if (ql != NULL) {
msquic_listener_fini(ql);
}
nni_mtx_fini(&l->mtx);
NNI_FREE_STRUCT(l);
}


/***************************** MsQuic Bindings *****************************/

static void
Expand Down

0 comments on commit 635dff1

Please sign in to comment.