aboutsummaryrefslogtreecommitdiff
path: root/src/transport/test_transport_api_reliability.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2010-09-14 10:46:48 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2010-09-14 10:46:48 +0000
commitbe3b82bc5505b32807f0cbea9a20c030185e7e29 (patch)
tree722a69cf7ca97663cc53e3747fa61f5f10f636d9 /src/transport/test_transport_api_reliability.c
parentc29e2dedc6913e39d17ae69b531287551ea54a8e (diff)
downloadgnunet-be3b82bc5505b32807f0cbea9a20c030185e7e29.tar.gz
gnunet-be3b82bc5505b32807f0cbea9a20c030185e7e29.zip
Added some information when test fails
Diffstat (limited to 'src/transport/test_transport_api_reliability.c')
-rw-r--r--src/transport/test_transport_api_reliability.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/transport/test_transport_api_reliability.c b/src/transport/test_transport_api_reliability.c
index 67884e5ea..d5b29e17a 100644
--- a/src/transport/test_transport_api_reliability.c
+++ b/src/transport/test_transport_api_reliability.c
@@ -98,6 +98,10 @@ static char * cert_file_p1;
98static char * key_file_p2; 98static char * key_file_p2;
99static char * cert_file_p2; 99static char * cert_file_p2;
100 100
101static int msg_scheduled;
102static int msg_sent;
103static int msg_recv;
104
101 105
102#if VERBOSE 106#if VERBOSE
103#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0) 107#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
@@ -148,6 +152,8 @@ static void
148end_badly (void *cls, 152end_badly (void *cls,
149 const struct GNUNET_SCHEDULER_TaskContext *tc) 153 const struct GNUNET_SCHEDULER_TaskContext *tc)
150{ 154{
155 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
156 "Reliability failed: \nLast message scheduled %u of %u \nLast message sent %u \nLast message received %u \n ", msg_scheduled, TOTAL_MSGS, msg_sent, msg_recv);
151 GNUNET_break (0); 157 GNUNET_break (0);
152 GNUNET_TRANSPORT_disconnect (p1.th); 158 GNUNET_TRANSPORT_disconnect (p1.th);
153 GNUNET_TRANSPORT_disconnect (p2.th); 159 GNUNET_TRANSPORT_disconnect (p2.th);
@@ -190,6 +196,7 @@ notify_receive (void *cls,
190 s = get_size (n); 196 s = get_size (n);
191 if (MTYPE != ntohs (message->type)) 197 if (MTYPE != ntohs (message->type))
192 return; 198 return;
199 msg_recv++;
193 if (ntohs (message->size) != s) 200 if (ntohs (message->size) != s)
194 { 201 {
195 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 202 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -273,6 +280,7 @@ notify_ready (void *cls, size_t size, void *buf)
273 hdr.header.size = htons (s); 280 hdr.header.size = htons (s);
274 hdr.header.type = htons (MTYPE); 281 hdr.header.type = htons (MTYPE);
275 hdr.num = htonl (n); 282 hdr.num = htonl (n);
283 msg_sent = n;
276 memcpy (&cbuf[ret], &hdr, sizeof (struct TestMessage)); 284 memcpy (&cbuf[ret], &hdr, sizeof (struct TestMessage));
277 ret += sizeof (struct TestMessage); 285 ret += sizeof (struct TestMessage);
278 memset (&cbuf[ret], n, s - sizeof (struct TestMessage)); 286 memset (&cbuf[ret], n, s - sizeof (struct TestMessage));
@@ -293,11 +301,14 @@ notify_ready (void *cls, size_t size, void *buf)
293 } 301 }
294 while (size - ret >= s); 302 while (size - ret >= s);
295 if (n < TOTAL_MSGS) 303 if (n < TOTAL_MSGS)
304 {
296 GNUNET_TRANSPORT_notify_transmit_ready (p2.th, 305 GNUNET_TRANSPORT_notify_transmit_ready (p2.th,
297 &p1.id, 306 &p1.id,
298 s, 0, TIMEOUT, 307 s, 0, TIMEOUT,
299 &notify_ready, 308 &notify_ready,
300 NULL); 309 NULL);
310 msg_scheduled = n;
311 }
301 if (n % 5000 == 0) 312 if (n % 5000 == 0)
302 { 313 {
303 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 314 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,