gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r22916 - in gnunet/src: dns exit include mesh pt stream vpn


From: gnunet
Subject: [GNUnet-SVN] r22916 - in gnunet/src: dns exit include mesh pt stream vpn
Date: Wed, 25 Jul 2012 17:31:07 +0200

Author: bartpolot
Date: 2012-07-25 17:31:07 +0200 (Wed, 25 Jul 2012)
New Revision: 22916

Modified:
   gnunet/src/dns/gnunet-service-dns.c
   gnunet/src/exit/gnunet-daemon-exit.c
   gnunet/src/include/gnunet_mesh_service.h
   gnunet/src/mesh/mesh_api.c
   gnunet/src/pt/gnunet-daemon-pt.c
   gnunet/src/stream/stream_api.c
   gnunet/src/vpn/gnunet-service-vpn.c
Log:
Eliminate mesh priority option

Modified: gnunet/src/dns/gnunet-service-dns.c
===================================================================
--- gnunet/src/dns/gnunet-service-dns.c 2012-07-25 15:15:19 UTC (rev 22915)
+++ gnunet/src/dns/gnunet-service-dns.c 2012-07-25 15:31:07 UTC (rev 22916)
@@ -1027,7 +1027,7 @@
       if (ts->th != NULL)
        GNUNET_MESH_notify_transmit_ready_cancel (ts->th);
       ts->th = GNUNET_MESH_notify_transmit_ready (ts->tunnel,
-                                                 GNUNET_NO, 0,
+                                                 GNUNET_NO,
                                                  GNUNET_TIME_UNIT_FOREVER_REL,
                                                  NULL,
                                                  sizeof (struct 
GNUNET_MessageHeader) + r,

Modified: gnunet/src/exit/gnunet-daemon-exit.c
===================================================================
--- gnunet/src/exit/gnunet-daemon-exit.c        2012-07-25 15:15:19 UTC (rev 
22915)
+++ gnunet/src/exit/gnunet-daemon-exit.c        2012-07-25 15:31:07 UTC (rev 
22916)
@@ -535,7 +535,6 @@
   {
     s->th = GNUNET_MESH_notify_transmit_ready (tunnel, 
                                               GNUNET_NO /* corking */, 
-                                              0 /* priority */,
                                               GNUNET_TIME_UNIT_FOREVER_REL,
                                               NULL,
                                               tnq->len,
@@ -553,7 +552,6 @@
   if (NULL != (tnq = s->head))
     s->th = GNUNET_MESH_notify_transmit_ready (tunnel, 
                                               GNUNET_NO /* corking */, 
-                                              0 /* priority */,
                                               GNUNET_TIME_UNIT_FOREVER_REL,
                                               NULL,
                                               tnq->len,
@@ -582,7 +580,8 @@
   GNUNET_assert (NULL != s);
   GNUNET_CONTAINER_DLL_insert_tail (s->head, s->tail, tnq);
   if (NULL == s->th)
-    s->th = GNUNET_MESH_notify_transmit_ready (mesh_tunnel, GNUNET_NO /* cork 
*/, 0 /* priority */,
+    s->th = GNUNET_MESH_notify_transmit_ready (mesh_tunnel,
+                                               GNUNET_NO /* cork */,
                                               GNUNET_TIME_UNIT_FOREVER_REL,
                                               NULL, tnq->len,
                                               &send_to_peer_notify_callback,

Modified: gnunet/src/include/gnunet_mesh_service.h
===================================================================
--- gnunet/src/include/gnunet_mesh_service.h    2012-07-25 15:15:19 UTC (rev 
22915)
+++ gnunet/src/include/gnunet_mesh_service.h    2012-07-25 15:31:07 UTC (rev 
22916)
@@ -377,10 +377,11 @@
 /**
  * Ask the mesh to call "notify" once it is ready to transmit the
  * given number of bytes to the specified tunnel or target.
+ * Only one call can be active at any time, to issue another request,
+ * wait for the callback or cancel the current request.
  *
  * @param tunnel tunnel to use for transmission
  * @param cork is corking allowed for this transmission?
- * @param priority how important is the message?
  * @param maxdelay how long can the message wait?
  * @param target destination for the message
  *               NULL for multicast to all tunnel targets
@@ -396,7 +397,6 @@
  */
 struct GNUNET_MESH_TransmitHandle *
 GNUNET_MESH_notify_transmit_ready (struct GNUNET_MESH_Tunnel *tunnel, int cork,
-                                   uint32_t priority,
                                    struct GNUNET_TIME_Relative maxdelay,
                                    const struct GNUNET_PeerIdentity *target,
                                    size_t notify_size,

Modified: gnunet/src/mesh/mesh_api.c
===================================================================
--- gnunet/src/mesh/mesh_api.c  2012-07-25 15:15:19 UTC (rev 22915)
+++ gnunet/src/mesh/mesh_api.c  2012-07-25 15:31:07 UTC (rev 22916)
@@ -103,12 +103,6 @@
   GNUNET_SCHEDULER_TaskIdentifier timeout_task;
 
     /**
-     * Priority of the message.  The queue is sorted by priority,
-     * control messages have the maximum priority (UINT32_MAX).
-     */
-  uint32_t priority;
-
-    /**
      * Target of the message, 0 for multicast.  This field
      * is only valid if 'notify' is non-NULL.
      */
@@ -146,9 +140,13 @@
   const GNUNET_MESH_ApplicationType *applications;
 
     /**
-     * Double linked list of the tunnels this client is connected to.
+     * Double linked list of the tunnels this client is connected to, head.
      */
   struct GNUNET_MESH_Tunnel *tunnels_head;
+
+    /**
+     * Double linked list of the tunnels this client is connected to, tail.
+     */
   struct GNUNET_MESH_Tunnel *tunnels_tail;
 
     /**
@@ -172,18 +170,29 @@
   void *cls;
 
     /**
-     * Messages to send to the service
+     * Messages to send to the service, head.
      */
   struct GNUNET_MESH_TransmitHandle *th_head;
+
+    /**
+     * Messages to send to the service, tail.
+     */
   struct GNUNET_MESH_TransmitHandle *th_tail;
 
     /**
      * tid of the next tunnel to create (to avoid reusing IDs often)
      */
   MESH_TunnelNumber next_tid;
+
+    /**
+     * Number of handlers in the handlers array.
+     */
   unsigned int n_handlers;
+
+    /**
+     * Number of applications in the applications array.
+     */
   unsigned int n_applications;
-  unsigned int max_queue_size;
 
     /**
      * Have we started the task to receive messages from the service
@@ -191,11 +200,6 @@
      */
   int in_receive;
 
-    /**
-     * Number of packets queued
-     */
-  unsigned int npackets;
-
   /**
    * Configuration given by the client, in case of reconnection
    */
@@ -587,7 +591,7 @@
   struct GNUNET_MESH_TransmitHandle *p;
 
   p = h->th_head;
-  while ((NULL != p) && (th->priority <= p->priority))
+  while ((NULL != p))
     p = p->next;
   if (NULL == p)
     p = h->th_tail;
@@ -1253,7 +1257,6 @@
       GNUNET_SCHEDULER_cancel (th->timeout_task);
     if (NULL != th->notify)
     {
-      th->tunnel->mesh->npackets--;
       th->tunnel->npackets--;
     }
     GNUNET_CONTAINER_DLL_remove (h->th_head, h->th_tail, th);
@@ -1302,7 +1305,6 @@
 
   msize = ntohs (msg->size);
   th = GNUNET_malloc (sizeof (struct GNUNET_MESH_TransmitHandle) + msize);
-  th->priority = UINT32_MAX;
   th->timeout = GNUNET_TIME_UNIT_FOREVER_ABS;
   th->size = msize;
   th->tunnel = tunnel;
@@ -1413,7 +1415,6 @@
     /* Make sure it is an allowed packet (everything else should have been
      * already canceled).
      */
-    GNUNET_break (UINT32_MAX == th->priority);
     GNUNET_break (NULL == th->notify);
     msg = (struct GNUNET_MessageHeader *) &th[1];
     switch (ntohs(msg->type))
@@ -1825,15 +1826,14 @@
 
 /**
  * Ask the mesh to call "notify" once it is ready to transmit the
- * given number of bytes to the specified "target".  If we are not yet
- * connected to the specified peer, a call to this function will cause
- * us to try to establish a connection.
+ * given number of bytes to the specified tunnel or target.
+ * Only one call can be active at any time, to issue another request,
+ * wait for the callback or cancel the current request.
  *
  * @param tunnel tunnel to use for transmission
  * @param cork is corking allowed for this transmission?
- * @param priority how important is the message?
  * @param maxdelay how long can the message wait?
- * @param target destination for the message,
+ * @param target destination for the message
  *               NULL for multicast to all tunnel targets
  * @param notify_size how many bytes of buffer space does notify want?
  * @param notify function to call when buffer space is available;
@@ -1847,7 +1847,6 @@
  */
 struct GNUNET_MESH_TransmitHandle *
 GNUNET_MESH_notify_transmit_ready (struct GNUNET_MESH_Tunnel *tunnel, int cork,
-                                   uint32_t priority,
                                    struct GNUNET_TIME_Relative maxdelay,
                                    const struct GNUNET_PeerIdentity *target,
                                    size_t notify_size,
@@ -1855,8 +1854,6 @@
                                    void *notify_cls)
 {
   struct GNUNET_MESH_TransmitHandle *th;
-  struct GNUNET_MESH_TransmitHandle *least_priority_th;
-  uint32_t least_priority;
   size_t overhead;
 
   GNUNET_assert (NULL != tunnel);
@@ -1866,42 +1863,10 @@
   else
     LOG (GNUNET_ERROR_TYPE_DEBUG, "    target multicast\n");
   GNUNET_assert (NULL != notify);
-  if (tunnel->mesh->npackets >= tunnel->mesh->max_queue_size &&
-      tunnel->npackets > 0)
-  {
-    /* queue full */
-    if (0 == priority)
-      return NULL;
-    th = tunnel->mesh->th_tail;
-    least_priority = priority;
-    least_priority_th = NULL;
-    while (NULL != th)
-    {
-      if (th->priority < least_priority && th->tunnel->npackets > 1)
-      {
-        least_priority_th = th;
-        least_priority = th->priority;
-      }
-      th = th->prev;
-    }
-    if (NULL == least_priority_th)
-      return NULL;
-    /* Can't be a control message */
-    GNUNET_assert (NULL != least_priority_th->notify);
-    least_priority_th->notify (notify_cls, 0, NULL);
-    least_priority_th->tunnel->npackets--;
-    tunnel->mesh->npackets--;
-    GNUNET_CONTAINER_DLL_remove (tunnel->mesh->th_head, tunnel->mesh->th_tail,
-                                 least_priority_th);
-    if (GNUNET_SCHEDULER_NO_TASK != least_priority_th->timeout_task)
-      GNUNET_SCHEDULER_cancel (least_priority_th->timeout_task);
-    GNUNET_free (least_priority_th);
-  }
+  GNUNET_assert (0 == tunnel->npackets);
   tunnel->npackets++;
-  tunnel->mesh->npackets++;
   th = GNUNET_malloc (sizeof (struct GNUNET_MESH_TransmitHandle));
   th->tunnel = tunnel;
-  th->priority = priority;
   th->timeout = GNUNET_TIME_relative_to_absolute (maxdelay);
   th->target = GNUNET_PEER_intern (target);
   if (tunnel->tid >= GNUNET_MESH_LOCAL_TUNNEL_ID_SERV)

Modified: gnunet/src/pt/gnunet-daemon-pt.c
===================================================================
--- gnunet/src/pt/gnunet-daemon-pt.c    2012-07-25 15:15:19 UTC (rev 22915)
+++ gnunet/src/pt/gnunet-daemon-pt.c    2012-07-25 15:31:07 UTC (rev 22916)
@@ -550,7 +550,7 @@
   if (mlen > size)
   {    
     mesh_th = GNUNET_MESH_notify_transmit_ready (mesh_tunnel,
-                                                GNUNET_NO, 0,
+                                                GNUNET_NO,
                                                 TIMEOUT,
                                                 NULL, mlen,
                                                 &transmit_dns_request_to_mesh,
@@ -569,7 +569,7 @@
   rc = transmit_queue_head;
   if (NULL != rc)
     mesh_th = GNUNET_MESH_notify_transmit_ready (mesh_tunnel,
-                                                GNUNET_NO, 0,
+                                                GNUNET_NO,
                                                 TIMEOUT,
                                                 NULL, ntohs 
(rc->mesh_message->size),
                                                 &transmit_dns_request_to_mesh,
@@ -668,7 +668,7 @@
                                    rc);
   if (NULL == mesh_th)
     mesh_th = GNUNET_MESH_notify_transmit_ready (mesh_tunnel,
-                                                GNUNET_NO, 0,
+                                                GNUNET_NO,
                                                 TIMEOUT,
                                                 NULL, mlen,
                                                 &transmit_dns_request_to_mesh,

Modified: gnunet/src/stream/stream_api.c
===================================================================
--- gnunet/src/stream/stream_api.c      2012-07-25 15:15:19 UTC (rev 22915)
+++ gnunet/src/stream/stream_api.c      2012-07-25 15:31:07 UTC (rev 22916)
@@ -583,8 +583,7 @@
          socket->retries);
     socket->transmit_handle = 
       GNUNET_MESH_notify_transmit_ready (socket->tunnel,
-                                         0, /* Corking */
-                                         1, /* Priority */
+                                         GNUNET_NO, /* Corking */
                                          /* FIXME: exponential backoff */
                                          socket->retransmit_timeout,
                                          &socket->other_peer,
@@ -611,8 +610,7 @@
     socket->retries = 0;
     socket->transmit_handle = 
       GNUNET_MESH_notify_transmit_ready (socket->tunnel,
-                                         0, /* Corking */
-                                         1, /* Priority */
+                                         GNUNET_NO, /* Corking */
                                          /* FIXME: exponential backoff */
                                          socket->retransmit_timeout,
                                          &socket->other_peer,
@@ -662,8 +660,7 @@
     socket->retries = 0;
     socket->transmit_handle = 
       GNUNET_MESH_notify_transmit_ready (socket->tunnel,
-                                        0, /* Corking */
-                                        1, /* Priority */
+                                        GNUNET_NO, /* Corking */
                                         socket->retransmit_timeout,
                                         &socket->other_peer,
                                         ntohs (message->header.size),
@@ -792,8 +789,7 @@
   /* Request MESH for sending ACK */
   socket->ack_transmit_handle = 
     GNUNET_MESH_notify_transmit_ready (socket->tunnel,
-                                       0, /* Corking */
-                                       1, /* Priority */
+                                       GNUNET_NO, /* Corking */
                                        socket->retransmit_timeout,
                                        &socket->other_peer,
                                        ntohs (ack_msg->header.header.size),

Modified: gnunet/src/vpn/gnunet-service-vpn.c
===================================================================
--- gnunet/src/vpn/gnunet-service-vpn.c 2012-07-25 15:15:19 UTC (rev 22915)
+++ gnunet/src/vpn/gnunet-service-vpn.c 2012-07-25 15:31:07 UTC (rev 22916)
@@ -689,7 +689,6 @@
   if (NULL != (tnq = ts->tmq_head))
     ts->th = GNUNET_MESH_notify_transmit_ready (ts->tunnel, 
                                                GNUNET_NO /* cork */, 
-                                               42 /* priority */,
                                                GNUNET_TIME_UNIT_FOREVER_REL,
                                                NULL, 
                                                tnq->len,
@@ -742,7 +741,6 @@
   if (NULL == ts->th)
     ts->th = GNUNET_MESH_notify_transmit_ready (ts->tunnel, 
                                                GNUNET_NO /* cork */,
-                                               42 /* priority */,
                                                GNUNET_TIME_UNIT_FOREVER_REL,
                                                NULL, 
                                                tnq->len,




reply via email to

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