[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r24461 - gnunet/src/mesh
From: |
gnunet |
Subject: |
[GNUnet-SVN] r24461 - gnunet/src/mesh |
Date: |
Mon, 22 Oct 2012 20:18:04 +0200 |
Author: bartpolot
Date: 2012-10-22 20:18:04 +0200 (Mon, 22 Oct 2012)
New Revision: 24461
Modified:
gnunet/src/mesh/test_mesh_small.c
Log:
- fixes, varbosity
Modified: gnunet/src/mesh/test_mesh_small.c
===================================================================
--- gnunet/src/mesh/test_mesh_small.c 2012-10-22 18:15:16 UTC (rev 24460)
+++ gnunet/src/mesh/test_mesh_small.c 2012-10-22 18:18:04 UTC (rev 24461)
@@ -103,6 +103,11 @@
/**
+ * Size of each test packet
+ */
+size_t size_payload = sizeof (struct GNUNET_MessageHeader) + sizeof (uint32_t);
+
+/**
* Is the setup initialized?
*/
static int initialized;
@@ -429,7 +434,7 @@
th = GNUNET_MESH_notify_transmit_ready (tunnel, GNUNET_NO,
GNUNET_TIME_UNIT_FOREVER_REL,
destination,
- sizeof (struct GNUNET_MessageHeader),
+ size_payload,
&tmt_rdy, (void *) 1L);
if (NULL == th)
{
@@ -466,13 +471,19 @@
tmt_rdy (void *cls, size_t size, void *buf)
{
struct GNUNET_MessageHeader *msg = buf;
+ uint32_t *data;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
" tmt_rdy called\n");
- if (size < sizeof (struct GNUNET_MessageHeader) || NULL == buf)
+ if (size < size_payload || NULL == buf)
+ {
+ GNUNET_break (0);
return 0;
- msg->size = htons (sizeof (struct GNUNET_MessageHeader));
+ }
+ msg->size = htons (size);
msg->type = htons ((long) cls);
+ data = (uint32_t *) &msg[1];
+ *data = htonl (data_sent);
if (SPEED == test && GNUNET_YES == initialized)
{
data_sent++;
@@ -485,7 +496,7 @@
GNUNET_SCHEDULER_add_now(&data_task, NULL);
}
}
- return sizeof (struct GNUNET_MessageHeader);
+ return size_payload;
}
@@ -509,6 +520,7 @@
{
long client = (long) cls;
long expected_target_client;
+ uint32_t *data;
ok++;
@@ -543,7 +555,8 @@
break;
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO, " ok: (%d/%d)\n", ok, ok_goal);
-
+ data = (uint32_t *) &message[1];
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, " payload: (%u)\n", ntohl (*data));
if (SPEED == test && GNUNET_YES == test_backwards)
{
expected_target_client = 1L;
@@ -574,7 +587,7 @@
{
GNUNET_MESH_notify_transmit_ready (tunnel, GNUNET_NO,
GNUNET_TIME_UNIT_FOREVER_REL, sender,
- sizeof (struct GNUNET_MessageHeader),
+ size_payload,
&tmt_rdy, (void *) 1L);
}
else
@@ -592,7 +605,7 @@
" received ack %u\n", data_ack);
GNUNET_MESH_notify_transmit_ready (tunnel, GNUNET_NO,
GNUNET_TIME_UNIT_FOREVER_REL, sender,
- sizeof (struct GNUNET_MessageHeader),
+ size_payload,
&tmt_rdy, (void *) 1L);
if (data_ack < TOTAL_PACKETS && SPEED != test)
return GNUNET_OK;
@@ -785,7 +798,7 @@
data_sent = 0;
GNUNET_MESH_notify_transmit_ready (t, GNUNET_NO,
GNUNET_TIME_UNIT_FOREVER_REL, dest,
- sizeof (struct GNUNET_MessageHeader),
+ size_payload,
&tmt_rdy, (void *) 1L);
}
else
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r24461 - gnunet/src/mesh,
gnunet <=