fix
authorChristian Grothoff <christian@grothoff.org>
Mon, 17 Oct 2011 09:45:17 +0000 (09:45 +0000)
committerChristian Grothoff <christian@grothoff.org>
Mon, 17 Oct 2011 09:45:17 +0000 (09:45 +0000)
src/ats/gnunet-service-ats_addresses.c
src/ats/test_ats_api_scheduling.c

index b12a90bd42bcf9ac492aba39908d671eb1bbc197..af4669dbdec1ce35e57d1d00739b73e0da19dc2b 100644 (file)
@@ -268,7 +268,7 @@ GAS_addresses_update (const struct GNUNET_PeerIdentity *peer,
     GNUNET_free (aa);
   }
   for (i=0;i<atsi_count;i++)
-    switch (atsi[i].type)
+    switch (ntohl (atsi[i].type))
     {
     case GNUNET_ATS_UTILIZATION_UP:
       old->atsp_utilization_out.value__ = atsi[i].value;
index 7dfd887fd183ba88631cead3447904a15b5bd825..20185528394cd286434da82deddcb92a410a6569 100644 (file)
@@ -207,18 +207,18 @@ check (void *cls, char *const *args, const char *cfgfile,
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing ATS info creation\n");
 
-  atsi[0].type = htons (1);
-  atsi[0].type = htons (1);
+  atsi[0].type = htonl (GNUNET_ATS_UTILIZATION_UP);
+  atsi[0].value = htonl (1024);
 
   GNUNET_ATS_address_update(ats, &p[0].id, addr[0].plugin, addr[0].addr, addr[0].addr_len, addr[0].session, atsi, 1);
 
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing ATS info merging\n");
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing ATS info update\n");
 
-  atsi[0].type = htons (1);
-  atsi[0].type = htons (2);
+  atsi[0].type = htonl (GNUNET_ATS_UTILIZATION_UP);
+  atsi[0].value = htonl (2048);
 
-  atsi[1].type = htons (2);
-  atsi[1].type = htons (2);
+  atsi[1].type = htonl (GNUNET_ATS_UTILIZATION_DOWN);
+  atsi[1].value = htonl (1024);
 
   GNUNET_ATS_address_update(ats, &p[0].id, addr[0].plugin, addr[0].addr, addr[0].addr_len, addr[0].session, atsi, 2);