Index: docs/sample.spread.conf =================================================================== --- docs/sample.spread.conf (revision 402) +++ docs/sample.spread.conf (working copy) @@ -97,6 +97,12 @@ #DangerousMonitor = false +#Sets amount of unread messages in clients-queue, after which client will be +# forcefully disconnected. Default to the value of the compile-time +# preprocessor define MAX_SESSION_MESSAGES + +#MaxSessionMessages = 1000 + #Set handling of SO_REUSEADDR socket option for the daemon's TCP # listener. This is useful for facilitating quick daemon restarts (OSes # often hold onto the interface/port combination for a short period of time Index: daemon/config_gram.l =================================================================== --- daemon/config_gram.l (revision 402) +++ daemon/config_gram.l (working copy) @@ -69,6 +69,7 @@ ipport [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}:[0-9]{1,5} %option noyywrap %% +[0-9]+ { yylval.number = atoi(yytext); return NUMBER; } #.* {} /* Comments */ [ \t\r] {} /* White space */ \n { line_num++;} @@ -79,6 +80,7 @@ !/.+ { return BANG; } Spread_Segment { return SEGMENT; } EventLogFile { return EVENTLOGFILE; } +MaxSessionMessages { return MAXSESSIONMESSAGES; } EventTimeStamp { return EVENTTIMESTAMP; } EventPriority { return EVENTPRIORITY; } DebugFlags { return DEBUGFLAGS; } Index: daemon/configuration.c =================================================================== --- daemon/configuration.c (revision 402) +++ daemon/configuration.c (working copy) @@ -111,6 +111,7 @@ static char Conf_FileName[80]; static char Conf_MyName_buf[80]; static char *Conf_MyName; +static size_t max_session_messages = 0; static int Conf_prev_proc_by_id( int32u id, proc *p ); static void Conf_config_copy( configuration *src_conf, configuration *dst_conf, proc *src_procs, proc *dst_procs); @@ -871,3 +872,13 @@ { set_param_if_valid(&Group, group, "group name", 32); } + +size_t Conf_get_max_session_messages(void) +{ + return (max_session_messages > 0 ? max_session_messages : MAX_SESSION_MESSAGES); +} + +void Conf_set_max_session_messages(size_t max_messages) +{ + max_session_messages = max_messages; +} Index: daemon/configuration.h =================================================================== --- daemon/configuration.h (revision 402) +++ daemon/configuration.h (working copy) @@ -133,5 +133,7 @@ void Conf_set_group(char *dir); int Conf_get_link_protocol(void); void Conf_set_link_protocol(int protocol); +size_t Conf_get_max_session_messages(void); +void Conf_set_max_session_messages(size_t max_messages); #endif /* INC_CONFIGURATION */ Index: daemon/session.c =================================================================== --- daemon/session.c (revision 402) +++ daemon/session.c (working copy) @@ -33,7 +33,7 @@ */ -#include "arch.h" +#include "configuration.h" #include #include @@ -1541,7 +1541,7 @@ if( !Is_op_session( Sessions[ses].status ) ) return; - if( Sessions[ses].num_mess >= MAX_SESSION_MESSAGES ) + if( Sessions[ses].num_mess >= Conf_get_max_session_messages() ) { Alarm( SESSION, "Sess_write: killing mbox %d for not reading\n", Index: daemon/config_parse.y =================================================================== --- daemon/config_parse.y (revision 402) +++ daemon/config_parse.y (working copy) @@ -313,6 +313,7 @@ %} %start Config %token SEGMENT EVENTLOGFILE EVENTTIMESTAMP EVENTPRIORITY IPADDR NUMBER COLON +%token MAXSESSIONMESSAGES %token PDEBUG PINFO PWARNING PERROR PCRITICAL PFATAL %token OPENBRACE CLOSEBRACE EQUALS STRING %token DEBUGFLAGS BANG @@ -402,6 +403,10 @@ Alarm_set_output(file_buf); } } + | MAXSESSIONMESSAGES EQUALS NUMBER + { + Conf_set_max_session_messages($3.number); + } | EVENTTIMESTAMP EQUALS STRING { if (! Alarm_get_interactive() ) {