#include <sys/types.h>
#include <sys/stat.h>
-#include <sys/sysctl.h>
#include <unistd.h>
#define TRUE 1
#define MK_UTILS_INT2MKP_BUFFER_LEN 16 /* Maximum buffer length when
* converting an int to mk_pointer */
-#define MK_UTILS_SOMAXCONN_DEFAULT 1024 /* Default for SOMAXCONN value */
-
#include "request.h"
#include "memory.h"
char *file, int line, const char* format, ...);
#endif
-int mk_utils_get_somaxconn();
-
#endif
* The queue limit is given by /proc/sys/net/core/somaxconn
* we need to add a dynamic function to get that value on fly
*/
- if ((listen(fd, mk_utils_get_somaxconn())) != 0) {
+ if ((listen(fd, 1024)) != 0) {
perror("listen");
exit(1);
}
fprintf( stderr, "%s\n", ANSI_RESET);
}
#endif
-
-/* Get SOMAXCONN value. Based on sysctl manpage */
-int mk_utils_get_somaxconn() {
- int size;
- int name[] = { CTL_NET, NET_CORE, NET_CORE_SOMAXCONN };
- int value;
- size_t value_len;
-
- size = sizeof(name) / sizeof(name[0]);
- value_len = sizeof(value);
-
- if (sysctl(name, size, &value, &value_len, NULL, 0)) {
- perror("sysctl");
- return MK_UTILS_SOMAXCONN_DEFAULT;
- }
-
- return value;
-}