- backport fix to mesh_new
[oweals/gnunet.git] / src / mesh / gnunet-service-mesh.c
index 5cc0d8c0dd34d86401e244e5ceaab537d7263171..1f7f14b7ec8983f9ca05f15ad81cc49126f981dd 100644 (file)
@@ -4018,23 +4018,25 @@ tunnel_send_child_bck_ack (void *cls,
   struct MeshTunnel *t = cls;
   struct MeshTunnelChildInfo *cinfo;
   struct GNUNET_PeerIdentity peer;
+  uint32_t ack;
 
   GNUNET_PEER_resolve (id, &peer);
   cinfo = tunnel_get_neighbor_fc (t, &peer);
+  ack = cinfo->bck_pid + t->bck_queue_max - t->bck_queue_n;
 
-  if (cinfo->bck_ack != cinfo->bck_pid &&
-      GNUNET_NO == GMC_is_pid_bigger (cinfo->bck_ack, cinfo->bck_pid))
+  if (cinfo->bck_ack == ack)
   {
+    // FIXME fc allow force on poll
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "    Not sending ACK, not needed\n");
     return;
   }
+  cinfo->bck_ack = ack;
 
-  cinfo->bck_ack = t->bck_queue_max - t->bck_queue_n + cinfo->bck_pid;
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "    Sending BCK ACK %u\n",
-              cinfo->bck_ack);
-  send_ack (t, &peer, cinfo->bck_ack);
+              "    Sending BCK ACK %u (last sent: %u)\n",
+              ack, cinfo->bck_ack);
+  send_ack (t, &peer, ack);
 }
 
 
@@ -6544,6 +6546,8 @@ handle_local_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client)
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "   (SERVER DOWN)\n");
     return;
   }
+
+//   return; uncomment for regex_profiler
   c = clients;
   while (NULL != c)
   {
@@ -6733,10 +6737,13 @@ handle_local_announce_regex (void *cls, struct GNUNET_SERVER_Client *client,
   msg = (struct GNUNET_MESH_RegexAnnounce *) message;
   len = ntohs (message->size) - sizeof(struct GNUNET_MESH_RegexAnnounce);
   regex = GNUNET_malloc (len + 1);
-  memcpy (regex, &message[1], len);
+  memcpy (regex, &msg[1], len);
   regex[len] = '\0';
   rd.regex = regex;
   rd.compression = ntohs (msg->compression_characters);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "  length %u\n", len);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "  regex %s\n", regex);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "  cm %u\n", ntohs(rd.compression));
   GNUNET_array_append (c->regexes, c->n_regex, rd);
   if (GNUNET_SCHEDULER_NO_TASK == c->regex_announce_task)
   {
@@ -7721,7 +7728,7 @@ handle_local_to_origin (void *cls, struct GNUNET_SERVER_Client *client,
     GNUNET_PEER_resolve (t->id.oid, &copy->oid);
     copy->tid = htonl (t->id.tid);
     copy->ttl = htonl (default_ttl);
-    copy->pid = htonl (++(t->bck_pid));
+    copy->pid = htonl (t->bck_pid + 1);
 
     copy->sender = my_full_id;
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,