[Box Backup-commit] COMMIT r1969 - in box/chris/general/lib: common server

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Sat Dec 8 22:50:37 GMT 2007


Author: chris
Date: 2007-12-08 22:50:37 +0000 (Sat, 08 Dec 2007)
New Revision: 1969

Modified:
   box/chris/general/lib/common/Test.h
   box/chris/general/lib/server/ServerControl.h
Log:
Slightly improve output from waiting methods. (merges [1935])


Modified: box/chris/general/lib/common/Test.h
===================================================================
--- box/chris/general/lib/common/Test.h	2007-12-08 22:49:46 UTC (rev 1968)
+++ box/chris/general/lib/common/Test.h	2007-12-08 22:50:37 UTC (rev 1969)
@@ -419,7 +419,7 @@
 // Wait a given number of seconds for something to complete
 inline void wait_for_operation(int seconds)
 {
-	printf("waiting: ");
+	printf("Waiting: ");
 	fflush(stdout);
 	for(int l = 0; l < seconds; ++l)
 	{
@@ -427,7 +427,7 @@
 		printf(".");
 		fflush(stdout);
 	}
-	printf("\n");
+	printf(" done.\n");
 	fflush(stdout);
 }
 

Modified: box/chris/general/lib/server/ServerControl.h
===================================================================
--- box/chris/general/lib/server/ServerControl.h	2007-12-08 22:49:46 UTC (rev 1968)
+++ box/chris/general/lib/server/ServerControl.h	2007-12-08 22:50:37 UTC (rev 1969)
@@ -155,26 +155,26 @@
 
 	for (int i = 0; i < 30; i++)
 	{
-		if (!ServerIsAlive(pid)) break;
-		::sleep(1);
-		if (!ServerIsAlive(pid)) break;
-
 		if (i == 0) 
 		{
-			printf("waiting for server to die");
+			printf("Waiting for server to die: ");
 		}
 
 		printf(".");
 		fflush(stdout);
+
+		if (!ServerIsAlive(pid)) break;
+		::sleep(1);
+		if (!ServerIsAlive(pid)) break;
 	}
 
 	if (!ServerIsAlive(pid))
 	{
-		printf("done.\n");
+		printf(" done.\n");
 	}
 	else
 	{
-		printf("failed!\n");
+		printf(" failed!\n");
 	}
 
 	fflush(stdout);




More information about the Boxbackup-commit mailing list