gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r36590 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r36590 - gnunet/src/transport
Date: Mon, 26 Oct 2015 19:07:38 +0100

Author: grothoff
Date: 2015-10-26 19:07:37 +0100 (Mon, 26 Oct 2015)
New Revision: 36590

Modified:
   gnunet/src/transport/plugin_transport_udp.c
   gnunet/src/transport/test_transport_api_reliability.c
   gnunet/src/transport/transport_api.c
Log:
-fix udp transmission, avoid scheduling when unready

Modified: gnunet/src/transport/plugin_transport_udp.c
===================================================================
--- gnunet/src/transport/plugin_transport_udp.c 2015-10-26 17:15:58 UTC (rev 
36589)
+++ gnunet/src/transport/plugin_transport_udp.c 2015-10-26 18:07:37 UTC (rev 
36590)
@@ -1825,6 +1825,10 @@
   GNUNET_assert (NULL != udpw->frag_ctx);
   if (GNUNET_OK == result)
   {
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Fragment of message with %u bytes transmitted to %s\n",
+                (unsigned int) udpw->payload_size,
+                GNUNET_i2s (&udpw->session->target));
     GNUNET_FRAGMENT_context_transmission_done (udpw->frag_ctx->frag);
     GNUNET_STATISTICS_update (plugin->env->stats,
                               "# UDP, fragmented msgs, fragments, sent, 
success",
@@ -1837,6 +1841,10 @@
   }
   else
   {
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Failed to transmit fragment of message with %u bytes to %s\n",
+                (unsigned int) udpw->payload_size,
+                GNUNET_i2s (&udpw->session->target));
     fragmented_message_done (udpw->frag_ctx,
                              GNUNET_SYSERR);
     GNUNET_STATISTICS_update (plugin->env->stats,
@@ -1892,6 +1900,10 @@
           msg_len);
   enqueue (plugin,
            udpw);
+  if (session->address->address_length == sizeof (struct IPv4UdpAddress))
+    schedule_select_v4 (plugin);
+  else
+    schedule_select_v6 (plugin);
 }
 
 
@@ -2102,6 +2114,10 @@
                               "# UDP, unfragmented bytes payload queued total",
                               msgbuf_size,
                               GNUNET_NO);
+    if (s->address->address_length == sizeof (struct IPv4UdpAddress))
+      schedule_select_v4 (plugin);
+    else
+      schedule_select_v6 (plugin);
   }
   else
   {
@@ -2167,10 +2183,6 @@
   notify_session_monitor (s->plugin,
                           s,
                           GNUNET_TRANSPORT_SS_UPDATE);
-  if (s->address->address_length == sizeof (struct IPv4UdpAddress))
-    schedule_select_v4 (plugin);
-  else
-    schedule_select_v6 (plugin);
   return udpmlen;
 }
 

Modified: gnunet/src/transport/test_transport_api_reliability.c
===================================================================
--- gnunet/src/transport/test_transport_api_reliability.c       2015-10-26 
17:15:58 UTC (rev 36589)
+++ gnunet/src/transport/test_transport_api_reliability.c       2015-10-26 
18:07:37 UTC (rev 36590)
@@ -393,8 +393,10 @@
 #if VERBOSE
   if (ntohl (hdr->num) % 5 == 0)
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got message %u of size %u\n",
-                ntohl (hdr->num), ntohs (message->size));
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Got message %u of size %u\n",
+                ntohl (hdr->num),
+                ntohs (message->size));
   }
 #endif
   n++;
@@ -505,7 +507,8 @@
 static void
 notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer)
 {
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer `%4s' connected to us (%p)!\n",
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Peer `%4s' connected to us (%p)!\n",
               GNUNET_i2s (peer), cls);
 }
 
@@ -513,7 +516,8 @@
 static void
 notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer)
 {
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer `%4s' disconnected (%p)!\n",
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Peer `%4s' disconnected (%p)!\n",
               GNUNET_i2s (peer), cls);
   if (th != NULL)
     GNUNET_TRANSPORT_notify_transmit_ready_cancel (th);
@@ -522,7 +526,8 @@
 
 
 static void
-sendtask ()
+sendtask (void *cls,
+          const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   start_time = GNUNET_TIME_absolute_get ();
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -533,13 +538,17 @@
                                                NULL);
 }
 
+
 static void
-testing_connect_cb (struct PeerContext *p1, struct PeerContext *p2, void *cls)
+testing_connect_cb (struct PeerContext *p1,
+                    struct PeerContext *p2,
+                    void *cls)
 {
   char *p1_c = GNUNET_strdup (GNUNET_i2s (&p1->id));
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Peers connected: %s <-> %s\n", p1_c,
+              "Peers connected: %s <-> %s\n",
+              p1_c,
               GNUNET_i2s (&p2->id));
   GNUNET_free (p1_c);
 

Modified: gnunet/src/transport/transport_api.c
===================================================================
--- gnunet/src/transport/transport_api.c        2015-10-26 17:15:58 UTC (rev 
36589)
+++ gnunet/src/transport/transport_api.c        2015-10-26 18:07:37 UTC (rev 
36590)
@@ -780,7 +780,7 @@
     if (bytes_physical >= bytes_msg)
     {
       LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "Overhead for %u byte message: %u\n",
+           "Overhead for %u byte message was %u\n",
            bytes_msg,
            bytes_physical - bytes_msg);
       n->traffic_overhead += bytes_physical - bytes_msg;
@@ -799,9 +799,11 @@
       n->th->timeout_task = NULL;
       /* we've been waiting for this (congestion, not quota,
        * caused delayed transmission) */
-      n->hn = GNUNET_CONTAINER_heap_insert (h->ready_heap, n, 0);
-      schedule_transmission (h);
+      n->hn = GNUNET_CONTAINER_heap_insert (h->ready_heap,
+                                            n,
+                                            0);
     }
+    schedule_transmission (h);
     break;
   case GNUNET_MESSAGE_TYPE_TRANSPORT_RECV:
     if (size <
@@ -822,8 +824,10 @@
       break;
     }
     LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Received message of type %u from `%s'.\n",
-         ntohs (imm->type), GNUNET_i2s (&im->peer));
+         "Received message of type %u with %u bytes from `%s'.\n",
+         (unsigned int) ntohs (imm->type),
+         (unsigned int) ntohs (imm->size),
+         GNUNET_i2s (&im->peer));
     n = neighbour_find (h, &im->peer);
     if (NULL == n)
     {
@@ -1102,6 +1106,8 @@
   }
   else
   {
+    if (GNUNET_YES != n->is_ready)
+      return;                   /* service not ready for another one */
     n = GNUNET_CONTAINER_heap_peek (h->ready_heap);
     if (NULL == n)
       return;                   /* no pending messages */
@@ -1148,7 +1154,11 @@
     n->traffic_overhead = 0;
   }
   else
+  {
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+         "No work to be done, not scheduling transmission.\n");
     return;                     /* no work to be done */
+  }
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "Scheduling next transmission to service in %s\n",
        GNUNET_STRINGS_relative_time_to_string (delay,
@@ -1364,8 +1374,7 @@
   if (NULL == buf)
   {
     LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Discarding  `%s' request to `%s' due to error in transport service 
connection.\n",
-         "REQUEST_CONNECT",
+         "Discarding REQUEST_CONNECT request to `%s' due to error in transport 
service connection.\n",
          GNUNET_i2s (&tch->pid));
     if (NULL != tch->cb)
       tch->cb (tch->cb_cls,




reply via email to

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