فهرست منبع

Merge commit 'origin/ser_core_cvs'

* commit 'origin/ser_core_cvs':
  core: compile io_wait support even if -DUSE_TCP is not set
  tcp: compile fix if -DUSE_TCP is not defined
  sctp: compile fix if -DUSE_SCTP is not defined
Andrei Pelinescu-Onciul 16 سال پیش
والد
کامیت
282a314fca
3فایلهای تغییر یافته به همراه20 افزوده شده و 2 حذف شده
  1. 2 2
      io_wait.c
  2. 2 0
      sctp_options.c
  3. 16 0
      tcp_options.c

+ 2 - 2
io_wait.c

@@ -29,7 +29,7 @@
 
 
 
-#ifdef USE_TCP /* for now it make sense only with tcp */
+#ifndef NO_IO_WAIT
 
 #ifdef HAVE_EPOLL
 #include <unistd.h> /* close() */
@@ -631,4 +631,4 @@ void destroy_io_wait(io_wait_h* h)
 
 
 
-#endif
+#endif /*ifndef NO_IO_WAIT */

+ 2 - 0
sctp_options.c

@@ -27,11 +27,13 @@
 
 #include <string.h>
 #include <sys/types.h>
+#ifdef USE_SCTP
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <netinet/in_systm.h>
 #include <netinet/ip.h>
 #include <netinet/sctp.h>
+#endif /* USE_SCTP */
 #include <errno.h>
 
 #include "sctp_options.h"

+ 16 - 0
tcp_options.c

@@ -121,7 +121,11 @@ void init_tcp_options()
 	tcp_default_cfg.connect_timeout_s=DEFAULT_TCP_CONNECT_TIMEOUT;
 	tcp_default_cfg.send_timeout=S_TO_TICKS(DEFAULT_TCP_SEND_TIMEOUT);
 	tcp_default_cfg.con_lifetime=S_TO_TICKS(DEFAULT_TCP_CONNECTION_LIFETIME_S);
+#ifdef USE_TCP
 	tcp_default_cfg.max_connections=tcp_max_connections;
+#else /*USE_TCP*/
+	tcp_default_cfg.max_connections=0;
+#endif /*USE_TCP*/
 #ifdef TCP_ASYNC
 	tcp_default_cfg.async=1;
 	tcp_default_cfg.tcpconn_wq_max=32*1024; /* 32 k */
@@ -224,11 +228,19 @@ static int fix_max_conns(void* cfg_h, str* gname, str* name, void** val)
 {
 	int v;
 	v=(int)(long)*val;
+#ifdef USE_TCP
 	if (v>tcp_max_connections){
 		INFO("cannot override hard tcp_max_connections limit, please"
 				" restart and increase tcp_max_connections in the cfg.\n");
 		v=tcp_max_connections;
 	}
+#else /* USE_TCP */
+	if (v){
+		ERR("TCP support disabled at compile-time, tcp_max_connection is"
+				" hardwired to 0.\n");
+		v=0;
+	}
+#endif /*USE_TCP */
 	*val=(void*)(long)v;
 	return 0;
 }
@@ -325,7 +337,11 @@ void tcp_options_check()
 						MAX_TCP_CON_LIFETIME);
 	fix_timeout("tcp_connection_lifetime", &tcp_default_cfg.con_lifetime,
 						MAX_TCP_CON_LIFETIME, MAX_TCP_CON_LIFETIME);
+#ifdef USE_TCP
 	tcp_default_cfg.max_connections=tcp_max_connections;
+#else /* USE_TCP */
+	tcp_default_cfg.max_connections=0;
+#endif /* USE_TCP */
 	tcp_cfg_def_fix("rd_buf_size", (int*)&tcp_default_cfg.rd_buf_size);
 	tcp_cfg_def_fix("wq_blk_size", (int*)&tcp_default_cfg.wq_blk_size);
 }