1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

SquashSRS4: Refine DTLS init, use specified API by role

This commit is contained in:
winlin 2021-03-09 12:01:23 +08:00
parent de65a331f1
commit dc93836489
5 changed files with 37 additions and 17 deletions

View file

@ -163,6 +163,8 @@ SrsFastCoroutine::SrsFastCoroutine(string n, ISrsCoroutineHandler* h, SrsContext
SrsFastCoroutine::~SrsFastCoroutine()
{
stop();
// TODO: FIXME: We must assert the cycle is done.
srs_freep(trd_err);
}
@ -213,7 +215,7 @@ void SrsFastCoroutine::stop()
interrupt();
// When not started, the rd is NULL.
// When not started, the trd is NULL.
if (trd) {
void* res = NULL;
int r0 = st_thread_join((st_thread_t)trd, &res);
@ -245,7 +247,9 @@ void SrsFastCoroutine::interrupt()
if (trd_err == srs_success) {
trd_err = srs_error_new(ERROR_THREAD_INTERRUPED, "interrupted");
}
// Note that if another thread is stopping thread and waiting in st_thread_join,
// the interrupt will make the st_thread_join fail.
st_thread_interrupt((st_thread_t)trd);
}