X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fats%2Ftest_ats_solver_preferences.c;h=117af470b0ba9be2316e65f9b39bf92a94f859f0;hb=62d484942e7d01314972d25b93aa7b1ba50e3add;hp=0e96dc12976d0a0e361594cb1c1d812860d10190;hpb=5aeb7f512e5946aec63567e81c72d64523b17530;p=oweals%2Fgnunet.git diff --git a/src/ats/test_ats_solver_preferences.c b/src/ats/test_ats_solver_preferences.c index 0e96dc129..117af470b 100644 --- a/src/ats/test_ats_solver_preferences.c +++ b/src/ats/test_ats_solver_preferences.c @@ -83,7 +83,7 @@ static void *test_session; /** * Test ats info */ -struct GNUNET_ATS_Information test_ats_info[2]; +struct GNUNET_ATS_Information test_ats_info[3]; /** * Test ats count @@ -150,22 +150,24 @@ perf_info_cb (void *cls, } static void -address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, - struct Session *session, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, - struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, - const struct GNUNET_ATS_Information *atsi, uint32_t ats_count) +address_suggest_cb (void *cls, + const struct GNUNET_PeerIdentity *peer, + const struct GNUNET_HELLO_Address *address, + struct Session *session, + struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, + struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, + const struct GNUNET_ATS_Information *atsi, + uint32_t ats_count) { int c; double pref_val; - int prefs[GNUNET_ATS_PreferenceCount] = GNUNET_ATS_PreferenceType; - if (NULL == perf_ats) return; for (c = 1; c < GNUNET_ATS_PreferenceCount; c++) { pref_val = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 10); GNUNET_ATS_performance_change_preference (perf_ats, - &test_hello_address.peer, prefs[c], pref_val, + &test_hello_address.peer, GNUNET_ATS_PREFERENCE_LATENCY, pref_val, GNUNET_ATS_PREFERENCE_END); } } @@ -235,7 +237,9 @@ run (void *cls, const struct GNUNET_CONFIGURATION_Handle *mycfg, test_ats_info[0].value = htonl (GNUNET_ATS_NET_WAN); test_ats_info[1].type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE); test_ats_info[1].value = htonl (1); - test_ats_count = 2; + test_ats_info[2].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY); + test_ats_info[2].value = htonl (100); + test_ats_count = 3; /* Adding address without session */ test_session = NULL; @@ -249,7 +253,7 @@ run (void *cls, const struct GNUNET_CONFIGURATION_Handle *mycfg, /* Adding address */ GNUNET_ATS_address_add (sched_ats, &test_hello_address, test_session, test_ats_info, test_ats_count); - GNUNET_ATS_suggest_address(sched_ats, &test_hello_address.peer); + GNUNET_ATS_suggest_address(sched_ats, &test_hello_address.peer, NULL, NULL); } int