Rev 55: Adjusted ib test tool #1. in http://samba.org/~tridge/psomogyi/

psomogyi at gamax.hu psomogyi at gamax.hu
Thu Jan 25 17:57:47 GMT 2007


------------------------------------------------------------
revno: 55
revision-id: psomogyi at gamax.hu-20070125175747-i22qqqgoh97f7i90
parent: psomogyi at gamax.hu-20070125132203-npzxebhbvncflu48
committer: Peter Somogyi <psomogyi at gamax.hu>
branch nick: ctdb
timestamp: Thu 2007-01-25 18:57:47 +0100
message:
  Adjusted ib test tool #1.
  Now fixed number of pingpong messages can be sent and then exit.
modified:
  tests/ibwrapper_test.c         ibwrapper_test.c-20061214171730-h11a2z5ed6pt66hj-1
=== modified file 'tests/ibwrapper_test.c'
--- a/tests/ibwrapper_test.c	2007-01-25 10:01:59 +0000
+++ b/tests/ibwrapper_test.c	2007-01-25 17:57:47 +0000
@@ -54,6 +54,8 @@
 
 	int	cnt;
 
+	int	nmsg; /* number of messages to send (client) */
+
 	int	kill_me;
 	struct ibw_ctx	*ibwctx;
 };
@@ -227,6 +229,14 @@
 			fprintf(stderr, "ibw_send error #2\n");
 			return -2;
 		}
+	} else {
+		if (tcx->nmsg) {
+			char	msg[26];
+			sprintf(msg, "hello world %d", tcx->nmsg--);
+			ibwtest_send_test_msg(tcx, conn, msg);
+			if (tcx->nmsg==0)
+				tcx->kill_me = 1;
+		}
 	}
 
 	return 0;
@@ -355,7 +365,9 @@
 	printf("\t-o name1:value1,name2:value2,... is a list of (name, value) pairs\n");
 	printf("\t-d addr1:port1,addr2:port2,... is a list of destination ip addresses\n");
 	printf("\t-t nsec delta time between sends in nanosec [default %d]\n", tcx->nsec);
+	printf("\t\t send message periodically and endless when nsec is non-zero\n");
 	printf("\t-s server mode (you have to give exactly one -d address:port in this case)\n");
+	printf("\t-n number of messages to send [default %d]\n", tcx->nmsg);
 	printf("Press ctrl+C to stop the program.\n");
 }
 
@@ -368,7 +380,8 @@
 
 	tcx = talloc_zero(NULL, struct ibwtest_ctx);
 	memset(tcx, 0, sizeof(struct ibwtest_ctx));
-	tcx->nsec = 1000;
+	tcx->nsec = 0;
+	tcx->nmsg = 1000;
 
 	/* here is the only case we can't avoid using global... */
 	testctx = tcx;
@@ -426,8 +439,9 @@
 		goto cleanup;
 
 	while(!tcx->kill_me) {
-		event_add_timed(ev, tcx, timeval_current_ofs(0, tcx->nsec),
-			ibwtest_timeout_handler, tcx);
+		if (tcx->nsec)
+			event_add_timed(ev, tcx, timeval_current_ofs(0, tcx->nsec),
+				ibwtest_timeout_handler, tcx);
 		event_loop_once(ev);
 	}
 



More information about the samba-cvs mailing list