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

Improve test coverage for service TCP/UDP.

This commit is contained in:
winlin 2020-01-05 18:42:37 +08:00
parent 265b70863c
commit 02c1bd0946
2 changed files with 8 additions and 5 deletions

View file

@ -263,27 +263,22 @@ srs_error_t do_srs_udp_listen(int fd, addrinfo* r, srs_netfd_t* pfd)
srs_error_t err = srs_success;
if ((err = srs_fd_closeexec(fd)) != srs_success) {
::close(fd);
return srs_error_wrap(err, "set closeexec");
}
if ((err = srs_fd_reuseaddr(fd)) != srs_success) {
::close(fd);
return srs_error_wrap(err, "set reuseaddr");
}
if ((err = srs_fd_reuseport(fd)) != srs_success) {
::close(fd);
return srs_error_wrap(err, "set reuseport");
}
if (bind(fd, r->ai_addr, r->ai_addrlen) == -1) {
::close(fd);
return srs_error_new(ERROR_SOCKET_BIND, "bind");
}
if ((*pfd = srs_netfd_open_socket(fd)) == NULL){
::close(fd);
return srs_error_new(ERROR_ST_OPEN_SOCKET, "st open");
}