diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-06-19 08:02:12 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-06-19 08:02:12 +0000 |
commit | eb62118a1defb01f9633a8d15a342023b9246732 (patch) | |
tree | 8bc97e53f4311b81c1490ed269715f8e388f4be0 /src/ats | |
parent | eb622a145a0018907ff79d1b332482c7a3ebb8c3 (diff) | |
download | gnunet-eb62118a1defb01f9633a8d15a342023b9246732.tar.gz gnunet-eb62118a1defb01f9633a8d15a342023b9246732.zip |
- cleanup
Diffstat (limited to 'src/ats')
-rw-r--r-- | src/ats/test_ats_api_scheduling.c | 32 | ||||
-rw-r--r-- | src/ats/test_ats_api_scheduling_destroy_address.c | 38 |
2 files changed, 35 insertions, 35 deletions
diff --git a/src/ats/test_ats_api_scheduling.c b/src/ats/test_ats_api_scheduling.c index 6a8e53395..39d53ddd4 100644 --- a/src/ats/test_ats_api_scheduling.c +++ b/src/ats/test_ats_api_scheduling.c | |||
@@ -67,7 +67,7 @@ struct PeerContext | |||
67 | struct Address *addr; | 67 | struct Address *addr; |
68 | }; | 68 | }; |
69 | 69 | ||
70 | struct Address addr[2]; | 70 | struct Address test_addr[2]; |
71 | struct PeerContext p[2]; | 71 | struct PeerContext p[2]; |
72 | struct GNUNET_ATS_Information atsi[2]; | 72 | struct GNUNET_ATS_Information atsi[2]; |
73 | 73 | ||
@@ -127,12 +127,12 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | |||
127 | GNUNET_assert (0 == | 127 | GNUNET_assert (0 == |
128 | memcmp (&address->peer, &p[0].id, | 128 | memcmp (&address->peer, &p[0].id, |
129 | sizeof (struct GNUNET_PeerIdentity))); | 129 | sizeof (struct GNUNET_PeerIdentity))); |
130 | GNUNET_assert (0 == strcmp (address->transport_name, addr[0].plugin)); | 130 | GNUNET_assert (0 == strcmp (address->transport_name, test_addr[0].plugin)); |
131 | GNUNET_assert (address->address_length == addr[0].addr_len); | 131 | GNUNET_assert (address->address_length == test_addr[0].addr_len); |
132 | GNUNET_assert (0 == | 132 | GNUNET_assert (0 == |
133 | memcmp (address->address, addr[0].plugin, | 133 | memcmp (address->address, test_addr[0].plugin, |
134 | address->address_length)); | 134 | address->address_length)); |
135 | GNUNET_assert (addr[0].session == session); | 135 | GNUNET_assert (test_addr[0].session == session); |
136 | 136 | ||
137 | ret = 0; | 137 | ret = 0; |
138 | 138 | ||
@@ -179,26 +179,26 @@ check (void *cls, char *const *args, const char *cfgfile, | |||
179 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created peer `%s'\n", | 179 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created peer `%s'\n", |
180 | GNUNET_i2s (&p[1].id)); | 180 | GNUNET_i2s (&p[1].id)); |
181 | 181 | ||
182 | addr[0].plugin = "test"; | 182 | test_addr[0].plugin = "test"; |
183 | addr[0].session = NULL; | 183 | test_addr[0].session = NULL; |
184 | addr[0].addr = GNUNET_strdup ("test"); | 184 | test_addr[0].addr = GNUNET_strdup ("test"); |
185 | addr[0].addr_len = 4; | 185 | test_addr[0].addr_len = 4; |
186 | 186 | ||
187 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing address creation\n"); | 187 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing address creation\n"); |
188 | 188 | ||
189 | address0.peer = p[0].id; | 189 | address0.peer = p[0].id; |
190 | address0.transport_name = addr[0].plugin; | 190 | address0.transport_name = test_addr[0].plugin; |
191 | address0.address = addr[0].addr; | 191 | address0.address = test_addr[0].addr; |
192 | address0.address_length = addr[0].addr_len; | 192 | address0.address_length = test_addr[0].addr_len; |
193 | GNUNET_ATS_address_add (ats, &address0, addr[0].session, NULL, 0); | 193 | GNUNET_ATS_address_add (ats, &address0, test_addr[0].session, NULL, 0); |
194 | GNUNET_ATS_address_update (ats, &address0, addr[0].session, NULL, 0); | 194 | GNUNET_ATS_address_update (ats, &address0, test_addr[0].session, NULL, 0); |
195 | 195 | ||
196 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing ATS info creation\n"); | 196 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing ATS info creation\n"); |
197 | 197 | ||
198 | atsi[0].type = htonl (GNUNET_ATS_UTILIZATION_UP); | 198 | atsi[0].type = htonl (GNUNET_ATS_UTILIZATION_UP); |
199 | atsi[0].value = htonl (1024); | 199 | atsi[0].value = htonl (1024); |
200 | 200 | ||
201 | GNUNET_ATS_address_update (ats, &address0, addr[0].session, atsi, 1); | 201 | GNUNET_ATS_address_update (ats, &address0, test_addr[0].session, atsi, 1); |
202 | 202 | ||
203 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing ATS info update\n"); | 203 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing ATS info update\n"); |
204 | 204 | ||
@@ -208,7 +208,7 @@ check (void *cls, char *const *args, const char *cfgfile, | |||
208 | atsi[1].type = htonl (GNUNET_ATS_UTILIZATION_DOWN); | 208 | atsi[1].type = htonl (GNUNET_ATS_UTILIZATION_DOWN); |
209 | atsi[1].value = htonl (1024); | 209 | atsi[1].value = htonl (1024); |
210 | 210 | ||
211 | GNUNET_ATS_address_update (ats, &address0, addr[0].session, atsi, 2); | 211 | GNUNET_ATS_address_update (ats, &address0, test_addr[0].session, atsi, 2); |
212 | 212 | ||
213 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Requesting peer `%s'\n", | 213 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Requesting peer `%s'\n", |
214 | GNUNET_i2s (&p[0].id)); | 214 | GNUNET_i2s (&p[0].id)); |
diff --git a/src/ats/test_ats_api_scheduling_destroy_address.c b/src/ats/test_ats_api_scheduling_destroy_address.c index ae2b4727d..9cf6217f8 100644 --- a/src/ats/test_ats_api_scheduling_destroy_address.c +++ b/src/ats/test_ats_api_scheduling_destroy_address.c | |||
@@ -62,10 +62,10 @@ struct PeerContext | |||
62 | struct Address *addr; | 62 | struct Address *addr; |
63 | }; | 63 | }; |
64 | 64 | ||
65 | struct Address addr; | 65 | struct Address test_addr; |
66 | struct PeerContext p; | 66 | struct PeerContext p; |
67 | struct GNUNET_ATS_Information atsi; | 67 | struct GNUNET_ATS_Information atsi; |
68 | struct GNUNET_HELLO_Address address0; | 68 | struct GNUNET_HELLO_Address hello_address; |
69 | 69 | ||
70 | static void | 70 | static void |
71 | stop_arm () | 71 | stop_arm () |
@@ -130,25 +130,25 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | |||
130 | GNUNET_assert (0 == | 130 | GNUNET_assert (0 == |
131 | memcmp (&address->peer, &p.id, | 131 | memcmp (&address->peer, &p.id, |
132 | sizeof (struct GNUNET_PeerIdentity))); | 132 | sizeof (struct GNUNET_PeerIdentity))); |
133 | GNUNET_assert (0 == strcmp (address->transport_name, addr.plugin)); | 133 | GNUNET_assert (0 == strcmp (address->transport_name, test_addr.plugin)); |
134 | GNUNET_assert (address->address_length == addr.addr_len); | 134 | GNUNET_assert (address->address_length == test_addr.addr_len); |
135 | GNUNET_assert (0 == | 135 | GNUNET_assert (0 == |
136 | memcmp (address->address, addr.plugin, | 136 | memcmp (address->address, test_addr.plugin, |
137 | address->address_length)); | 137 | address->address_length)); |
138 | GNUNET_assert (addr.session == session); | 138 | GNUNET_assert (test_addr.session == session); |
139 | 139 | ||
140 | if (0 == stage) | 140 | if (0 == stage) |
141 | { | 141 | { |
142 | /* Delete session */ | 142 | /* Delete session */ |
143 | GNUNET_ATS_address_destroyed (ats, &address0, addr.session); | 143 | GNUNET_ATS_address_destroyed (ats, &hello_address, test_addr.session); |
144 | addr.session = NULL; | 144 | test_addr.session = NULL; |
145 | GNUNET_ATS_suggest_address (ats, &p.id); | 145 | GNUNET_ATS_suggest_address (ats, &p.id); |
146 | } | 146 | } |
147 | if (1 == stage) | 147 | if (1 == stage) |
148 | { | 148 | { |
149 | /* Delete address */ | 149 | /* Delete address */ |
150 | GNUNET_ATS_address_destroyed (ats, &address0, addr.session); | 150 | GNUNET_ATS_address_destroyed (ats, &hello_address, test_addr.session); |
151 | addr.session = NULL; | 151 | test_addr.session = NULL; |
152 | GNUNET_ATS_suggest_address (ats, &p.id); | 152 | GNUNET_ATS_suggest_address (ats, &p.id); |
153 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &end, NULL); | 153 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &end, NULL); |
154 | } | 154 | } |
@@ -188,17 +188,17 @@ check (void *cls, char *const *args, const char *cfgfile, | |||
188 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created peer `%s'\n", | 188 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created peer `%s'\n", |
189 | GNUNET_i2s (&p.id)); | 189 | GNUNET_i2s (&p.id)); |
190 | 190 | ||
191 | addr.plugin = "test"; | 191 | test_addr.plugin = "test"; |
192 | addr.session = &addr; | 192 | test_addr.session = &test_addr; |
193 | addr.addr = GNUNET_strdup ("test"); | 193 | test_addr.addr = GNUNET_strdup ("test"); |
194 | addr.addr_len = 4; | 194 | test_addr.addr_len = 4; |
195 | 195 | ||
196 | /* Adding address with session */ | 196 | /* Adding address with session */ |
197 | address0.peer = p.id; | 197 | hello_address.peer = p.id; |
198 | address0.transport_name = addr.plugin; | 198 | hello_address.transport_name = test_addr.plugin; |
199 | address0.address = addr.addr; | 199 | hello_address.address = test_addr.addr; |
200 | address0.address_length = addr.addr_len; | 200 | hello_address.address_length = test_addr.addr_len; |
201 | GNUNET_ATS_address_add (ats, &address0, addr.session, NULL, 0); | 201 | GNUNET_ATS_address_add (ats, &hello_address, test_addr.session, NULL, 0); |
202 | 202 | ||
203 | GNUNET_ATS_suggest_address (ats, &p.id); | 203 | GNUNET_ATS_suggest_address (ats, &p.id); |
204 | } | 204 | } |