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

For #2369, #1708, #1941: Check errno when close fd or stop thread

This commit is contained in:
winlin 2021-10-31 18:16:33 +08:00
parent 60ab81a5c7
commit ab5079909d
5 changed files with 57 additions and 4 deletions

View file

@ -74,8 +74,17 @@ void srs_close_stfd(srs_netfd_t& stfd)
{
if (stfd) {
// we must ensure the close is ok.
int err = st_netfd_close((st_netfd_t)stfd);
srs_assert(err != -1);
int r0 = st_netfd_close((st_netfd_t)stfd);
if (r0) {
// By _st_epoll_fd_close or _st_kq_fd_close
if (errno == EBUSY) srs_assert(!r0);
// By close
if (errno == EBADF) srs_assert(!r0);
if (errno == EINTR) srs_assert(!r0);
if (errno == EIO) srs_assert(!r0);
// Others
srs_assert(!r0);
}
stfd = NULL;
}
}