1
0
Fork 0
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:
winlin 2019-10-04 20:02:51 +08:00
parent 6f5809c80b
commit 9d90a8177f
3 changed files with 7 additions and 1 deletions

View file

@ -152,6 +152,7 @@ Please select according to languages:
### V3 changes
* v3.0, 2019-10-04, Disable SO_REUSEPORT if not supported. 3.0.57
* <strong>v3.0, 2019-10-04, [3.0 alpha0(3.0.56)][r3.0a0] released. 107946 lines.</strong>
* v3.0, 2019-10-04, Support go-oryx rtmplb with [proxy protocol](https://github.com/ossrs/go-oryx/wiki/RtmpProxy). 3.0.56
* v3.0, 2019-10-03, Fix [#775][bug #775], Support SO_REUSEPORT to improve edge performance. 3.0.54

View file

@ -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>

View file

@ -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;
}