fixes. lunch break
[oweals/gnunet.git] / src / mesh / gnunet-service-mesh.c
index 936b81ca7e4af1441fda1be3be8480bfd69662ca..963a199e53f58810273147f465c30bdaf6779d1d 100644 (file)
@@ -1036,10 +1036,10 @@ send_client_tunnel_create (struct MeshTunnel *t)
   msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_CREATE);
   msg.tunnel_id = htonl (t->local_tid_dest);
   msg.port = htonl (t->port);
-  msg.options = 0;
-  msg.options |= GNUNET_YES == t->reliable ? GNUNET_MESH_OPTION_RELIABLE : 0;
-  msg.options |= GNUNET_YES == t->nobuffer ? GNUNET_MESH_OPTION_NOBUFFER : 0;
-  msg.options = htonl (msg.options);
+  msg.opt = 0;
+  msg.opt |= GNUNET_YES == t->reliable ? GNUNET_MESH_OPTION_RELIABLE : 0;
+  msg.opt |= GNUNET_YES == t->nobuffer ? GNUNET_MESH_OPTION_NOBUFFER : 0;
+  msg.opt = htonl (msg.opt);
   GNUNET_PEER_resolve (t->id.oid, &msg.peer);
   GNUNET_SERVER_notification_context_unicast (nc, t->client->handle,
                                               &msg.header, GNUNET_NO);
@@ -2086,6 +2086,9 @@ tunnel_send_fwd_data_ack (struct MeshTunnel *t)
     delta = copy->mid - t->bck_rel->mid_recv;
     mask = 0x1 << delta;
     msg.futures |= mask;
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                " setting bit for %u (delta %u) (%llX) -> %llX\n",
+                copy->mid, delta, mask, msg.futures);
   }
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " final futures %llX\n", msg.futures);
 
@@ -2384,6 +2387,8 @@ tunnel_add_buffer_ucast (struct MeshTunnel *t,
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "add_buffer_ucast %llu\n", mid);
 
   copy = GNUNET_malloc (sizeof (*copy) + size);
+  copy->mid = mid;
+  copy->rel = rel;
   memcpy (&copy[1], msg, size);
 
   // FIXME do something better than O(n), although n < 64...
@@ -2428,13 +2433,16 @@ tunnel_free_buffer_ucast (struct MeshTunnel *t,
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "free_sent_buffer %llu %llX\n",
               mid, bitfield);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              " rel %p, copy %p\n",
+              mid, bitfield);
   rel = t->fwd_rel;
   for (i = 0, copy = rel->head_recv;
        i < 64 && NULL != copy && 0 != bitfield;
        i++, copy = next)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " trying %u\n", i);
-    mask = 0x1 << i;
+    mask = 0x1LL << i;
     if (0 == (bitfield & mask))
      continue;
 
@@ -4836,7 +4844,7 @@ handle_local_tunnel_create (void *cls, struct GNUNET_SERVER_Client *client,
     return;
   }
   t->port = ntohl (t_msg->port);
-  tunnel_set_options (t, ntohl (t_msg->options));
+  tunnel_set_options (t, ntohl (t_msg->opt));
   if (GNUNET_YES == t->reliable)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! Reliable\n");