diff options
author | Luis Ontanon <luis.ontanon@gmail.com> | 2013-06-27 03:41:48 +0000 |
---|---|---|
committer | Luis Ontanon <luis.ontanon@gmail.com> | 2013-06-27 03:41:48 +0000 |
commit | e48b0084e19eacc30a2d8a8e274cc284973e0a2c (patch) | |
tree | 4f1f9c467037e08567984dd003687057777ec431 /echld_test.c | |
parent | ffe6d9c4d6fe36d7f2498154cdb12159b6b60aff (diff) | |
download | wireshark-e48b0084e19eacc30a2d8a8e274cc284973e0a2c.tar.gz wireshark-e48b0084e19eacc30a2d8a8e274cc284973e0a2c.tar.bz2 wireshark-e48b0084e19eacc30a2d8a8e274cc284973e0a2c.zip |
MS: Pong from the dispatcher!
svn path=/trunk/; revision=50183
Diffstat (limited to 'echld_test.c')
-rw-r--r-- | echld_test.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/echld_test.c b/echld_test.c index ccf7c73be9..872d53adfb 100644 --- a/echld_test.c +++ b/echld_test.c @@ -58,8 +58,10 @@ int pings = 0; int errors = 0; void ping_cb(long usec, void* data _U_) { - if (usec > 0) { - fprintf(stderr, "ping=%d usec=%d\n", pings ,(int)usec ); + + fprintf(stderr, "Ping ping=%d usec=%d\n", pings ,(int)usec ); + + if (usec >= 0) { pings++; } else { errors++; @@ -70,18 +72,16 @@ void ping_cb(long usec, void* data _U_) { int main(int argc, char** argv) { struct timeval tv; int tot_cycles = 0; + int max_cycles = 30; int npings; -// GString* str = g_string_new(""); tv.tv_sec = 0; tv.tv_usec = 250000; - - - echld_set_parent_dbg_level(4); + echld_set_parent_dbg_level(5); switch(argc) { case 1: - npings = 10; + npings = 3; break; case 2: npings = (int)atoi(argv[1]); @@ -91,14 +91,16 @@ int main(int argc, char** argv) { return 1; } + max_cycles = npings*4; + echld_initialize(ECHLD_ENCODING_JSON); do { - if (tot_cycles < npings) echld_ping(0,ping_cb,NULL); + if ( (tot_cycles > npings) && npings && npings-- ) echld_ping(0,ping_cb,NULL); tot_cycles++; echld_wait(&tv); - } while( (pings < 10) && (tot_cycles < 25)); + } while( (pings < npings) || (tot_cycles < max_cycles)); fprintf(stderr, "Done: pings=%d errors=%d tot_cycles=%d\n", pings, errors ,tot_cycles ); |