diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-01-27 17:36:01 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-01-27 17:36:01 +0100 |
commit | ff7f24a5b8e3eb85e36bfc25faaa45aea8655dc5 (patch) | |
tree | 6264da77f09436824dd43a49f9d9491e553fa6f8 /src/cadet/test_cadet.c | |
parent | 80f33364925f6718673dafaf7f06940c2b06af06 (diff) | |
download | gnunet-ff7f24a5b8e3eb85e36bfc25faaa45aea8655dc5.tar.gz gnunet-ff7f24a5b8e3eb85e36bfc25faaa45aea8655dc5.zip |
allow for message drops by CADET in unreliable mode
Diffstat (limited to 'src/cadet/test_cadet.c')
-rw-r--r-- | src/cadet/test_cadet.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/cadet/test_cadet.c b/src/cadet/test_cadet.c index efc4f96b3..b8587d449 100644 --- a/src/cadet/test_cadet.c +++ b/src/cadet/test_cadet.c | |||
@@ -218,6 +218,11 @@ static unsigned int ka_sent; | |||
218 | */ | 218 | */ |
219 | static unsigned int ka_received; | 219 | static unsigned int ka_received; |
220 | 220 | ||
221 | /** | ||
222 | * How many messages were dropped by CADET because of full buffers? | ||
223 | */ | ||
224 | static unsigned int msg_dropped; | ||
225 | |||
221 | 226 | ||
222 | /** | 227 | /** |
223 | * Get the client number considered as the "target" or "receiver", depending on | 228 | * Get the client number considered as the "target" or "receiver", depending on |
@@ -390,6 +395,7 @@ stats_iterator (void *cls, | |||
390 | { | 395 | { |
391 | static const char *s_sent = "# keepalives sent"; | 396 | static const char *s_sent = "# keepalives sent"; |
392 | static const char *s_recv = "# keepalives received"; | 397 | static const char *s_recv = "# keepalives received"; |
398 | static const char *drops = "# messages dropped due to full buffer"; | ||
393 | uint32_t i; | 399 | uint32_t i; |
394 | 400 | ||
395 | i = GNUNET_TESTBED_get_index (peer); | 401 | i = GNUNET_TESTBED_get_index (peer); |
@@ -401,9 +407,10 @@ stats_iterator (void *cls, | |||
401 | (unsigned long long) value); | 407 | (unsigned long long) value); |
402 | if (0 == strncmp (s_sent, name, strlen (s_sent)) && 0 == i) | 408 | if (0 == strncmp (s_sent, name, strlen (s_sent)) && 0 == i) |
403 | ka_sent = value; | 409 | ka_sent = value; |
404 | |||
405 | if (0 == strncmp(s_recv, name, strlen (s_recv)) && peers_requested - 1 == i) | 410 | if (0 == strncmp(s_recv, name, strlen (s_recv)) && peers_requested - 1 == i) |
406 | ka_received = value; | 411 | ka_received = value; |
412 | if (0 == strncmp(drops, name, strlen (drops))) | ||
413 | msg_dropped += value; | ||
407 | 414 | ||
408 | return GNUNET_OK; | 415 | return GNUNET_OK; |
409 | } | 416 | } |
@@ -435,7 +442,7 @@ gather_stats_and_exit (void *cls) | |||
435 | } | 442 | } |
436 | stats_op = GNUNET_TESTBED_get_statistics (peers_running, testbed_peers, | 443 | stats_op = GNUNET_TESTBED_get_statistics (peers_running, testbed_peers, |
437 | "cadet", NULL, | 444 | "cadet", NULL, |
438 | stats_iterator, stats_cont, cls); | 445 | &stats_iterator, stats_cont, cls); |
439 | } | 446 | } |
440 | 447 | ||
441 | 448 | ||
@@ -1134,8 +1141,10 @@ main (int argc, char *argv[]) | |||
1134 | &channel_cleaner, | 1141 | &channel_cleaner, |
1135 | handlers, | 1142 | handlers, |
1136 | ports); | 1143 | ports); |
1144 | if (NULL != strstr (argv[0], "_reliable")) | ||
1145 | msg_dropped = 0; /* dropped should be retransmitted */ | ||
1137 | 1146 | ||
1138 | if (ok_goal > ok) | 1147 | if (ok_goal > ok - msg_dropped) |
1139 | { | 1148 | { |
1140 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1149 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1141 | "FAILED! (%d/%d)\n", ok, ok_goal); | 1150 | "FAILED! (%d/%d)\n", ok, ok_goal); |