gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r17668 - gnunet/src/transport
Date: Sat, 22 Oct 2011 22:23:00 +0200

Author: grothoff
Date: 2011-10-22 22:22:59 +0200 (Sat, 22 Oct 2011)
New Revision: 17668

Modified:
   gnunet/src/transport/gnunet-service-transport.c
   gnunet/src/transport/gnunet-service-transport_neighbours.c
   gnunet/src/transport/gnunet-service-transport_neighbours.h
Log:
fixing 1836

Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c     2011-10-22 20:16:14 UTC 
(rev 17667)
+++ gnunet/src/transport/gnunet-service-transport.c     2011-10-22 20:22:59 UTC 
(rev 17668)
@@ -412,20 +412,30 @@
     GST_neighbours_force_disconnect(peer);
     return;
   }
-
-  GST_neighbours_switch_to_address (peer, plugin_name, plugin_addr,
-                                    plugin_addr_len, session, ats, ats_count);
+  if (GNUNET_YES !=
+      GST_neighbours_switch_to_address (peer, plugin_name, plugin_addr,
+                                       plugin_addr_len, session, ats, 
ats_count))
+  {
 #if DEBUG_TRANSPORT
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+               "Connection is not yet up, ignoring quota for now\n");
+#endif
+    /* FIXME: maybe we should let ATS know somehow?  This is a problem
+       with the design; ATS may assign bandwidth, but we don't use it;
+       the current ATS API doesn't give us a good way to sync the
+       connection status between ATS and TRANSPORT */
+    return;
+  }
+#if DEBUG_TRANSPORT
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 
              "Sending outbound quota of %u Bps for peer `%s' to all clients\n",
-              ntohl (bandwidth_out.value__), GNUNET_i2s (peer));
+             ntohl (bandwidth_out.value__), GNUNET_i2s (peer));
 #endif
   msg.header.size = htons (sizeof (struct QuotaSetMessage));
   msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA);
   msg.quota = bandwidth_out;
   msg.peer = (*peer);
-  GST_clients_broadcast (&msg.header, GNUNET_NO);
-
+  GST_clients_broadcast (&msg.header, GNUNET_NO);  
 #if DEBUG_TRANSPORT
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 
              "Setting inbound quota of %u for peer `%s' to \n",

Modified: gnunet/src/transport/gnunet-service-transport_neighbours.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_neighbours.c  2011-10-22 
20:16:14 UTC (rev 17667)
+++ gnunet/src/transport/gnunet-service-transport_neighbours.c  2011-10-22 
20:22:59 UTC (rev 17668)
@@ -666,8 +666,10 @@
  * @param session session to use (or NULL)
  * @param ats performance data
  * @param ats_count number of entries in ats (excluding 0-termination)
+ * @return GNUNET_YES if we are currently connected, GNUNET_NO if the
+ *         connection is not up (yet)
  */
-void
+int
 GST_neighbours_switch_to_address (const struct GNUNET_PeerIdentity *peer,
                                   const char *plugin_name, const void *address,
                                   size_t address_len, struct Session *session,
@@ -687,7 +689,7 @@
                                    peer,
                                    plugin_name, address,
                                    address_len, NULL);    
-    return;
+    return GNUNET_NO;
   }
   was_connected = n->is_connected;
   n->is_connected = GNUNET_YES;
@@ -727,12 +729,13 @@
                       &send_connect_continuation, 
                       n);
   if (GNUNET_YES == was_connected)
-    return;
+    return GNUNET_YES;
   /* First tell clients about connected neighbours...*/
   neighbours_connected++;
   GNUNET_STATISTICS_update (GST_stats, gettext_noop ("# peers connected"), 1,
                             GNUNET_NO);
   connect_notify_cb (callback_cls, peer, ats, ats_count);
+  return GNUNET_YES;
 }
 
 

Modified: gnunet/src/transport/gnunet-service-transport_neighbours.h
===================================================================
--- gnunet/src/transport/gnunet-service-transport_neighbours.h  2011-10-22 
20:16:14 UTC (rev 17667)
+++ gnunet/src/transport/gnunet-service-transport_neighbours.h  2011-10-22 
20:22:59 UTC (rev 17668)
@@ -200,8 +200,10 @@
  * @param session session to use (or NULL)
  * @param ats performance data
  * @param ats_count number of entries in ats (excluding 0-termination)
+ * @return GNUNET_YES if we are currently connected, GNUNET_NO if the
+ *         connection is not up (yet)
  */
-void
+int
 GST_neighbours_switch_to_address (const struct GNUNET_PeerIdentity *peer,
                                   const char *plugin_name, const void *address,
                                   size_t address_len, struct Session *session,




reply via email to

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