gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r30191 - gnunet/src/mesh
Date: Tue, 15 Oct 2013 14:28:57 +0200

Author: bartpolot
Date: 2013-10-15 14:28:57 +0200 (Tue, 15 Oct 2013)
New Revision: 30191

Modified:
   gnunet/src/mesh/gnunet-service-mesh_channel.c
Log:
- avoid double ACK'ing to clients on loopback create
- fix ACK id being sent
- debug


Modified: gnunet/src/mesh/gnunet-service-mesh_channel.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_channel.c       2013-10-15 12:28:41 UTC 
(rev 30190)
+++ gnunet/src/mesh/gnunet-service-mesh_channel.c       2013-10-15 12:28:57 UTC 
(rev 30191)
@@ -325,7 +325,37 @@
     LOG (GNUNET_ERROR_TYPE_DEBUG, "add_buffered_data END\n");
 }
 
+/**
+ * Add a destination client to a channel, initializing all data structures
+ * in the channel and the client.
+ *
+ * @param ch Channel to which add the destination.
+ * @param c Client which to add to the channel.
+ */
+static void
+add_destination (struct MeshChannel *ch, struct MeshClient *c)
+{
+  if (NULL != ch->dest)
+  {
+    GNUNET_break (0);
+    return;
+  }
 
+  /* Assign local id as destination */
+  ch->lid_dest = GML_get_next_chid (c);
+
+  /* Store in client's hashmap */
+  GML_channel_add (c, ch->lid_dest, ch);
+
+  GNUNET_break (NULL == ch->dest_rel);
+  ch->dest_rel = GNUNET_new (struct MeshChannelReliability);
+  ch->dest_rel->ch = ch;
+  ch->dest_rel->expected_delay = MESH_RETRANSMIT_TIME;
+
+  ch->dest = c;
+}
+
+
 /**
  * Send data to a client.
  *
@@ -359,36 +389,6 @@
 
 
 /**
- * Add a client to a channel, initializing all needed data structures.
- *
- * @param ch Channel to which add the client.
- * @param c Client which to add to the channel.
- */
-void
-GMCH_add_client (struct MeshChannel *ch, struct MeshClient *c)
-{
-  if (NULL != ch->dest)
-  {
-    GNUNET_break (0);
-    return;
-  }
-
-  /* Assign local id as destination */
-  ch->lid_dest = GML_get_next_chid (c);
-
-  /* Store in client's hashmap */
-  GML_channel_add (c, ch->lid_dest, ch);
-
-  GNUNET_break (NULL == ch->dest_rel);
-  ch->dest_rel = GNUNET_new (struct MeshChannelReliability);
-  ch->dest_rel->ch = ch;
-  ch->dest_rel->expected_delay = MESH_RETRANSMIT_TIME;
-
-  ch->dest = c;
-}
-
-
-/**
  * Destroy all reliable messages queued for a channel,
  * during a channel destruction.
  * Frees the reliability structure itself.
@@ -916,6 +916,7 @@
 /********************************    API    
***********************************/
 
/******************************************************************************/
 
+
 /**
  * Get channel ID.
  *
@@ -1235,7 +1236,13 @@
   if (GNUNET_YES == ch->reliable)
     channel_save_copy (ch, &payload->header, fwd);
   if (GMT_get_buffer (ch->t, fwd) > 0)
-    GML_send_ack (c, fwd ? ch->lid_root : ch->lid_dest);
+  {
+    MESH_ChannelNumber ackid;
+    ackid = fwd ? ch->lid_root : ch->lid_dest;
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+         "  sending ack to client (%X)\n", ackid);
+    GML_send_ack (c, ackid);
+  }
 
   return GNUNET_OK;
 }
@@ -1545,20 +1552,20 @@
     channel_destroy (ch);
     return NULL;
   }
+  else
+  {
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "  client %p has port registered\n", c);
+  }
 
-  GMCH_add_client (ch, c);
+  add_destination (ch, c);
   if (GNUNET_YES == ch->reliable)
     LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! Reliable\n");
+  else
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! Not Reliable\n");
 
   GMCH_send_create (ch);
   channel_send_ack (ch, fwd);
 
-  if (GNUNET_NO == ch->dest_rel->client_ready)
-  {
-    GML_send_ack (ch->dest, ch->lid_dest);
-    ch->dest_rel->client_ready = GNUNET_YES;
-  }
-
   return ch;
 }
 




reply via email to

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