Rev 92: use the new connect_wait code in the ctdb_messaging test in	http://samba.org/~tridge/ctdb ------------------------------------------------------------
revno: 92
revision-id: tridge@samba.org-20070411050922-59469f0a8a24cf4b
parent: tridge@samba.org-20070411045447-b201f3449504949a
committer: Andrew Tridgell 
branch nick: tridge
timestamp: Wed 2007-04-11 15:09:22 +1000
message:
  use the new connect_wait code in the ctdb_messaging test
modified:
  tests/ctdb_messaging.c         ctdb_messaging.c-20070411034205-6d6vne56pbih2x1p-1
=== modified file 'tests/ctdb_messaging.c'
--- a/tests/ctdb_messaging.c	2007-04-11 03:43:15 +0000
+++ b/tests/ctdb_messaging.c	2007-04-11 05:09:22 +0000
@@ -35,7 +35,7 @@
 static void message_handler(struct ctdb_context *ctdb, uint32_t srvid, 
 				 TDB_DATA data, void *private)
 {
-printf("client vnn:%d received a message to srvid:%d\\n",ctdb_get_vnn(ctdb),srvid);
+	printf("client vnn:%d received a message to srvid:%d\\n",ctdb_get_vnn(ctdb),srvid);
 }
 
 /*
@@ -142,8 +142,6 @@
 	/* start the protocol running */
 	ret = ctdb_start(ctdb);
 
-/*XXX why does this block forever?	ctdb_connect_wait(ctdb);*/
-
 	pid=fork();
 	if (pid) {
 		srvid=0;
@@ -157,8 +155,11 @@
 	data.dsize=0;
 	ctdb_set_message_handler(ctdb, srvid, message_handler, NULL);
 
-sleep(3);
-printf("sending message from vnn:%d to vnn:%d/srvid:%d\\n",ctdb_get_vnn(ctdb),ctdb_get_vnn(ctdb), 1-srvid);
+	ctdb_connect_wait(ctdb);
+
+	sleep(2);
+
+	printf("sending message from vnn:%d to vnn:%d/srvid:%d\\n",ctdb_get_vnn(ctdb),ctdb_get_vnn(ctdb), 1-srvid);
 	ctdb_send_message(ctdb, ctdb_get_vnn(ctdb), 1-srvid, data);
 
 	while(1){

