aboutsummaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2011-10-10 10:50:08 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2011-10-10 10:50:08 +0000
commit98aa0c158ee5cf82097432eff4cd15da2993198d (patch)
treeab69b7ae76b430ec5c510d488344b36cdd0ae14f /src/transport
parent094a3aa5ed1723f6cf17498b3d233c61736b399a (diff)
downloadgnunet-98aa0c158ee5cf82097432eff4cd15da2993198d.tar.gz
gnunet-98aa0c158ee5cf82097432eff4cd15da2993198d.zip
fixes
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/test_transport_api_reliability.c16
-rw-r--r--src/transport/test_transport_api_unreliability.c26
-rw-r--r--src/transport/test_transport_api_unreliability_constant.c15
3 files changed, 44 insertions, 13 deletions
diff --git a/src/transport/test_transport_api_reliability.c b/src/transport/test_transport_api_reliability.c
index 21912e848..5d17b8d7e 100644
--- a/src/transport/test_transport_api_reliability.c
+++ b/src/transport/test_transport_api_reliability.c
@@ -81,6 +81,9 @@ char *cfg_file_p2;
81 81
82struct GNUNET_TRANSPORT_TESTING_handle * tth; 82struct GNUNET_TRANSPORT_TESTING_handle * tth;
83 83
84static GNUNET_TRANSPORT_TESTING_ConnectRequest cc;
85
86
84/* 87/*
85 * Testcase specific declarations 88 * Testcase specific declarations
86 */ 89 */
@@ -147,8 +150,13 @@ end ()
147 GNUNET_TRANSPORT_notify_transmit_ready_cancel (th); 150 GNUNET_TRANSPORT_notify_transmit_ready_cancel (th);
148 th = NULL; 151 th = NULL;
149 152
153 if (cc != NULL)
154 GNUNET_TRANSPORT_TESTING_connect_peers_cancel(tth, cc);
155
150 GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1); 156 GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1);
151 GNUNET_TRANSPORT_TESTING_stop_peer (tth, p2); 157 GNUNET_TRANSPORT_TESTING_stop_peer (tth, p2);
158
159 GNUNET_TRANSPORT_TESTING_done (tth);
152} 160}
153 161
154static void 162static void
@@ -166,6 +174,9 @@ end_badly ()
166 GNUNET_TRANSPORT_notify_transmit_ready_cancel (th); 174 GNUNET_TRANSPORT_notify_transmit_ready_cancel (th);
167 th = NULL; 175 th = NULL;
168 176
177 if (cc != NULL)
178 GNUNET_TRANSPORT_TESTING_connect_peers_cancel(tth, cc);
179
169 if (p1 != NULL) 180 if (p1 != NULL)
170 GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1); 181 GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1);
171 if (p2 != NULL) 182 if (p2 != NULL)
@@ -402,7 +413,10 @@ testing_connect_cb (struct PeerContext *p1, struct PeerContext *p2, void *cls)
402 p2->no, GNUNET_i2s (&p2->id)); 413 p2->no, GNUNET_i2s (&p2->id));
403 GNUNET_free (p1_c); 414 GNUNET_free (p1_c);
404 415
416 cc = NULL;
417
405 GNUNET_SCHEDULER_add_now (&sendtask, NULL); 418 GNUNET_SCHEDULER_add_now (&sendtask, NULL);
419
406} 420}
407 421
408void start_cb (struct PeerContext * p, 422void start_cb (struct PeerContext * p,
@@ -435,7 +449,7 @@ void start_cb (struct PeerContext * p,
435 sender->no, sender_c, 449 sender->no, sender_c,
436 receiver->no, GNUNET_i2s (&receiver->id)); 450 receiver->no, GNUNET_i2s (&receiver->id));
437 451
438 GNUNET_TRANSPORT_TESTING_connect_peers (tth, p1, p2, &testing_connect_cb, NULL); 452 cc = GNUNET_TRANSPORT_TESTING_connect_peers (tth, p1, p2, &testing_connect_cb, NULL);
439 453
440} 454}
441 455
diff --git a/src/transport/test_transport_api_unreliability.c b/src/transport/test_transport_api_unreliability.c
index 20b05a50f..a18a809c9 100644
--- a/src/transport/test_transport_api_unreliability.c
+++ b/src/transport/test_transport_api_unreliability.c
@@ -39,7 +39,7 @@
39#include "transport.h" 39#include "transport.h"
40#include "transport-testing.h" 40#include "transport-testing.h"
41 41
42#define VERBOSE GNUNET_EXTRA_LOGGING 42#define VERBOSE GNUNET_NO
43 43
44#define VERBOSE_ARM GNUNET_EXTRA_LOGGING 44#define VERBOSE_ARM GNUNET_EXTRA_LOGGING
45 45
@@ -78,7 +78,7 @@ char *cfg_file_p2;
78uint32_t max_bps_p1; 78uint32_t max_bps_p1;
79uint32_t max_bps_p2; 79uint32_t max_bps_p2;
80 80
81struct TransportTestingHandle * tth; 81struct GNUNET_TRANSPORT_TESTING_handle * tth;
82 82
83/* 83/*
84 * Testcase specific declarations 84 * Testcase specific declarations
@@ -115,6 +115,8 @@ static struct GNUNET_TIME_Absolute start_time;
115 115
116static char bitmap[TOTAL_MSGS / 8]; 116static char bitmap[TOTAL_MSGS / 8];
117 117
118static GNUNET_TRANSPORT_TESTING_ConnectRequest cc;
119
118/* 120/*
119 * END Testcase specific declarations 121 * END Testcase specific declarations
120 */ 122 */
@@ -152,6 +154,10 @@ end ()
152 GNUNET_TRANSPORT_notify_transmit_ready_cancel (th); 154 GNUNET_TRANSPORT_notify_transmit_ready_cancel (th);
153 th = NULL; 155 th = NULL;
154 156
157 if (cc != NULL)
158 GNUNET_TRANSPORT_TESTING_connect_peers_cancel(tth, cc);
159 cc = NULL;
160
155 GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1); 161 GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1);
156 GNUNET_TRANSPORT_TESTING_stop_peer (tth, p2); 162 GNUNET_TRANSPORT_TESTING_stop_peer (tth, p2);
157 163
@@ -193,6 +199,10 @@ end_badly ()
193 GNUNET_TRANSPORT_notify_transmit_ready_cancel (th); 199 GNUNET_TRANSPORT_notify_transmit_ready_cancel (th);
194 th = NULL; 200 th = NULL;
195 201
202 if (cc != NULL)
203 GNUNET_TRANSPORT_TESTING_connect_peers_cancel(tth, cc);
204 cc = NULL;
205
196 if (p1 != NULL) 206 if (p1 != NULL)
197 GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1); 207 GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1);
198 if (p2 != NULL) 208 if (p2 != NULL)
@@ -319,7 +329,6 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
319 } 329 }
320 if (n == TOTAL_MSGS) 330 if (n == TOTAL_MSGS)
321 { 331 {
322 fprintf (stderr, "\n");
323 end (); 332 end ();
324 } 333 }
325} 334}
@@ -387,7 +396,7 @@ notify_ready (void *cls, size_t size, void *buf)
387 { 396 {
388 fprintf (stderr, "\n"); 397 fprintf (stderr, "\n");
389 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 398 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
390 "All messages scheduled to be sent!!\n"); 399 "All messages scheduled to be sent\n");
391 if (GNUNET_SCHEDULER_NO_TASK != die_task) 400 if (GNUNET_SCHEDULER_NO_TASK != die_task)
392 GNUNET_SCHEDULER_cancel (die_task); 401 GNUNET_SCHEDULER_cancel (die_task);
393 die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL); 402 die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL);
@@ -451,15 +460,14 @@ static void
451testing_connect_cb (struct PeerContext *p1, struct PeerContext *p2, void *cls) 460testing_connect_cb (struct PeerContext *p1, struct PeerContext *p2, void *cls)
452{ 461{
453 char *p1_c = strdup (GNUNET_i2s (&p1->id)); 462 char *p1_c = strdup (GNUNET_i2s (&p1->id));
454
455 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peers connected: %s <-> %s\n", p1_c, 463 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peers connected: %s <-> %s\n", p1_c,
456 GNUNET_i2s (&p2->id)); 464 GNUNET_i2s (&p2->id));
457 GNUNET_free (p1_c); 465 GNUNET_free (p1_c);
458 466
459 test_connected = GNUNET_YES; 467 test_connected = GNUNET_YES;
468 cc = NULL;
460 469
461 // FIXME: THIS IS REQUIRED! SEEMS TO BE A BUG! 470 GNUNET_SCHEDULER_add_now (&sendtask, NULL);
462 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &sendtask, NULL);
463} 471}
464 472
465void start_cb (struct PeerContext * p, 473void start_cb (struct PeerContext * p,
@@ -476,9 +484,7 @@ void start_cb (struct PeerContext * p,
476 return; 484 return;
477 485
478 test_connected = GNUNET_NO; 486 test_connected = GNUNET_NO;
479 487 cc = GNUNET_TRANSPORT_TESTING_connect_peers (tth, p1, p2, &testing_connect_cb, NULL);
480 test_connected = GNUNET_NO;
481 GNUNET_TRANSPORT_TESTING_connect_peers (tth, p1, p2, &testing_connect_cb, NULL);
482 488
483} 489}
484 490
diff --git a/src/transport/test_transport_api_unreliability_constant.c b/src/transport/test_transport_api_unreliability_constant.c
index f5adeb25c..a74e6d2eb 100644
--- a/src/transport/test_transport_api_unreliability_constant.c
+++ b/src/transport/test_transport_api_unreliability_constant.c
@@ -80,6 +80,8 @@ char *cfg_file_p2;
80uint32_t max_bps_p1; 80uint32_t max_bps_p1;
81uint32_t max_bps_p2; 81uint32_t max_bps_p2;
82 82
83static GNUNET_TRANSPORT_TESTING_ConnectRequest cc;
84
83/* 85/*
84 * Testcase specific declarations 86 * Testcase specific declarations
85 */ 87 */
@@ -151,6 +153,10 @@ end ()
151 GNUNET_TRANSPORT_notify_transmit_ready_cancel (th); 153 GNUNET_TRANSPORT_notify_transmit_ready_cancel (th);
152 th = NULL; 154 th = NULL;
153 155
156 if (cc != NULL)
157 GNUNET_TRANSPORT_TESTING_connect_peers_cancel(tth, cc);
158 cc = NULL;
159
154 GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1); 160 GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1);
155 GNUNET_TRANSPORT_TESTING_stop_peer (tth, p2); 161 GNUNET_TRANSPORT_TESTING_stop_peer (tth, p2);
156 162
@@ -179,6 +185,10 @@ end_badly ()
179 GNUNET_TRANSPORT_notify_transmit_ready_cancel (th); 185 GNUNET_TRANSPORT_notify_transmit_ready_cancel (th);
180 th = NULL; 186 th = NULL;
181 187
188 if (cc != NULL)
189 GNUNET_TRANSPORT_TESTING_connect_peers_cancel(tth, cc);
190 cc = NULL;
191
182 if (p1 != NULL) 192 if (p1 != NULL)
183 GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1); 193 GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1);
184 if (p2 != NULL) 194 if (p2 != NULL)
@@ -415,6 +425,8 @@ testing_connect_cb (struct PeerContext *p1, struct PeerContext *p2, void *cls)
415 GNUNET_i2s (&p2->id)); 425 GNUNET_i2s (&p2->id));
416 GNUNET_free (p1_c); 426 GNUNET_free (p1_c);
417 427
428 cc = NULL;
429
418 GNUNET_SCHEDULER_add_now (&sendtask, NULL); 430 GNUNET_SCHEDULER_add_now (&sendtask, NULL);
419} 431}
420 432
@@ -431,8 +443,7 @@ void start_cb (struct PeerContext * p,
431 if (started != 2) 443 if (started != 2)
432 return; 444 return;
433 445
434 GNUNET_TRANSPORT_TESTING_connect_peers (tth, p1, p2, &testing_connect_cb, NULL); 446 cc = GNUNET_TRANSPORT_TESTING_connect_peers (tth, p1, p2, &testing_connect_cb, NULL);
435
436} 447}
437 448
438static void 449static void