Commit Diff


commit - 0aae3ec5d714ffa7d257257a23c036aa0a96fcbb
commit + 4db29b007689d34adeaca8cbe8676f7c2aedc2ab
blob - a60fd8e6f92dabae4e04712d5ee41cdf92889678
blob + 8f04a1bb4534160fa16a0d26b224ba248f907f00
--- src/ngircd/conn.c
+++ src/ngircd/conn.c
@@ -17,7 +17,7 @@
 #include "portab.h"
 #include "io.h"
 
-static char UNUSED id[] = "$Id: conn.c,v 1.179 2005/09/05 09:10:08 fw Exp $";
+static char UNUSED id[] = "$Id: conn.c,v 1.180 2005/09/11 11:42:48 fw Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -1283,7 +1283,8 @@ Check_Connections( void )
 	CONN_ID i;
 
 	for( i = 0; i < Pool_Size; i++ ) {
-		if( My_Connections[i].sock == NONE ) continue;
+		if (My_Connections[i].sock < 0)
+			continue;
 
 		c = Client_GetFromConn( i );
 		if( c && (( Client_Type( c ) == CLIENT_USER ) || ( Client_Type( c ) == CLIENT_SERVER ) || ( Client_Type( c ) == CLIENT_SERVICE )))
@@ -1365,16 +1366,17 @@ Check_Servers( void )
 		}
 
 		/* Check last connect attempt? */
-		if( Conf_Server[i].lasttry > time( NULL ) - Conf_ConnectRetry ) continue;
+		if( Conf_Server[i].lasttry > time( NULL ) - Conf_ConnectRetry )
+			continue;
 
 		/* Okay, try to connect now */
 		Conf_Server[i].lasttry = time( NULL );
 
 		/* Search free connection structure */
 		for( idx = 0; idx < Pool_Size; idx++ ) if( My_Connections[idx].sock == NONE ) break;
-		if( idx >= Pool_Size )
-		{
-			Log( LOG_ALERT, "Can't establist server connection: connection limit reached (%d)!", Pool_Size );
+		if (idx >= Pool_Size) {
+			Log( LOG_ALERT, "Can't establist server connection: connection limit reached (%d)!",
+											Pool_Size );
 			return;
 		}
 #ifdef DEBUG
@@ -1566,8 +1568,7 @@ void Read_Resolver_Result( int r_fd )
 		  && ( My_Connections[i].res_stat->pipe[0] == r_fd ))
 			break;
 	}
-	if( i >= Pool_Size )
-	{
+	if( i >= Pool_Size ) {
 		/* Ops, none found? Probably the connection has already
 		 * been closed!? We'll ignore that ... */
 		io_close( r_fd );
@@ -1706,8 +1707,7 @@ Count_Connections( struct sockaddr_in addr_in )
 	int i, cnt;
 	
 	cnt = 0;
-	for( i = 0; i < Pool_Size; i++ )
-	{
+	for( i = 0; i < Pool_Size; i++ ) {
 		if(( My_Connections[i].sock > NONE ) && ( My_Connections[i].addr.sin_addr.s_addr == addr_in.sin_addr.s_addr )) cnt++;
 	}
 	return cnt;
blob - 3ce055c8339821b4b37aa0826fefd3bb497b9368
blob + 4a6f2e14dce2fc3e8a7e2781ee0bb75fdaa10953
--- src/ngircd/resolve.c
+++ src/ngircd/resolve.c
@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: resolve.c,v 1.19 2005/09/03 11:17:16 fw Exp $";
+static char UNUSED id[] = "$Id: resolve.c,v 1.20 2005/09/11 11:42:48 fw Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -83,8 +83,7 @@ Resolve_Addr( struct sockaddr_in *Addr )
 
 	/* For sub-process */
 	pid = fork( );
-	if( pid > 0 )
-	{
+	if (pid > 0) {
 		close( s->pipe[1] );
 		/* Main process */
 		Log( LOG_DEBUG, "Resolver for %s created (PID %d).", inet_ntoa( Addr->sin_addr ), pid );
@@ -99,9 +98,7 @@ Resolve_Addr( struct sockaddr_in *Addr )
 		}
 		s->pid = pid;
 		return s;
-	}
-	else if( pid == 0 )
-	{
+	} else if( pid == 0 ) {
 		close( s->pipe[0] );
 		/* Sub process */
 		Log_Init_Resolver( );
@@ -111,7 +108,7 @@ Resolve_Addr( struct sockaddr_in *Addr )
 		Do_ResolveAddr( Addr, s->pipe[1] );
 #endif
 		Log_Exit_Resolver( );
-		exit( 0 );
+		exit(0);
 	}
 	
 	Log( LOG_CRIT, "Resolver: Can't fork: %s!", strerror( errno ));
@@ -138,8 +135,7 @@ Resolve_Name( char *Host )
 
 	/* Fork sub-process */
 	pid = fork( );
-	if( pid > 0 )
-	{
+	if (pid > 0) {
 		close( s->pipe[1] );
 		/* Main process */
 		Log( LOG_DEBUG, "Resolver for \"%s\" created (PID %d).", Host, pid );
@@ -154,15 +150,13 @@ Resolve_Name( char *Host )
 		}
 		s->pid = pid;
 		return s;
-	}
-	else if( pid == 0 )
-	{
+	} else if( pid == 0 ) {
 		close( s->pipe[0] );
 		/* Sub process */
 		Log_Init_Resolver( );
 		Do_ResolveName( Host, s->pipe[1] );
 		Log_Exit_Resolver( );
-		exit( 0 );
+		exit(0);
 	}
 
 	Log( LOG_CRIT, "Resolver: Can't fork: %s!", strerror( errno ));
@@ -286,13 +280,10 @@ Do_ResolveName( char *Host, int w_fd )
 
 	/* Resolve hostname */
 	h = gethostbyname( Host );
-	if( h )
-	{
+	if( h ) {
 		addr = (struct in_addr *)h->h_addr;
 		strlcpy( ip, inet_ntoa( *addr ), sizeof( ip ));
-	}
-	else
-	{
+	} else {
 #ifdef h_errno
 		Log_Resolver( LOG_WARNING, "Can't resolve \"%s\": %s!", Host, Get_Error( h_errno ));
 #else
@@ -305,8 +296,7 @@ Do_ResolveName( char *Host, int w_fd )
 	/* Write result into pipe to parent */
 	len = strlen( ip );
 	ip[len] = '\n'; len++;
-	if( (size_t)write( w_fd, ip, len ) != (size_t)len )
-	{
+	if( (size_t)write( w_fd, ip, len ) != (size_t)len ) {
 		Log_Resolver( LOG_CRIT, "Resolver: Can't write to parent: %s!", strerror( errno ));
 		close( w_fd );
 	}
blob - b13962a86b57bfda1c079c2e1e31243b62c75a97
blob + 0791229123b47acf8833e466ceef3a57707b7b42
--- src/ngircd/resolve.h
+++ src/ngircd/resolve.h
@@ -8,7 +8,7 @@
  * (at your option) any later version.
  * Please read the file COPYING, README and AUTHORS for more information.
  *
- * $Id: resolve.h,v 1.9 2005/07/28 16:13:09 fw Exp $
+ * $Id: resolve.h,v 1.10 2005/09/11 11:42:48 fw Exp $
  *
  * Asynchronous resolver (header)
  */
@@ -35,11 +35,6 @@ typedef struct _Res_Stat
 } RES_STAT;
 
 
-GLOBAL fd_set Resolver_FDs;
-
-
-GLOBAL void Resolve_Init PARAMS(( void ));
-
 #ifdef IDENTAUTH
 GLOBAL RES_STAT *Resolve_Addr PARAMS(( struct sockaddr_in *Addr, int Sock ));
 #else
@@ -50,6 +45,4 @@ GLOBAL RES_STAT *Resolve_Name PARAMS(( char *Host ));
 
 
 #endif
-
-
 /* -eof- */