CVS User Account cvsuser
Wed Jul 27 21:34:41 PDT 2005
Log Message:
-----------
Attached is a patch that refactors slon a tiny bit, by creating
functions SlonyMain() and SlonyWatchdog() for the two branches of the
fork() command. It makes the code a little bit more readable from an
#ifdef WIN32 perspective, but mainly it's a bit of groundwork for
upcoming service integration code.

It also contains a bundle of changes to correct a previous error in some
win32 code that was committed with invalid line endings (don't ask me
how that happened.
[Magnus Hagander]

Modified Files:
--------------
    slony1-engine/src/slon:
        slon.c (r1.54 -> r1.55)
        slon.h (r1.50 -> r1.51)

-------------- next part --------------
Index: slon.c
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slon/slon.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -Lsrc/slon/slon.c -Lsrc/slon/slon.c -u -w -r1.54 -r1.55
--- src/slon/slon.c
+++ src/slon/slon.c
@@ -60,7 +60,9 @@
 static pthread_t main_thread;
 static char *const *main_argv;
 
+static void SlonMain(PGconn *startup_conn);
 #ifndef WIN32
+static void SlonWatchdog(void);
 static void sighandler(int signo);
 static void main_sigalrmhandler(int signo);
 static void slon_kill_child(void);
@@ -332,8 +334,23 @@
 		slon_exit(-1);
 	}
 	else if (slon_cpid == 0) /* child */
-#endif /* WIN32 */
+		SlonMain(startup_conn);
+	else
+		SlonWatchdog();
+#else
+	SlonMain(startup_conn);
+#endif
+	exit(0);
+}
+
+
+static void SlonMain(PGconn *startup_conn)
 	{
+		PGresult *res;
+		SlonDString query;
+		int i,n;
+		char		pipe_c;
+
 		slon_pid = getpid();
 #ifndef WIN32
 		slon_ppid = getppid();
@@ -716,9 +733,14 @@
 
 		exit(0);
 	}
-#ifndef WIN32 /* Again, no watchdog process on WIN32 */
-	else /* parent */
+
+#ifndef WIN32
+static void SlonWatchdog(void)
 	{
+		pid_t		pid;
+#if !defined(CYGWIN) && !defined(WIN32)
+		struct sigaction act;
+#endif
 		slon_log(SLON_DEBUG2, "slon: watchdog process started\n");
 
 		/* 
@@ -787,11 +809,8 @@
 		 */
 		slon_exit(0);
 	}
-#endif /* WIN32 */
-}
 
 
-#ifndef WIN32
 static void
 main_sigalrmhandler(int signo)
 {
Index: slon.h
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slon/slon.h,v
retrieving revision 1.50
retrieving revision 1.51
diff -Lsrc/slon/slon.h -Lsrc/slon/slon.h -u -w -r1.50 -r1.51


More information about the Slony1-commit mailing list