* @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,
const void *plugin_addr, size_t plugin_addr_len,
struct Session *session,
struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
- struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
+ struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
+ const struct GNUNET_TRANSPORT_ATS_Information * ats,
+ uint32_t ats_count)
{
+ 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);
+ plugin_addr_len, session, ats, ats_count);
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending outbound quota of %u Bps for peer `%s' to all clients\n",