- debug
[oweals/gnunet.git] / src / mesh / gnunet-service-mesh_channel.c
index bded10dd8d4aa8599201caa1841024bef96b81aa..b02da1abac9e62d6d4ea99cda958ccf9169c8c44 100644 (file)
@@ -455,16 +455,17 @@ send_client_ack (struct MeshChannel *ch, int fwd)
 {
   struct MeshChannelReliability *rel = fwd ? ch->root_rel : ch->dest_rel;
 
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "  sending %s ack to client on channel %s\n",
+       fwd ? "FWD" : "BCK", GMCH_2s (ch));
+
   if (NULL == rel)
   {
     GNUNET_break (0);
     return;
   }
-  if (GNUNET_YES == rel->client_ready)
-    return;
 
   GML_send_ack (fwd ? ch->root : ch->dest, fwd ? ch->lid_root : ch->lid_dest);
-  rel->client_ready = GNUNET_YES;
 }
 
 
@@ -720,6 +721,7 @@ channel_confirm (struct MeshChannel *ch, int fwd)
   ch->state = MESH_CHANNEL_READY;
 
   rel = fwd ? ch->root_rel : ch->dest_rel;
+  rel->client_ready = GNUNET_YES;
   for (copy = rel->head_sent; NULL != copy; copy = next)
   {
     struct GNUNET_MessageHeader *msg;
@@ -1254,14 +1256,12 @@ GMCH_handle_local_data (struct MeshChannel *ch,
   payload->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_DATA);
   payload->chid = htonl (ch->gid);
   LOG (GNUNET_ERROR_TYPE_DEBUG, "  sending on channel...\n");
-  GMCH_send_prebuilt_message (&payload->header, ch, fwd);
-
   if (GNUNET_YES == ch->reliable)
     channel_save_copy (ch, &payload->header, fwd);
+  GMCH_send_prebuilt_message (&payload->header, ch, fwd);
+
   if (GMT_get_buffer (ch->t, fwd) > 0)
   {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "  sending ack to client (%X)\n", ackid);
     send_client_ack (ch, fwd);
   }