Feature gate SO_INCOMING_CPU so we compile on older kernels

Former-commit-id: 267e84f97d61f8aa416f88870c21bdf2a0cc635a
This commit is contained in:
John Sully 2019-03-19 18:55:42 -04:00
parent f480792f9c
commit 1b34e43109
2 changed files with 7 additions and 0 deletions

View File

@ -35,7 +35,12 @@
#if defined(__linux__) #if defined(__linux__)
#define _GNU_SOURCE 1 #define _GNU_SOURCE 1
#define _DEFAULT_SOURCE 1 #define _DEFAULT_SOURCE 1
#include <linux/version.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0)
#define HAVE_SO_INCOMING_CPU 1
#endif #endif
#endif // __linux__
#if defined(_AIX) #if defined(_AIX)
#define _ALL_SOURCE #define _ALL_SOURCE

View File

@ -1035,6 +1035,7 @@ static void acceptCommonHandler(int fd, int flags, char *ip, int iel) {
return; return;
} }
#ifdef HAVE_SO_INCOMING_CPU
// Set thread affinity // Set thread affinity
if (server.fThreadAffinity) if (server.fThreadAffinity)
{ {
@ -1044,6 +1045,7 @@ static void acceptCommonHandler(int fd, int flags, char *ip, int iel) {
serverLog(LL_WARNING, "Failed to set socket affinity"); serverLog(LL_WARNING, "Failed to set socket affinity");
} }
} }
#endif
/* If maxclient directive is set and this is one client more... close the /* If maxclient directive is set and this is one client more... close the
* connection. Note that we create the client instead to check before * connection. Note that we create the client instead to check before