checking quotas
authorMatthias Wachs <wachs@net.in.tum.de>
Wed, 9 Nov 2011 20:37:11 +0000 (20:37 +0000)
committerMatthias Wachs <wachs@net.in.tum.de>
Wed, 9 Nov 2011 20:37:11 +0000 (20:37 +0000)
src/ats/gnunet-service-ats_scheduling.c
src/transport/gnunet-service-transport_neighbours.c

index d289ae59450bf2ebe9c47478fb8dc3e5af7efe76..493ff840f097a4802f6b4e0c1d645d45cd3c8e81 100644 (file)
@@ -141,6 +141,10 @@ GAS_scheduling_transmit_address_suggestion (const struct GNUNET_PeerIdentity
   addrp = (char *) &atsp[atsi_count];
   memcpy (addrp, plugin_addr, plugin_addr_len);
   strcpy (&addrp[plugin_addr_len], plugin_name);
+
+  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "ATS sends quota for peer `%s': (in/out) %u/%u\n",
+      GNUNET_i2s (peer), ntohl (bandwidth_in.value__), ntohl(bandwidth_out.value__));
+
   GNUNET_SERVER_notification_context_unicast (nc, my_client, &msg->header,
                                               GNUNET_YES);
 }
index 31dd077911c5e714e0cf7fd02370bc9fd64c81fe..629cecefab949ef73ef5c97b08e56e743e8f814e 100644 (file)
@@ -1249,18 +1249,18 @@ GST_neighbours_switch_to_address_3way (const struct GNUNET_PeerIdentity *peer,
        (n->session == session) )
   {
     struct QuotaSetMessage q_msg;
-    
-#if DEBUG_TRANSPORT
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-               "Sending outbound quota of %u Bps and inbound quota of %u Bps for peer `%s' to all clients\n",
-               ntohl (n->bandwidth_out.value__),
-               ntohl (n->bandwidth_in.value__), GNUNET_i2s (peer));
-#endif
-    
+
     n->bandwidth_in = bandwidth_in;
     n->bandwidth_out = bandwidth_out;
     GST_neighbours_set_incoming_quota (&n->id, n->bandwidth_in);
     
+#if DEBUG_TRANSPORT
+#endif
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Sending outbound quota of %u Bps and inbound quota of %u Bps for peer `%s' to all clients\n",
+                ntohl (n->bandwidth_out.value__),
+                ntohl (n->bandwidth_in.value__), GNUNET_i2s (peer));
+    
     q_msg.header.size = htons (sizeof (struct QuotaSetMessage));
     q_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA);
     q_msg.quota = n->bandwidth_out;
@@ -1794,6 +1794,10 @@ GST_neighbours_set_incoming_quota (const struct GNUNET_PeerIdentity *neighbour,
                               1, GNUNET_NO);
     return;
   }
+  GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+              "Setting inbound quota of %u Bps for peer `%s' to all clients\n",
+              ntohl (quota.value__), GNUNET_i2s (&n->id));
+
   GNUNET_BANDWIDTH_tracker_update_quota (&n->in_tracker, quota);
   if (0 != ntohl (quota.value__))
     return;
@@ -2043,11 +2047,7 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message,
                                  n->session,
                                  GNUNET_YES);
   GNUNET_ATS_address_in_use (GST_ats, n->address, n->session, GNUNET_YES);
-#if DEBUG_TRANSPORT
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Setting inbound quota of %u for peer `%s' to \n",
-              ntohl (n->bandwidth_in.value__), GNUNET_i2s (&n->id));
-#endif
+
   GST_neighbours_set_incoming_quota (&n->id, n->bandwidth_in);
 
   /* send ACK (ACK) */
@@ -2086,10 +2086,11 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message,
   connect_notify_cb (callback_cls, &n->id, ats, ats_count);  
 
 #if DEBUG_TRANSPORT
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+#endif
+  GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
               "Sending outbound quota of %u Bps for peer `%s' to all clients\n",
               ntohl (n->bandwidth_out.value__), GNUNET_i2s (peer));
-#endif
+
   q_msg.header.size = htons (sizeof (struct QuotaSetMessage));
   q_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA);
   q_msg.quota = n->bandwidth_out;
@@ -2170,10 +2171,11 @@ GST_neighbours_handle_ack (const struct GNUNET_MessageHeader *message,
 #endif
   connect_notify_cb (callback_cls, &n->id, ats, ats_count);  
 #if DEBUG_TRANSPORT
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+#endif
+  GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
               "Sending outbound quota of %u Bps for peer `%s' to all clients\n",
               ntohl (n->bandwidth_out.value__), GNUNET_i2s (peer));
-#endif
+
   q_msg.header.size = htons (sizeof (struct QuotaSetMessage));
   q_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA);
   q_msg.quota = n->bandwidth_out;