diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2014-04-15 15:31:15 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2014-04-15 15:31:15 +0000 |
commit | b9e53953acedad90fcc54c8245da5a9a29969fc4 (patch) | |
tree | e93f2d27d99df83bb4ab5222ade62cc2b4eaaff5 | |
parent | 350ee7805052599b95a50927a3fae5b03eb2293b (diff) | |
download | gnunet-b9e53953acedad90fcc54c8245da5a9a29969fc4.tar.gz gnunet-b9e53953acedad90fcc54c8245da5a9a29969fc4.zip |
stop pg generation on address deletion
-rw-r--r-- | src/ats/gnunet-ats-solver-eval.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/ats/gnunet-ats-solver-eval.c b/src/ats/gnunet-ats-solver-eval.c index e0b0724ea..e2862158b 100644 --- a/src/ats/gnunet-ats-solver-eval.c +++ b/src/ats/gnunet-ats-solver-eval.c | |||
@@ -721,13 +721,15 @@ set_pref_task (void *cls, | |||
721 | } | 721 | } |
722 | 722 | ||
723 | static struct PreferenceGenerator * | 723 | static struct PreferenceGenerator * |
724 | find_pref_gen (unsigned int peer, unsigned int address, | 724 | find_pref_gen (unsigned int peer, enum GNUNET_ATS_PreferenceKind kind) |
725 | enum GNUNET_ATS_PreferenceKind kind) | ||
726 | { | 725 | { |
727 | struct PreferenceGenerator *cur; | 726 | struct PreferenceGenerator *cur; |
728 | for (cur = pref_gen_head; NULL != cur; cur = cur->next) | 727 | for (cur = pref_gen_head; NULL != cur; cur = cur->next) |
729 | if ((cur->peer == peer) && (cur->kind == kind)) | 728 | if (cur->peer == peer) |
730 | return cur; | 729 | { |
730 | if ((cur->kind == kind) || (GNUNET_ATS_PREFERENCE_END == kind)) | ||
731 | return cur; | ||
732 | } | ||
731 | return NULL; | 733 | return NULL; |
732 | } | 734 | } |
733 | 735 | ||
@@ -1844,6 +1846,7 @@ enforce_del_address (struct GNUNET_ATS_TEST_Operation *op) | |||
1844 | struct TestPeer *p; | 1846 | struct TestPeer *p; |
1845 | struct TestAddress *a; | 1847 | struct TestAddress *a; |
1846 | struct AddressLookupCtx ctx; | 1848 | struct AddressLookupCtx ctx; |
1849 | struct PropertyGenerator *pg; | ||
1847 | 1850 | ||
1848 | if (NULL == (p = find_peer_by_id (op->peer_id))) | 1851 | if (NULL == (p = find_peer_by_id (op->peer_id))) |
1849 | { | 1852 | { |
@@ -1874,6 +1877,11 @@ enforce_del_address (struct GNUNET_ATS_TEST_Operation *op) | |||
1874 | return; | 1877 | return; |
1875 | } | 1878 | } |
1876 | 1879 | ||
1880 | while (NULL != (pg = find_prop_gen (p->id, a->aid, 0))) | ||
1881 | { | ||
1882 | GNUNET_ATS_solver_generate_property_stop (pg); | ||
1883 | } | ||
1884 | |||
1877 | GNUNET_CONTAINER_DLL_remove(p->addr_head, p->addr_tail, a); | 1885 | GNUNET_CONTAINER_DLL_remove(p->addr_head, p->addr_tail, a); |
1878 | GNUNET_free (a); | 1886 | GNUNET_free (a); |
1879 | 1887 | ||
@@ -1940,7 +1948,7 @@ static void | |||
1940 | enforce_start_preference (struct GNUNET_ATS_TEST_Operation *op) | 1948 | enforce_start_preference (struct GNUNET_ATS_TEST_Operation *op) |
1941 | { | 1949 | { |
1942 | struct PreferenceGenerator *pg; | 1950 | struct PreferenceGenerator *pg; |
1943 | if (NULL != (pg = find_pref_gen (op->peer_id, op->address_id, op->pref_type))) | 1951 | if (NULL != (pg = find_pref_gen (op->peer_id, op->pref_type))) |
1944 | { | 1952 | { |
1945 | GNUNET_ATS_solver_generate_preferences_stop (pg); | 1953 | GNUNET_ATS_solver_generate_preferences_stop (pg); |
1946 | GNUNET_free (pg); | 1954 | GNUNET_free (pg); |
@@ -1968,7 +1976,7 @@ enforce_start_preference (struct GNUNET_ATS_TEST_Operation *op) | |||
1968 | static void | 1976 | static void |
1969 | enforce_stop_preference (struct GNUNET_ATS_TEST_Operation *op) | 1977 | enforce_stop_preference (struct GNUNET_ATS_TEST_Operation *op) |
1970 | { | 1978 | { |
1971 | struct PreferenceGenerator *pg = find_pref_gen(op->peer_id, op->address_id, | 1979 | struct PreferenceGenerator *pg = find_pref_gen(op->peer_id, |
1972 | op->pref_type); | 1980 | op->pref_type); |
1973 | if (NULL != pg) | 1981 | if (NULL != pg) |
1974 | GNUNET_ATS_solver_generate_preferences_stop (pg); | 1982 | GNUNET_ATS_solver_generate_preferences_stop (pg); |