mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Disable SO_REUSEPORT if not supported. 3.0.57
This commit is contained in:
parent
6f5809c80b
commit
9d90a8177f
3 changed files with 7 additions and 1 deletions
|
@ -27,7 +27,7 @@
|
|||
// The version config.
|
||||
#define VERSION_MAJOR 3
|
||||
#define VERSION_MINOR 0
|
||||
#define VERSION_REVISION 56
|
||||
#define VERSION_REVISION 57
|
||||
|
||||
// The macros generated by configure script.
|
||||
#include <srs_auto_headers.hpp>
|
||||
|
|
|
@ -112,10 +112,15 @@ srs_error_t srs_fd_reuseaddr(int fd)
|
|||
|
||||
srs_error_t srs_fd_reuseport(int fd)
|
||||
{
|
||||
#if defined(SO_REUSEPORT)
|
||||
int v = 1;
|
||||
if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &v, sizeof(int)) == -1) {
|
||||
return srs_error_new(ERROR_SOCKET_SETREUSEADDR, "SO_REUSEPORT fd=%v", fd);
|
||||
}
|
||||
#else
|
||||
#warning "SO_REUSEPORT is not supported by your OS"
|
||||
srs_warn("SO_REUSEPORT is not supported util Linux kernel 3.9");
|
||||
#endif
|
||||
|
||||
return srs_success;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue