* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
- * $Id: conn.c,v 1.52 2002/03/12 14:37:52 alex Exp $
+ * $Id: conn.c,v 1.56 2002/03/14 13:42:33 alex Exp $
*
* connect.h: Verwaltung aller Netz-Verbindungen ("connections")
*/
#include "conn.h"
-#define SERVER_WAIT NONE - 1
+#define SERVER_WAIT (NONE - 1)
typedef struct _Connection
BOOLEAN ok;
va_list ap;
+ assert( Idx >= 0 );
+ assert( My_Connections[Idx].sock > NONE );
+ assert( Format != NULL );
+
va_start( ap, Format );
if( vsnprintf( buffer, COMMAND_LEN - 2, Format, ap ) == COMMAND_LEN - 2 )
{
/* Haben wir schon eine Verbindung? */
for( n = 0; n < MAX_CONNECTIONS; n++ )
{
+ if( My_Connections[n].sock == NONE ) continue;
+
/* Verbindung zu diesem Server? */
- if(( My_Connections[n].sock != NONE ) && ( My_Connections[n].our_server == i ))
+ if( My_Connections[n].our_server == i )
{
/* Komplett aufgebaute Verbindung? */
if( My_Connections[n].sock > NONE ) break;
}
/* Verbindung in dieser Server-Gruppe? */
- if(( My_Connections[n].sock != NONE ) && ( My_Connections[n].our_server != NONE ))
+ if(( My_Connections[n].our_server != NONE ) && ( Conf_Server[i].group != NONE ))
{
- if( Conf_Server[n].group == Conf_Server[i].group != NONE ) break;
+ if( Conf_Server[My_Connections[n].our_server].group == Conf_Server[i].group ) break;
}
}
if( n < MAX_CONNECTIONS ) continue;
INT on = 1;
+#ifdef O_NONBLOCK /* A/UX kennt das nicht? */
if( fcntl( Sock, F_SETFL, O_NONBLOCK ) != 0 )
{
Log( LOG_CRIT, "Can't enable non-blocking mode: %s!", strerror( errno ));
close( Sock );
return FALSE;
}
+#endif
if( setsockopt( Sock, SOL_SOCKET, SO_REUSEADDR, &on, (socklen_t)sizeof( on )) != 0)
{
Log( LOG_ERR, "Can't set socket options: %s!", strerror( errno ));