NGIRCD_PENALTY_MAX can be used to define the maximum number of seconds
that will be added to the "penalty timer" of a client per call.
Use 0 to disable penalties altogether. Disabling (or reducing) penalties
can greatly speed up "make check" runs for example, see below.
But PLEASE NOTE:
NGIRCD_PENALTY_MAX isn't meant to be used in production!
This is a testing and debugging feature ONLY!
Some example timings on my Linux server:
$ time make NGIRCD_PENALTY_MAX=0 check >/dev/null
real 0m22.643s
user 0m0.428s
sys 0m0.440s
$ time make NGIRCD_PENALTY_MAX=1 check >/dev/null
real 3m1.839s
user 0m0.492s
sys 0m0.408s
$ time make NGIRCD_PENALTY_MAX= check >/dev/null
real 4m27.071s
user 0m0.488s
sys 0m0.516s
assert(Idx > NONE);
assert(Seconds >= 0);
+ if (Max_Penalty_Add >= 0 && Seconds > Max_Penalty_Add)
+ Seconds = Max_Penalty_Add;
+ if (Seconds <= 0)
+ return;
+
t = time(NULL);
if (My_Connections[Idx].delaytime < t)
My_Connections[Idx].delaytime = t;
Conn_First( void )
{
CONN_ID i;
-
+
for( i = 0; i < Pool_Size; i++ )
{
if( My_Connections[i].sock != NONE ) return i;
CONN_ID i = NONE;
assert( Idx > NONE );
-
+
for( i = Idx + 1; i < Pool_Size; i++ )
{
if( My_Connections[i].sock != NONE ) return i;
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <ctype.h>
#include <time.h>
#include <netinet/in.h>
Conn_Init( void )
{
CONN_ID i;
+ char *ptr;
Pool_Size = CONNECTION_POOL;
if ((Conf_MaxConnections > 0) &&
for (i = 0; i < Pool_Size; i++)
Init_Conn_Struct(i);
+
+ ptr = getenv("NGIRCD_PENALTY_MAX");
+ if (ptr && isdigit(*ptr) && atol(ptr) >= 0) {
+ Max_Penalty_Add = atol(ptr);
+ Log(LOG_WARNING,
+ "Warning: \"NGIRCD_PENALTY_MAX\" is set to %ld!",
+ Max_Penalty_Add);
+ } else
+ Max_Penalty_Add = -1;
} /* Conn_Init */
/**
#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 int CONN_ID;
#include "client.h"
#define CONNECTION2ID(x) (long)(x - My_Connections)
+GLOBAL time_t Max_Penalty_Add; /** Maximum penalty time to add at once */
+
#endif /* CONN_MODULE */