diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2012-03-08 14:14:01 +0000 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2012-03-08 14:14:01 +0000 |
commit | 3a60024e089a38aa32fcafece7c257672abf4608 (patch) | |
tree | a3c36e0a87766bd85e450bd1b9c8766965a34710 /src/gns/gnunet-service-gns.c | |
parent | 588b14ec0ec5c59d0dad37dcc0841c1ff0b2942c (diff) | |
download | gnunet-3a60024e089a38aa32fcafece7c257672abf4608.tar.gz gnunet-3a60024e089a38aa32fcafece7c257672abf4608.zip |
-GNS service api change, replaced complicated buggy code
Diffstat (limited to 'src/gns/gnunet-service-gns.c')
-rw-r--r-- | src/gns/gnunet-service-gns.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/gns/gnunet-service-gns.c b/src/gns/gnunet-service-gns.c index 1782e7a01..66a1da224 100644 --- a/src/gns/gnunet-service-gns.c +++ b/src/gns/gnunet-service-gns.c | |||
@@ -255,6 +255,7 @@ static void | |||
255 | free_resolver_handle(struct GNUNET_GNS_ResolverHandle* rh) | 255 | free_resolver_handle(struct GNUNET_GNS_ResolverHandle* rh) |
256 | { | 256 | { |
257 | struct AuthorityChain *ac; | 257 | struct AuthorityChain *ac; |
258 | struct AuthorityChain *ac_next; | ||
258 | 259 | ||
259 | if (NULL == rh) | 260 | if (NULL == rh) |
260 | return; | 261 | return; |
@@ -264,10 +265,12 @@ free_resolver_handle(struct GNUNET_GNS_ResolverHandle* rh) | |||
264 | 265 | ||
265 | ac = rh->authority_chain_head; | 266 | ac = rh->authority_chain_head; |
266 | 267 | ||
267 | for (; NULL != ac; ac = ac->next) | 268 | while (NULL != ac) |
268 | { | 269 | { |
270 | ac_next = ac->next; | ||
269 | GNUNET_free_non_null (ac->name); | 271 | GNUNET_free_non_null (ac->name); |
270 | GNUNET_free(ac); | 272 | GNUNET_free(ac); |
273 | ac = ac_next; | ||
271 | } | 274 | } |
272 | GNUNET_free(rh); | 275 | GNUNET_free(rh); |
273 | } | 276 | } |
@@ -398,7 +401,8 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
398 | /* Kill zone task for it may make the scheduler hang */ | 401 | /* Kill zone task for it may make the scheduler hang */ |
399 | if (zone_update_taskid) | 402 | if (zone_update_taskid) |
400 | GNUNET_SCHEDULER_cancel(zone_update_taskid); | 403 | GNUNET_SCHEDULER_cancel(zone_update_taskid); |
401 | 404 | ||
405 | GNUNET_SERVER_notification_context_destroy (nc); | ||
402 | GNUNET_DNS_disconnect(dns_handle); | 406 | GNUNET_DNS_disconnect(dns_handle); |
403 | GNUNET_NAMESTORE_disconnect(namestore_handle, 1); | 407 | GNUNET_NAMESTORE_disconnect(namestore_handle, 1); |
404 | GNUNET_DHT_disconnect(dht_handle); | 408 | GNUNET_DHT_disconnect(dht_handle); |
@@ -1468,6 +1472,8 @@ handle_dns_request(void *cls, | |||
1468 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1472 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1469 | "No Queries in DNS packet... forwarding\n"); | 1473 | "No Queries in DNS packet... forwarding\n"); |
1470 | GNUNET_DNS_request_forward (rh); | 1474 | GNUNET_DNS_request_forward (rh); |
1475 | GNUNET_DNSPARSER_free_packet(p); | ||
1476 | return; | ||
1471 | } | 1477 | } |
1472 | 1478 | ||
1473 | if (p->num_queries > 1) | 1479 | if (p->num_queries > 1) |
@@ -1784,7 +1790,7 @@ handle_shorten_zone_to_name(void *cls, | |||
1784 | "Sending shorten result %s\n", result); | 1790 | "Sending shorten result %s\n", result); |
1785 | 1791 | ||
1786 | send_shorten_response(result, csh); | 1792 | send_shorten_response(result, csh); |
1787 | 1793 | free_resolver_handle(rh); | |
1788 | GNUNET_free(result); | 1794 | GNUNET_free(result); |
1789 | } | 1795 | } |
1790 | else | 1796 | else |
@@ -1854,7 +1860,7 @@ handle_shorten_pseu_dht_result(void* cls, | |||
1854 | "Sending pseudonym shorten result %s\n", result); | 1860 | "Sending pseudonym shorten result %s\n", result); |
1855 | 1861 | ||
1856 | send_shorten_response(result, csh); | 1862 | send_shorten_response(result, csh); |
1857 | 1863 | free_resolver_handle(rh); | |
1858 | GNUNET_free(result); | 1864 | GNUNET_free(result); |
1859 | return; | 1865 | return; |
1860 | } | 1866 | } |
@@ -1885,6 +1891,7 @@ handle_shorten_pseu_dht_result(void* cls, | |||
1885 | "Sending non pseudonym shorten result %s\n", result); | 1891 | "Sending non pseudonym shorten result %s\n", result); |
1886 | 1892 | ||
1887 | send_shorten_response(result, csh); | 1893 | send_shorten_response(result, csh); |
1894 | free_resolver_handle(rh); | ||
1888 | GNUNET_free(result); | 1895 | GNUNET_free(result); |
1889 | return; | 1896 | return; |
1890 | } | 1897 | } |
@@ -1968,7 +1975,7 @@ handle_shorten_pseu_ns_result(void* cls, | |||
1968 | "Sending shorten result %s\n", result); | 1975 | "Sending shorten result %s\n", result); |
1969 | 1976 | ||
1970 | send_shorten_response(result, csh); | 1977 | send_shorten_response(result, csh); |
1971 | 1978 | free_resolver_handle(rh); | |
1972 | GNUNET_free(result); | 1979 | GNUNET_free(result); |
1973 | return; | 1980 | return; |
1974 | } | 1981 | } |
@@ -2154,8 +2161,7 @@ send_shorten_response(const char* name, struct ClientShortenHandle *csh) | |||
2154 | rmsg = GNUNET_malloc(sizeof(struct GNUNET_GNS_ClientShortenResultMessage) | 2161 | rmsg = GNUNET_malloc(sizeof(struct GNUNET_GNS_ClientShortenResultMessage) |
2155 | + strlen(name) + 1); | 2162 | + strlen(name) + 1); |
2156 | 2163 | ||
2157 | rmsg->unique_id = csh->unique_id; | 2164 | rmsg->id = csh->unique_id; |
2158 | rmsg->key = csh->key; | ||
2159 | rmsg->header.type = htons(GNUNET_MESSAGE_TYPE_GNS_SHORTEN_RESULT); | 2165 | rmsg->header.type = htons(GNUNET_MESSAGE_TYPE_GNS_SHORTEN_RESULT); |
2160 | rmsg->header.size = | 2166 | rmsg->header.size = |
2161 | htons(sizeof(struct GNUNET_GNS_ClientShortenResultMessage) + | 2167 | htons(sizeof(struct GNUNET_GNS_ClientShortenResultMessage) + |
@@ -2166,10 +2172,10 @@ send_shorten_response(const char* name, struct ClientShortenHandle *csh) | |||
2166 | GNUNET_SERVER_notification_context_unicast (nc, csh->client, | 2172 | GNUNET_SERVER_notification_context_unicast (nc, csh->client, |
2167 | (const struct GNUNET_MessageHeader *) rmsg, | 2173 | (const struct GNUNET_MessageHeader *) rmsg, |
2168 | GNUNET_NO); | 2174 | GNUNET_NO); |
2169 | |||
2170 | GNUNET_SERVER_receive_done (csh->client, GNUNET_OK); | 2175 | GNUNET_SERVER_receive_done (csh->client, GNUNET_OK); |
2171 | 2176 | ||
2172 | GNUNET_free(rmsg); | 2177 | GNUNET_free(rmsg); |
2178 | GNUNET_free(csh); | ||
2173 | 2179 | ||
2174 | } | 2180 | } |
2175 | 2181 | ||
@@ -2212,8 +2218,7 @@ static void handle_shorten(void *cls, | |||
2212 | 2218 | ||
2213 | csh = GNUNET_malloc(sizeof(struct ClientShortenHandle)); | 2219 | csh = GNUNET_malloc(sizeof(struct ClientShortenHandle)); |
2214 | csh->client = client; | 2220 | csh->client = client; |
2215 | csh->unique_id = sh_msg->unique_id; | 2221 | csh->unique_id = sh_msg->id; |
2216 | csh->key = sh_msg->key; | ||
2217 | 2222 | ||
2218 | shorten_name((char*)&sh_msg[1], csh); | 2223 | shorten_name((char*)&sh_msg[1], csh); |
2219 | 2224 | ||