commit - 0aae3ec5d714ffa7d257257a23c036aa0a96fcbb
commit + 4db29b007689d34adeaca8cbe8676f7c2aedc2ab
blob - a60fd8e6f92dabae4e04712d5ee41cdf92889678
blob + 8f04a1bb4534160fa16a0d26b224ba248f907f00
--- src/ngircd/conn.c
+++ src/ngircd/conn.c
#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>
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 )))
}
/* 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
&& ( 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 );
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
#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>
/* 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 );
}
s->pid = pid;
return s;
- }
- else if( pid == 0 )
- {
+ } else if( pid == 0 ) {
close( s->pipe[0] );
/* Sub process */
Log_Init_Resolver( );
Do_ResolveAddr( Addr, s->pipe[1] );
#endif
Log_Exit_Resolver( );
- exit( 0 );
+ exit(0);
}
Log( LOG_CRIT, "Resolver: Can't fork: %s!", strerror( errno ));
/* 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 );
}
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 ));
/* 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
/* 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
* (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)
*/
} 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
#endif
-
-
/* -eof- */