aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-transport.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2011-10-13 13:59:20 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2011-10-13 13:59:20 +0000
commit577b1a0a9146bb2010427f32a1dd0ca8d16f77ad (patch)
tree4d37016a3ef2cb4487efcd3fd347d4179f6192cc /src/transport/gnunet-service-transport.c
parent2e9731ebda48bf2549aed64ca9cdfea5b298f9d7 (diff)
downloadgnunet-577b1a0a9146bb2010427f32a1dd0ca8d16f77ad.tar.gz
gnunet-577b1a0a9146bb2010427f32a1dd0ca8d16f77ad.zip
disconnect on zero bandwidth notification
Diffstat (limited to 'src/transport/gnunet-service-transport.c')
-rw-r--r--src/transport/gnunet-service-transport.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index 4ce6b4321..86e51f580 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -323,8 +323,8 @@ plugin_env_session_end (void *cls, const struct GNUNET_PeerIdentity *peer,
323 * @param session session to use (if available) 323 * @param session session to use (if available)
324 * @param plugin_addr address to use (if available) 324 * @param plugin_addr address to use (if available)
325 * @param plugin_addr_len number of bytes in addr 325 * @param plugin_addr_len number of bytes in addr
326 * @param bandwidth_out assigned outbound bandwidth for the connection 326 * @param bandwidth_out assigned outbound bandwidth for the connection, 0 to disconnect from peer
327 * @param bandwidth_in assigned inbound bandwidth for the connection 327 * @param bandwidth_in assigned inbound bandwidth for the connection, 0 to disconnect from peer
328 */ 328 */
329static void 329static void
330ats_request_address_change (void *cls, const struct GNUNET_PeerIdentity *peer, 330ats_request_address_change (void *cls, const struct GNUNET_PeerIdentity *peer,
@@ -334,9 +334,18 @@ ats_request_address_change (void *cls, const struct GNUNET_PeerIdentity *peer,
334 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, 334 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
335 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in) 335 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
336{ 336{
337 uint32_t bw_in = ntohl (bandwidth_in.value__);
338 uint32_t bw_out = ntohl (bandwidth_out.value__);
339
340 /* ATS tells me to disconnect from peer*/
341 if ((bw_in == 0) && (bw_out == 0))
342 {
343 GST_neighbours_force_disconnect(peer);
344 return;
345 }
346
337 GST_neighbours_switch_to_address (peer, plugin_name, plugin_addr, 347 GST_neighbours_switch_to_address (peer, plugin_name, plugin_addr,
338 plugin_addr_len, session, NULL, 0); 348 plugin_addr_len, session, NULL, 0);
339 GST_neighbours_set_incoming_quota (peer, bandwidth_in);
340 349
341#if DEBUG_TRANSPORT 350#if DEBUG_TRANSPORT
342 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending outbound quota of %u Bps for peer `%s' to all clients\n", 351 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending outbound quota of %u Bps for peer `%s' to all clients\n",