[Spread-cvs] commit: r419 - in trunk: daemon docs

jonathan at spread.org jonathan at spread.org
Mon Jun 1 23:46:13 EDT 2009


Author: jonathan
Date: 2009-06-01 23:46:12 -0400 (Mon, 01 Jun 2009)
New Revision: 419

Modified:
   trunk/daemon/config_gram.l
   trunk/daemon/config_parse.y
   trunk/daemon/configuration.c
   trunk/daemon/configuration.h
   trunk/daemon/session.c
   trunk/daemon/spread_params.h
   trunk/docs/sample.spread.conf
Log:
Make MaxSessionMessages a runtime configuration option in spread.conf. 
This allows the maximum number of messages to buffer before disconnecting a 
client to be set at runtime. 
Original request and patch by Alexey Zakhlestin. Patch revised and commited by Jonathan.



Modified: trunk/daemon/config_gram.l
===================================================================
--- trunk/daemon/config_gram.l	2009-05-17 23:35:01 UTC (rev 418)
+++ trunk/daemon/config_gram.l	2009-06-02 03:46:12 UTC (rev 419)
@@ -92,6 +92,7 @@
 RequiredAuthMethods             { return REQUIREDAUTHMETHODS; }
 AllowedAuthMethods              { return ALLOWEDAUTHMETHODS; }
 AccessControlPolicy             { return ACCESSCONTROLPOLICY; }
+MaxSessionMessages              { return MAXSESSIONMESSAGES; }
 LinkProtocol                    { return LINKPROTOCOL; }
 Hop                             { return PHOP; }
 TcpHop                          { return PTCPHOP; }
@@ -174,6 +175,10 @@
                                   yylval.ip.port = 0;
                                   return IPADDR;
                                 }
+[0-9]{1,6}                   {
+                                  yylval.number = atoi(yytext);
+                                  return NUMBER;
+                             }
 ([0-9]{1,3}[ \t]*)+[ \t]*    { 
                                   int fcost, i, done;
                                   char *c;

Modified: trunk/daemon/config_parse.y
===================================================================
--- trunk/daemon/config_parse.y	2009-05-17 23:35:01 UTC (rev 418)
+++ trunk/daemon/config_parse.y	2009-06-02 03:46:12 UTC (rev 419)
@@ -321,6 +321,7 @@
 %token DSKIPLIST DACM DSECURITY DALL DNONE
 %token DEBUGINITIALSEQUENCE
 %token DANGEROUSMONITOR SOCKETPORTREUSE RUNTIMEDIR SPUSER SPGROUP ALLOWEDAUTHMETHODS REQUIREDAUTHMETHODS ACCESSCONTROLPOLICY
+%token MAXSESSIONMESSAGES
 %token SP_BOOL SP_TRIVAL LINKPROTOCOL PHOP PTCPHOP
 %token IMONITOR ICLIENT IDAEMON
 %token ROUTEMATRIX LINKCOST
@@ -517,6 +518,10 @@
                                     yyerror("Invalid Access Control Policy name. Make sure it is spelled right and any needed mocdules are loaded");
                             }
                         }
+		|	MAXSESSIONMESSAGES EQUALS NUMBER
+			{
+                            Conf_set_max_session_messages($3.number);
+			}
 		|	LINKPROTOCOL EQUALS PHOP
 			{
                             Conf_set_link_protocol(HOP_PROT);

Modified: trunk/daemon/configuration.c
===================================================================
--- trunk/daemon/configuration.c	2009-05-17 23:35:01 UTC (rev 418)
+++ trunk/daemon/configuration.c	2009-06-02 03:46:12 UTC (rev 419)
@@ -100,6 +100,9 @@
 
 static	char	*Group = NULL;
 
+static  int     MaxSessionMessages = DEFAULT_MAX_SESSION_MESSAGES;
+
+
 static  int     Link_Protocol;
 
 static  bool    Conf_Debug_Initial_Sequence = FALSE;
@@ -841,7 +844,21 @@
                 Alarm(DEBUG, "Ignored invalid %s\n", description);
         }
 }
+void    Conf_set_max_session_messages(int max_messages)
+{
+        if (max_messages < 0) {
+            Alarmp(SPLOG_ERROR, CONF, "Conf_set_max_session_messages: Attempt to set max_message to less then zero. Resetting to default value of %d\n", DEFAULT_MAX_SESSION_MESSAGES);
+            max_messages = DEFAULT_MAX_SESSION_MESSAGES;
+        }
+        Alarmp(SPLOG_DEBUG, CONF, "Conf_set_max_session_messages: Set Max Session Messages to %d\n", max_messages);
+        MaxSessionMessages = max_messages;
+}
 
+int     Conf_get_max_session_messages(void)
+{
+        return (MaxSessionMessages);
+}
+
 char    *Conf_get_runtime_dir(void)
 {
         return (RuntimeDir != NULL ? RuntimeDir : SP_RUNTIME_DIR);

Modified: trunk/daemon/configuration.h
===================================================================
--- trunk/daemon/configuration.h	2009-05-17 23:35:01 UTC (rev 418)
+++ trunk/daemon/configuration.h	2009-06-02 03:46:12 UTC (rev 419)
@@ -133,5 +133,7 @@
 void            Conf_set_group(char *dir);
 int             Conf_get_link_protocol(void);
 void            Conf_set_link_protocol(int protocol);
+void            Conf_set_max_session_messages(int max_messages);
+int             Conf_get_max_session_messages(void);
 
 #endif /* INC_CONFIGURATION */

Modified: trunk/daemon/session.c
===================================================================
--- trunk/daemon/session.c	2009-05-17 23:35:01 UTC (rev 418)
+++ trunk/daemon/session.c	2009-06-02 03:46:12 UTC (rev 419)
@@ -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",

Modified: trunk/daemon/spread_params.h
===================================================================
--- trunk/daemon/spread_params.h	2009-05-17 23:35:01 UTC (rev 418)
+++ trunk/daemon/spread_params.h	2009-06-02 03:46:12 UTC (rev 419)
@@ -84,7 +84,7 @@
 #include        "sp_events.h"
 #define		MAX_SESSIONS		( ( MAX_FD_EVENTS-5 ) / 2 ) /* reserves 2 for each connection */
 
-#define		MAX_SESSION_MESSAGES	1000
+#define		DEFAULT_MAX_SESSION_MESSAGES	1000
 #define         MAX_GROUPS_PER_MESSAGE  100     /* Each multicast can't send to more groups then this */
 
 #define         MAX_WRAP_SEQUENCE_VALUE (1<<30) /* Maximum value for token->seq before reseting to zero with membership */

Modified: trunk/docs/sample.spread.conf
===================================================================
--- trunk/docs/sample.spread.conf	2009-05-17 23:35:01 UTC (rev 418)
+++ trunk/docs/sample.spread.conf	2009-06-02 03:46:12 UTC (rev 419)
@@ -117,6 +117,13 @@
 
 #SocketPortReuse = AUTO
 
+#Set what the maximum per-session queue should be for messages before disconnecting
+# a session. Spread will buffer upto that number of messages that are destined to the 
+# session, but that can not be delivered currently because the session is not reading fast enough. 
+# The compiled in default is usually 1000 if you havn't changed it in the spread_params.h file. 
+
+#MaxSessionMessages = 5000
+
 #Sets the runtime directory used when the Spread daemon is run as root
 # as the directory to chroot to.  Defaults to the value of the
 # compile-time preprocessor define SP_RUNTIME_DIR, which is generally




More information about the Spread-cvs mailing list