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",
* @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,
peer,
plugin_name, address,
address_len, NULL);
- return;
+ return GNUNET_NO;
}
was_connected = n->is_connected;
n->is_connected = GNUNET_YES;
&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;
}
* @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,