- Remove deprecated code, coverity 10236
[oweals/gnunet.git] / src / mesh / mesh_api.c
index 78451a64c8581c87d7f6a7788ac5bdd8bcf09f5f..869765153bcb192e2663b6826565097fd5dd17ab 100644 (file)
@@ -653,7 +653,7 @@ timeout_transmission (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 
 
 /**
- * Add a transmit handle to the transmission queue by priority and set the
+ * Add a transmit handle to the transmission queue and set the
  * timeout if needed.
  *
  * @param h mesh handle with the queue head and tail
@@ -663,16 +663,7 @@ static void
 add_to_queue (struct GNUNET_MESH_Handle *h,
               struct GNUNET_MESH_TransmitHandle *th)
 {
-  struct GNUNET_MESH_TransmitHandle *p;
-
-  p = h->th_head;
-  while ((NULL != p))
-    p = p->next;
-  if (NULL == p)
-    p = h->th_tail;
-  else
-    p = p->prev;
-  GNUNET_CONTAINER_DLL_insert_after (h->th_head, h->th_tail, p, th);
+  GNUNET_CONTAINER_DLL_insert_tail (h->th_head, h->th_tail, th);
   if (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value == th->timeout.abs_value)
     return;
   th->timeout_task =
@@ -1163,6 +1154,7 @@ process_incoming_data (struct GNUNET_MESH_Handle *h,
   }
   t->last_recv_pid = pid;
   type = ntohs (payload->type);
+  send_ack (h, t);
   for (i = 0; i < h->n_handlers; i++)
   {
     handler = &h->message_handlers[i];
@@ -1183,7 +1175,6 @@ process_incoming_data (struct GNUNET_MESH_Handle *h,
       {
         LOG (GNUNET_ERROR_TYPE_DEBUG,
              "callback completed successfully\n");
-        send_ack (h, t);
       }
     }
   }
@@ -1372,6 +1363,7 @@ send_callback (void *cls, size_t size, void *buf)
           to.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN);
           to.tid = htonl (t->tid);
           to.pid = htonl (t->next_send_pid);
+          to.ttl = 0;
           memset (&to.oid, 0, sizeof (struct GNUNET_PeerIdentity));
           memset (&to.sender, 0, sizeof (struct GNUNET_PeerIdentity));
           memcpy (cbuf, &to, sizeof (to));