Revert "Add mk_utils_get_somaxconn function"
authorCarlos Ghan <charlie.brown.uy@gmail.com>
Sat, 20 Mar 2010 19:25:55 +0000 (16:25 -0300)
committerCarlos Ghan <charlie.brown.uy@gmail.com>
Sat, 20 Mar 2010 19:25:55 +0000 (16:25 -0300)
This reverts commit eca13bdb3e2e2896fe8cd586b6fd4799747983f9.

src/include/utils.h
src/socket.c
src/utils.c

index 0304cb3..b3551a3 100644 (file)
@@ -22,7 +22,6 @@
 
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <sys/sysctl.h>
 #include <unistd.h>
 
 #define TRUE 1
@@ -31,8 +30,6 @@
 #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"
 
@@ -95,6 +92,4 @@ void mk_utils_trace(const char *component, int color, const char *function,
                     char *file, int line, const char* format, ...);
 #endif
 
-int mk_utils_get_somaxconn();
-
 #endif
index ae34443..60aadf6 100644 (file)
@@ -171,7 +171,7 @@ int mk_socket_server(int port, char *listen_addr)
      * 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);
     }
index 3bbea4e..cb93468 100644 (file)
@@ -310,21 +310,3 @@ void mk_utils_trace(const char *component, int color, const char *function,
     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;
-}