gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r22381 - gnunet/src/transport
Date: Fri, 29 Jun 2012 15:30:43 +0200

Author: wachs
Date: 2012-06-29 15:30:43 +0200 (Fri, 29 Jun 2012)
New Revision: 22381

Modified:
   gnunet/src/transport/plugin_transport_udp.c
   gnunet/src/transport/transport.conf.in
Log:
improved error messages when no network connectivity and fancy interval time

Modified: gnunet/src/transport/plugin_transport_udp.c
===================================================================
--- gnunet/src/transport/plugin_transport_udp.c 2012-06-29 12:46:11 UTC (rev 
22380)
+++ gnunet/src/transport/plugin_transport_udp.c 2012-06-29 13:30:43 UTC (rev 
22381)
@@ -1798,6 +1798,7 @@
   size_t slen;
   struct GNUNET_TIME_Absolute max;
   struct UDPMessageWrapper *udpw = NULL;
+  static int network_down_error;
 
   if (sock == plugin->sockv4)
   {
@@ -1889,24 +1890,39 @@
     const struct GNUNET_ATS_Information type = plugin->env->get_address_type
         (plugin->env->cls,sa, slen);
 
-    if ((GNUNET_ATS_NET_WAN == type.value) &&
+    if (((GNUNET_ATS_NET_LAN == ntohl(type.value)) || (GNUNET_ATS_NET_WAN == 
ntohl(type.value))) &&
         ((ENETUNREACH == errno) || (ENETDOWN == errno)))
     {
-      /* "Network unreachable" or "Network down" */
-      /*
-       * This indicates that this system is IPv6 enabled, but does not
-       * have a valid global IPv6 address assigned
-       */
-       LOG (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
-           _("UDP could not message to `%s': `%s'. "
+      if ((network_down_error == GNUNET_NO) && (slen == sizeof (struct 
sockaddr_in)))
+      {
+        /* IPv4: "Network unreachable" or "Network down"
+         *
+         * This indicates we do not have connectivity
+         */
+        LOG (GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK,
+            _("UDP could not message to `%s': "
+              "Network seems down, please check your network configuration\n"),
+            GNUNET_a2s (sa, slen));
+      }
+      if ((network_down_error == GNUNET_NO) && (slen == sizeof (struct 
sockaddr_in6)))
+      {
+        /* IPv6: "Network unreachable" or "Network down"
+         *
+         * This indicates that this system is IPv6 enabled, but does not
+         * have a valid global IPv6 address assigned or we do not have
+         * connectivity
+         */
+
+       LOG (GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK,
+           _("UDP could not message to `%s': "
             "Please check your network configuration and disable IPv6 if your "
             "connection does not have a global IPv6 address\n"),
-           GNUNET_a2s (sa, slen),
-           STRERROR (errno));
+          GNUNET_a2s (sa, slen));
+      }
     }
     else
     {
-      LOG (GNUNET_ERROR_TYPE_ERROR,
+      LOG (GNUNET_ERROR_TYPE_WARNING,
          "UDP could not transmit %u-byte message to `%s': `%s'\n",
          (unsigned int) (udpw->msg_size), GNUNET_a2s (sa, slen),
          STRERROR (errno));
@@ -1920,6 +1936,7 @@
          (unsigned int) (udpw->msg_size), GNUNET_a2s (sa, slen), (int) sent,
          (sent < 0) ? STRERROR (errno) : "ok");
     call_continuation(udpw, GNUNET_OK);
+    network_down_error = GNUNET_NO;
   }
 
   if (sock == plugin->sockv4)
@@ -2276,6 +2293,7 @@
   unsigned long long enable_v6;
   char * bind4_address;
   char * bind6_address;
+  char * fancy_interval;
   struct GNUNET_TIME_Relative interval;
   struct sockaddr_in serverAddrv4;
   struct sockaddr_in6 serverAddrv6;
@@ -2364,11 +2382,19 @@
   if (broadcast == GNUNET_SYSERR)
     broadcast = GNUNET_NO;
 
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (env->cfg, 
"transport-udp",
-                                           "BROADCAST_INTERVAL", &interval))
+  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (env->cfg, 
"transport-udp",
+                                           "BROADCAST_INTERVAL", 
&fancy_interval))
   {
     interval = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10);
   }
+  else
+  {
+     if (GNUNET_SYSERR == 
GNUNET_STRINGS_fancy_time_to_relative(fancy_interval, &interval))
+     {
+       interval = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30);
+     }
+     GNUNET_free (fancy_interval);
+  }
 
   /* Maximum datarate */
   if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (env->cfg, 
"transport-udp",

Modified: gnunet/src/transport/transport.conf.in
===================================================================
--- gnunet/src/transport/transport.conf.in      2012-06-29 12:46:11 UTC (rev 
22380)
+++ gnunet/src/transport/transport.conf.in      2012-06-29 13:30:43 UTC (rev 
22381)
@@ -47,7 +47,7 @@
 [transport-udp]
 PORT = 2086
 BROADCAST = YES
-BROADCAST_INTERVAL = 30000
+BROADCAST_INTERVAL = 30 s
 MAX_BPS = 1000000
 
 [transport-http]




reply via email to

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