gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r17444 - gnunet/src/transport
Date: Thu, 13 Oct 2011 15:59:20 +0200

Author: wachs
Date: 2011-10-13 15:59:20 +0200 (Thu, 13 Oct 2011)
New Revision: 17444

Modified:
   gnunet/src/transport/gnunet-service-transport.c
Log:
disconnect on zero bandwidth notification


Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c     2011-10-13 13:44:18 UTC 
(rev 17443)
+++ gnunet/src/transport/gnunet-service-transport.c     2011-10-13 13:59:20 UTC 
(rev 17444)
@@ -323,8 +323,8 @@
  * @param session session to use (if available)
  * @param plugin_addr address to use (if available)
  * @param plugin_addr_len number of bytes in addr
- * @param bandwidth_out assigned outbound bandwidth for the connection
- * @param bandwidth_in assigned inbound bandwidth for the connection
+ * @param bandwidth_out assigned outbound bandwidth for the connection, 0 to 
disconnect from peer
+ * @param bandwidth_in assigned inbound bandwidth for the connection, 0 to 
disconnect from peer
  */
 static void
 ats_request_address_change (void *cls, const struct GNUNET_PeerIdentity *peer,
@@ -334,9 +334,18 @@
                             struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
                             struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
 {
+  uint32_t bw_in = ntohl (bandwidth_in.value__);
+  uint32_t bw_out = ntohl (bandwidth_out.value__);
+
+  /* ATS tells me to disconnect from peer*/
+  if ((bw_in == 0) && (bw_out == 0))
+  {
+    GST_neighbours_force_disconnect(peer);
+    return;
+  }
+
   GST_neighbours_switch_to_address (peer, plugin_name, plugin_addr,
                                     plugin_addr_len, session, NULL, 0);
-  GST_neighbours_set_incoming_quota (peer, bandwidth_in);
 
 #if DEBUG_TRANSPORT
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending outbound quota of %u Bps for 
peer `%s' to all clients\n",




reply via email to

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