gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r23182 - gnunet/src/mesh


From: gnunet
Subject: [GNUnet-SVN] r23182 - gnunet/src/mesh
Date: Thu, 9 Aug 2012 19:15:43 +0200

Author: bartpolot
Date: 2012-08-09 19:15:43 +0200 (Thu, 09 Aug 2012)
New Revision: 23182

Modified:
   gnunet/src/mesh/mesh_api.c
   gnunet/src/mesh/test_mesh_local_traffic.c
Log:
- better debug

Modified: gnunet/src/mesh/mesh_api.c
===================================================================
--- gnunet/src/mesh/mesh_api.c  2012-08-09 15:55:48 UTC (rev 23181)
+++ gnunet/src/mesh/mesh_api.c  2012-08-09 17:15:43 UTC (rev 23182)
@@ -908,6 +908,7 @@
   MESH_TunnelNumber tid;
 
   tid = ntohl (msg->tunnel_id);
+  LOG (GNUNET_ERROR_TYPE_DEBUG, "Creating incoming tunnel %X\n", tid);
   if (tid < GNUNET_MESH_LOCAL_TUNNEL_ID_SERV)
   {
     GNUNET_break (0);
@@ -930,8 +931,9 @@
     t->tid = tid;
     atsi.type = 0;
     atsi.value = 0;
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "  created tunnel %p\n", t);
     t->ctx = h->new_tunnel (h->cls, t, &msg->peer, &atsi);
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "new incoming tunnel %X\n", t->tid);
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "User notified\n");
   }
   else
   {
@@ -1187,7 +1189,7 @@
     reconnect (h);
     return;
   }
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "received a message type %s from MESH\n",
+  LOG (GNUNET_ERROR_TYPE_DEBUG, "received a message: %s\n",
        GNUNET_MESH_DEBUG_M2S (ntohs (msg->type)));
   switch (ntohs (msg->type))
   {
@@ -1623,6 +1625,8 @@
 
   LOG (GNUNET_ERROR_TYPE_DEBUG, "Creating new tunnel\n");
   t = create_tunnel (h, 0);
+  LOG (GNUNET_ERROR_TYPE_DEBUG, "  at %p\n", t);
+  LOG (GNUNET_ERROR_TYPE_DEBUG, "  number %X\n", t->tid);
   t->connect_handler = connect_handler;
   t->disconnect_handler = disconnect_handler;
   t->cls = handler_cls;

Modified: gnunet/src/mesh/test_mesh_local_traffic.c
===================================================================
--- gnunet/src/mesh/test_mesh_local_traffic.c   2012-08-09 15:55:48 UTC (rev 
23181)
+++ gnunet/src/mesh/test_mesh_local_traffic.c   2012-08-09 17:15:43 UTC (rev 
23182)
@@ -186,11 +186,14 @@
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending data packet # %u\n",
               *sent);
   GNUNET_assert (size >= msize);
-  (*sent)++;
-  if (target > *sent)
-    GNUNET_MESH_notify_transmit_ready (t, GNUNET_NO,
-                                       GNUNET_TIME_UNIT_FOREVER_REL,
-                                       &peer_id, msize, &tmt_rdy, cls);
+  if (GNUNET_YES == started)
+  {
+    (*sent)++;
+    if (target > *sent)
+      GNUNET_MESH_notify_transmit_ready (t, GNUNET_NO,
+                                        GNUNET_TIME_UNIT_FOREVER_REL,
+                                        &peer_id, msize, &tmt_rdy, cls);
+  }
   m->size = htons (msize);
   m->type = htons (1);
   msg->data = htonl (*sent - 1);
@@ -226,6 +229,19 @@
     GNUNET_break (2 == *peer_number);
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got initial data packet\n");
     started = GNUNET_YES;
+    start_time = GNUNET_TIME_absolute_get();
+    if (FWD != test) // Send leaf -> root
+      GNUNET_MESH_notify_transmit_ready (tunnel, GNUNET_NO,
+                                        GNUNET_TIME_UNIT_FOREVER_REL,
+                                        NULL,
+                                        sizeof (struct test_traffic_message),
+                                        &tmt_rdy, &two);
+    if (BCK != test) // Send root -> leaf
+      GNUNET_MESH_notify_transmit_ready (t, GNUNET_NO,
+                                        GNUNET_TIME_UNIT_FOREVER_REL,
+                                        &peer_id,
+                                        sizeof (struct test_traffic_message),
+                                        &tmt_rdy, &one);
     return GNUNET_OK;
   }
 
@@ -282,26 +298,13 @@
 {
   unsigned int id = *(unsigned int *) cls;
 
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "received incoming tunnel\n");
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "received incoming tunnel %p\n", 
tunnel);
   if (id != 2)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                 "received incoming tunnel on peer 1\n");
     result = GNUNET_SYSERR;
   }
-  start_time = GNUNET_TIME_absolute_get();
-  if (FWD != test) // Send leaf -> root
-    GNUNET_MESH_notify_transmit_ready (tunnel, GNUNET_NO,
-                                       GNUNET_TIME_UNIT_FOREVER_REL,
-                                       NULL,
-                                       sizeof (struct test_traffic_message),
-                                       &tmt_rdy, &two);
-  if (BCK != test) // Send root -> leaf
-    GNUNET_MESH_notify_transmit_ready (t, GNUNET_NO,
-                                       GNUNET_TIME_UNIT_FOREVER_REL,
-                                       &peer_id,
-                                       sizeof (struct test_traffic_message),
-                                       &tmt_rdy, &one);
   return NULL;
 }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]