summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlexander Barton <alex@barton.de>2012-08-29 17:03:41 +0200
committerAlexander Barton <alex@barton.de>2012-08-29 17:03:41 +0200
commitb68bb560e9140c0ec783ea02773aef50d11ac06d (patch)
tree37e0edcbb3ef91fdb3c53ca59f0d85b53a5125fe
parent21467c76f15a7773695ce3a37c7c843cb4682ac2 (diff)
downloadngircd-b68bb560e9140c0ec783ea02773aef50d11ac06d.tar.gz
ngircd-b68bb560e9140c0ec783ea02773aef50d11ac06d.zip
Convert CONN_ID and Conf_MaxConnections to "int" datatype
We can't handle more connections than accept(2) can supply, and
accept(2) returns an "int" ...
-rw-r--r--src/ngircd/conf.c4
-rw-r--r--src/ngircd/conf.h2
-rw-r--r--src/ngircd/conn.h3
3 files changed, 5 insertions, 4 deletions
diff --git a/src/ngircd/conf.c b/src/ngircd/conf.c
index 3966dc90..034281c0 100644
--- a/src/ngircd/conf.c
+++ b/src/ngircd/conf.c
@@ -346,7 +346,7 @@ Conf_Test( void )
 
 	puts("[LIMITS]");
 	printf("  ConnectRetry = %d\n", Conf_ConnectRetry);
-	printf("  MaxConnections = %ld\n", Conf_MaxConnections);
+	printf("  MaxConnections = %d\n", Conf_MaxConnections);
 	printf("  MaxConnectionsIP = %d\n", Conf_MaxConnectionsIP);
 	printf("  MaxJoins = %d\n", Conf_MaxJoins > 0 ? Conf_MaxJoins : -1);
 	printf("  MaxNickLength = %u\n", Conf_MaxNickLength - 1);
@@ -1432,7 +1432,7 @@ Handle_LIMITS(int Line, char *Var, char *Arg)
 		return;
 	}
 	if (strcasecmp(Var, "MaxConnections") == 0) {
-		Conf_MaxConnections = atol(Arg);
+		Conf_MaxConnections = atoi(Arg);
 		if (!Conf_MaxConnections && strcmp(Arg, "0"))
 			Config_Error_NaN(Line, Var);
 		return;
diff --git a/src/ngircd/conf.h b/src/ngircd/conf.h
index 8e66c07c..7a4e38aa 100644
--- a/src/ngircd/conf.h
+++ b/src/ngircd/conf.h
@@ -206,7 +206,7 @@ GLOBAL bool Conf_ConnectIPv6;
 GLOBAL bool Conf_ConnectIPv4;
 
 /** Maximum number of simultaneous connections to this server */
-GLOBAL long Conf_MaxConnections;
+GLOBAL int Conf_MaxConnections;
 
 /** Maximum number of channels a user can join */
 GLOBAL int Conf_MaxJoins;
diff --git a/src/ngircd/conn.h b/src/ngircd/conn.h
index 7dcc8d9d..4a8b6777 100644
--- a/src/ngircd/conn.h
+++ b/src/ngircd/conn.h
@@ -42,7 +42,7 @@
 #define CONN_SSL_WANT_READ	128	/* SSL/TLS library needs to read protocol data */
 #define CONN_SSL_FLAGS_ALL	(CONN_SSL_CONNECT|CONN_SSL|CONN_SSL_WANT_WRITE|CONN_SSL_WANT_READ)
 #endif
-typedef long CONN_ID;
+typedef int CONN_ID;
 
 #include "client.h"
 #include "proc.h"
@@ -126,6 +126,7 @@ GLOBAL void Conn_SyncServerStruct PARAMS(( void ));
 GLOBAL CONN_ID Conn_GetFromProc PARAMS((int fd));
 GLOBAL CLIENT* Conn_GetClient PARAMS((CONN_ID i));
 GLOBAL PROC_STAT* Conn_GetProcStat PARAMS((CONN_ID i));
+
 #ifdef SSL_SUPPORT
 GLOBAL bool Conn_GetCipherInfo PARAMS((CONN_ID Idx, char *buf, size_t len));
 GLOBAL bool Conn_UsesSSL PARAMS((CONN_ID Idx));