commit - 4a5b3f34a51bf3dd8feabe4f73c13bfd36e261bb
commit + e744936d1919269ea8d5169e850b04ce896bf6d6
blob - 4b48ffb842288c62f1265ef3ea7507debb3e89e4
blob + 882251bcd80f5abf8fe776ed152647649543e4b9
--- src/ngircd/conn.c
+++ src/ngircd/conn.c
#include "portab.h"
-static char UNUSED id[] = "$Id: conn.c,v 1.118 2003/03/07 14:35:52 alex Exp $";
+static char UNUSED id[] = "$Id: conn.c,v 1.119 2003/03/07 17:16:49 alex Exp $";
#include "imp.h"
#include <assert.h>
LOCAL BOOLEAN Init_Socket PARAMS(( INT Sock ));
LOCAL VOID New_Server PARAMS(( INT Server, CONN_ID Idx ));
LOCAL VOID Read_Resolver_Result PARAMS(( INT r_fd ));
+LOCAL VOID Simple_Message PARAMS(( INT Sock, CHAR *Msg ));
LOCAL fd_set My_Listeners;
LOCAL fd_set My_Sockets;
{
/* Access denied! */
Log( deny_severity, "Refused connection from %s (by TCP Wrappers)!", inet_ntoa( new_addr.sin_addr ));
+ Simple_Message( new_sock, "ERROR :Connection refused" );
close( new_sock );
return;
}
{
/* Mehr Verbindungen duerfen wir leider nicht mehr annehmen ... */
Log( LOG_ALERT, "Can't accept connection: limit (%d) reached!", Pool_Size );
+ Simple_Message( new_sock, "ERROR :Connection limit reached" );
close( new_sock );
return;
}
if( new_size < Pool_Size )
{
Log( LOG_ALERT, "Can't accespt connection: limit (%d) reached -- overflow!", Pool_Size );
+ Simple_Message( new_sock, "ERROR :Connection limit reached" );
close( new_sock );
return;
}
{
/* Offenbar steht kein weiterer Sepeicher zur Verfuegung :-( */
Log( LOG_EMERG, "Can't allocate memory! [New_Connection]" );
+ Simple_Message( new_sock, "ERROR: Internal error" );
close( new_sock );
return;
}
if( ! c )
{
Log( LOG_ALERT, "Can't accept connection: can't create client structure!" );
+ Simple_Message( new_sock, "ERROR :Internal error" );
close( new_sock );
return;
}
} /* Read_Resolver_Result */
+LOCAL VOID
+Simple_Message( INT Sock, CHAR *Msg )
+{
+ /* Write "simple" message to socket, without using compression
+ * or even the connection write buffers. Used e.g. for error
+ * messages by New_Connection(). */
+
+ assert( Sock > NONE );
+ assert( Msg != NULL );
+
+ (VOID)send( Sock, Msg, strlen( Msg ), 0 );
+ (VOID)send( Sock, "\r\n", 2, 0 );
+} /* Simple_Error */
+
+
/* -eof- */