gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r27851 - gnunet/src/mesh
Date: Wed, 10 Jul 2013 01:03:12 +0200

Author: bartpolot
Date: 2013-07-10 01:03:12 +0200 (Wed, 10 Jul 2013)
New Revision: 27851

Modified:
   gnunet/src/mesh/gnunet-service-mesh.c
Log:
- don't shcdule retransmissions of unreliable packets

Modified: gnunet/src/mesh/gnunet-service-mesh.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh.c       2013-07-09 22:52:26 UTC (rev 
27850)
+++ gnunet/src/mesh/gnunet-service-mesh.c       2013-07-09 23:03:12 UTC (rev 
27851)
@@ -4583,29 +4583,39 @@
    * (pretend we got it from a mesh peer)
    */
   {
-    struct MeshSentMessage *copy;
     struct GNUNET_MESH_Data *payload;
 
-    copy = GNUNET_malloc (sizeof (struct MeshSentMessage) + size);
-    copy->t = t;
-    copy->id = ntohl (data_msg->pid);
-    copy->is_forward = GNUNET_YES;
-    copy->retry_timer = GNUNET_TIME_UNIT_MINUTES;
-    copy->retry_task = GNUNET_SCHEDULER_add_delayed (copy->retry_timer,
-                                                     
&tunnel_retransmit_message,
-                                                     copy);
-    if (GNUNET_YES == t->reliable &&
-        GNUNET_OK !=
-        GNUNET_CONTAINER_multihashmap32_put (t->sent_messages_fwd,
-                                             copy->id,
-                                             copy,
-                                             
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))
+    if (GNUNET_YES == t->reliable)
     {
-      GNUNET_break (0);
-      GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
-      return;
+      struct MeshSentMessage *copy;
+
+      copy = GNUNET_malloc (sizeof (struct MeshSentMessage) + size);
+      copy->t = t;
+      copy->id = ntohl (data_msg->pid);
+      copy->is_forward = GNUNET_YES;
+      copy->retry_timer = GNUNET_TIME_UNIT_MINUTES;
+      copy->retry_task = GNUNET_SCHEDULER_add_delayed (copy->retry_timer,
+                                                       
&tunnel_retransmit_message,
+                                                       copy);
+      if (GNUNET_OK !=
+          GNUNET_CONTAINER_multihashmap32_put (t->sent_messages_fwd,
+                                               copy->id,
+                                               copy,
+                                               
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))
+      {
+        GNUNET_break (0);
+        GNUNET_SCHEDULER_cancel (copy->retry_task);
+        GNUNET_free (copy);
+        GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
+        return;
+      }
+      payload = (struct GNUNET_MESH_Data *) &copy[1];
     }
-    payload = (struct GNUNET_MESH_Data *) &copy[1];
+    else
+    {
+      static struct GNUNET_MESH_Data data_message;
+      payload = &data_message;
+    }
     memcpy (payload, data_msg, size);
     payload->oid = my_full_id;
     payload->tid = htonl (t->id.tid);
@@ -4706,29 +4716,40 @@
    * (pretend we got it from a mesh peer)
    */
   {
-    struct MeshSentMessage *copy;
     struct GNUNET_MESH_Data *payload;
 
-    copy = GNUNET_malloc (sizeof (struct MeshSentMessage) + size);
-    copy->t = t;
-    copy->id = ntohl (data_msg->pid);
-    copy->is_forward = GNUNET_NO;
-    copy->retry_timer = GNUNET_TIME_UNIT_MINUTES;
-    copy->retry_task = GNUNET_SCHEDULER_add_delayed (copy->retry_timer,
-                                                     
&tunnel_retransmit_message,
-                                                     copy);
-    if (GNUNET_YES == t->reliable &&
-        GNUNET_OK !=
-        GNUNET_CONTAINER_multihashmap32_put (t->sent_messages_bck,
-                                             copy->id,
-                                             copy,
-                                             
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))
+    if (GNUNET_YES == t->reliable)
     {
-      GNUNET_break (0);
-      GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
-      return;
+      struct MeshSentMessage *copy;
+
+      copy = GNUNET_malloc (sizeof (struct MeshSentMessage) + size);
+      copy->t = t;
+      copy->id = ntohl (data_msg->pid);
+      copy->is_forward = GNUNET_NO;
+      copy->retry_timer = GNUNET_TIME_UNIT_MINUTES;
+      copy->retry_task = GNUNET_SCHEDULER_add_delayed (copy->retry_timer,
+                                                       
&tunnel_retransmit_message,
+                                                       copy);
+      if (GNUNET_OK !=
+          GNUNET_CONTAINER_multihashmap32_put (t->sent_messages_bck,
+                                               copy->id,
+                                               copy,
+                                               
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))
+      {
+        GNUNET_break (0);
+        GNUNET_SCHEDULER_cancel (copy->retry_task);
+        GNUNET_free (copy);
+        GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
+        return;
+      }
+      payload = (struct GNUNET_MESH_Data *) &copy[1];
     }
-    payload = (struct GNUNET_MESH_Data *) &copy[1];
+    else
+    {
+      static struct GNUNET_MESH_Data data_message;
+      payload = &data_message;
+    }
+
     memcpy (payload, data_msg, size);
     GNUNET_PEER_resolve (t->id.oid, &payload->oid);
     payload->tid = htonl (t->id.tid);




reply via email to

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