CVS User Account cvsuser
Mon Oct 23 15:00:32 PDT 2006
Log Message:
-----------
Add #define of MAXGROUPSIZE (100, in version 1.1)

Allocate the array sync_group[] to size MAXGROUPSIZE+1, to allow
next_sync_group_size to get all the way to MAXGROUPSIZE without blowing
out the end of the array

Add into the while loop that increments sync_group_size a check that we
haven't exceeded MAXGROUPSIZE. That way we won't blow past the end of
the array if next_sync_group_size gets set too high.

Tags:
----
REL_1_1_STABLE

Modified Files:
--------------
    slony1-engine/src/slon:
        remote_worker.c (r1.86.2.13 -> r1.86.2.14)

-------------- next part --------------
Index: remote_worker.c
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slon/remote_worker.c,v
retrieving revision 1.86.2.13
retrieving revision 1.86.2.14
diff -Lsrc/slon/remote_worker.c -Lsrc/slon/remote_worker.c -u -w -r1.86.2.13 -r1.86.2.14
--- src/slon/remote_worker.c
+++ src/slon/remote_worker.c
@@ -40,7 +40,7 @@
 #define WMSG_WAKEUP		1
 #define WMSG_CONFIRM	2
 
-
+#define MAXGROUPSIZE 100
 /*
  * Message structure resulting from a remote event
  */
@@ -435,7 +435,7 @@
 		 */
 		if (strcmp(event->ev_type, "SYNC") == 0)
 		{
-			SlonWorkMsg_event *sync_group[100];
+			SlonWorkMsg_event *sync_group[MAXGROUPSIZE+1];
 			int			sync_group_size;
 
 			int			seconds;
@@ -454,7 +454,7 @@
 			  /* Force last_sync_group_size to a reasonable range */
 				if (last_sync_group_size < 1)
 					last_sync_group_size = 1;
-				if (last_sync_group_size > 100)
+				if (last_sync_group_size > MAXGROUPSIZE)
 					last_sync_group_size = 1;
 
 				gettimeofday(&sync_end, NULL);
@@ -492,7 +492,7 @@
 				gettimeofday(&sync_start, NULL);
 
 				pthread_mutex_lock(&(node->message_lock));
-				while (sync_group_size < next_sync_group_size && node->message_head != NULL)
+				while (sync_group_size < next_sync_group_size && sync_group_size < MAXGROUPSIZE && node->message_head != NULL)
 				{
 					if (node->message_head->msg_type != WMSG_EVENT)
 						break;



More information about the Slony1-commit mailing list