fixed notification order
[oweals/gnunet.git] / src / transport / gnunet-service-transport_neighbours.c
index e16a71249fa478387a991ba18392c7f2829b001c..0957a0ce17030a6c3f71fbacdd06f00548370bf1 100644 (file)
@@ -737,10 +737,15 @@ try_connect_using_address (void *cls, const struct GNUNET_PeerIdentity *target,
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Setting inbound quota of %u for peer `%s' to \n",
               ntohl (bandwidth_in), GNUNET_i2s (target));
 #endif
+  GST_neighbours_set_incoming_quota (&n->id, bandwidth_in);
 
+  /* 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, target, n->ats, n->ats_count);
 
-  GST_neighbours_set_incoming_quota (&n->id, bandwidth_in);
-  /* ATS told us outbound quota for this peer, tell all clients */
+  /* ... then send outbound quota for this peer to all clients */
 #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), GNUNET_i2s (target));
@@ -753,10 +758,6 @@ try_connect_using_address (void *cls, const struct GNUNET_PeerIdentity *target,
   msg.peer = (*target);
   GST_clients_broadcast ((struct GNUNET_MessageHeader *) &msg, GNUNET_NO);
 
-  neighbours_connected++;
-  GNUNET_STATISTICS_update (GST_stats, gettext_noop ("# peers connected"), 1,
-                            GNUNET_NO);
-  connect_notify_cb (callback_cls, target, n->ats, n->ats_count);
 }