diff options
author | xrs <xrs@mail36.net> | 2017-03-08 19:53:36 +0100 |
---|---|---|
committer | xrs <xrs@mail36.net> | 2017-03-08 19:53:36 +0100 |
commit | f0a19819c13f90c7f6692fbefc68696d40c8769c (patch) | |
tree | 5e2a9bd605a901601dbdb961316a58c807788af3 /src | |
parent | 4e5dcb2ae364c0def3c37eb5d960ab5a73f0679c (diff) | |
parent | 95646a7b495153841c53034abca516c9261b2fb7 (diff) | |
download | gnunet-f0a19819c13f90c7f6692fbefc68696d40c8769c.tar.gz gnunet-f0a19819c13f90c7f6692fbefc68696d40c8769c.zip |
Merge branch 'master' of ssh://gnunet.org/gnunet
Diffstat (limited to 'src')
-rw-r--r-- | src/arm/gnunet-arm.c | 44 | ||||
-rw-r--r-- | src/consensus/Makefile.am | 5 | ||||
-rw-r--r-- | src/fs/fs_directory.c | 78 | ||||
-rw-r--r-- | src/fs/fs_download.c | 107 | ||||
-rw-r--r-- | src/fs/fs_search.c | 7 | ||||
-rw-r--r-- | src/fs/fs_tree.c | 6 | ||||
-rw-r--r-- | src/fs/fs_unindex.c | 3 | ||||
-rw-r--r-- | src/fs/fs_uri.c | 22 | ||||
-rw-r--r-- | src/include/gnunet_arm_service.h | 18 | ||||
-rw-r--r-- | src/include/gnunet_configuration_lib.h | 7 | ||||
-rw-r--r-- | src/include/gnunet_core_service.h | 53 | ||||
-rw-r--r-- | src/secretsharing/Makefile.am | 6 | ||||
-rw-r--r-- | src/testbed/gnunet-service-testbed_peers.c | 6 | ||||
-rw-r--r-- | src/util/disk.c | 21 |
14 files changed, 190 insertions, 193 deletions
diff --git a/src/arm/gnunet-arm.c b/src/arm/gnunet-arm.c index 65a6463cf..49886eb56 100644 --- a/src/arm/gnunet-arm.c +++ b/src/arm/gnunet-arm.c | |||
@@ -220,14 +220,8 @@ req_string (enum GNUNET_ARM_RequestStatus rs) | |||
220 | { | 220 | { |
221 | case GNUNET_ARM_REQUEST_SENT_OK: | 221 | case GNUNET_ARM_REQUEST_SENT_OK: |
222 | return _("Message was sent successfully"); | 222 | return _("Message was sent successfully"); |
223 | case GNUNET_ARM_REQUEST_CONFIGURATION_ERROR: | ||
224 | return _("Misconfiguration (can not connect to the ARM service)"); | ||
225 | case GNUNET_ARM_REQUEST_DISCONNECTED: | 223 | case GNUNET_ARM_REQUEST_DISCONNECTED: |
226 | return _("We disconnected from ARM before we could send a request"); | 224 | return _("We disconnected from ARM before we could send a request"); |
227 | case GNUNET_ARM_REQUEST_BUSY: | ||
228 | return _("ARM API is busy"); | ||
229 | case GNUNET_ARM_REQUEST_TIMEOUT: | ||
230 | return _("Request timed out"); | ||
231 | } | 225 | } |
232 | return _("Unknown request status"); | 226 | return _("Unknown request status"); |
233 | } | 227 | } |
@@ -245,27 +239,27 @@ ret_string (enum GNUNET_ARM_Result result) | |||
245 | switch (result) | 239 | switch (result) |
246 | { | 240 | { |
247 | case GNUNET_ARM_RESULT_STOPPED: | 241 | case GNUNET_ARM_RESULT_STOPPED: |
248 | return _("%s is stopped"); | 242 | return _("is stopped"); |
249 | case GNUNET_ARM_RESULT_STARTING: | 243 | case GNUNET_ARM_RESULT_STARTING: |
250 | return _("%s is starting"); | 244 | return _("is starting"); |
251 | case GNUNET_ARM_RESULT_STOPPING: | 245 | case GNUNET_ARM_RESULT_STOPPING: |
252 | return _("%s is stopping"); | 246 | return _("is stopping"); |
253 | case GNUNET_ARM_RESULT_IS_STARTING_ALREADY: | 247 | case GNUNET_ARM_RESULT_IS_STARTING_ALREADY: |
254 | return _("%s is starting already"); | 248 | return _("is starting already"); |
255 | case GNUNET_ARM_RESULT_IS_STOPPING_ALREADY: | 249 | case GNUNET_ARM_RESULT_IS_STOPPING_ALREADY: |
256 | return _("%s is stopping already"); | 250 | return _("is stopping already"); |
257 | case GNUNET_ARM_RESULT_IS_STARTED_ALREADY: | 251 | case GNUNET_ARM_RESULT_IS_STARTED_ALREADY: |
258 | return _("%s is started already"); | 252 | return _("is started already"); |
259 | case GNUNET_ARM_RESULT_IS_STOPPED_ALREADY: | 253 | case GNUNET_ARM_RESULT_IS_STOPPED_ALREADY: |
260 | return _("%s is stopped already"); | 254 | return _("is stopped already"); |
261 | case GNUNET_ARM_RESULT_IS_NOT_KNOWN: | 255 | case GNUNET_ARM_RESULT_IS_NOT_KNOWN: |
262 | return _("%s service is not known to ARM"); | 256 | return _("service is not known to ARM"); |
263 | case GNUNET_ARM_RESULT_START_FAILED: | 257 | case GNUNET_ARM_RESULT_START_FAILED: |
264 | return _("%s service failed to start"); | 258 | return _("service failed to start"); |
265 | case GNUNET_ARM_RESULT_IN_SHUTDOWN: | 259 | case GNUNET_ARM_RESULT_IN_SHUTDOWN: |
266 | return _("%s service cannot be started because ARM is shutting down"); | 260 | return _("service cannot be manipulated because ARM is shutting down"); |
267 | } | 261 | } |
268 | return _("%.s Unknown result code."); | 262 | return _("Unknown result code."); |
269 | } | 263 | } |
270 | 264 | ||
271 | 265 | ||
@@ -378,10 +372,9 @@ stop_callback (void *cls, | |||
378 | (GNUNET_ARM_RESULT_STOPPED != result) && | 372 | (GNUNET_ARM_RESULT_STOPPED != result) && |
379 | (GNUNET_ARM_RESULT_IS_STOPPED_ALREADY != result)) | 373 | (GNUNET_ARM_RESULT_IS_STOPPED_ALREADY != result)) |
380 | { | 374 | { |
381 | GNUNET_asprintf (&msg, "%s", | 375 | FPRINTF (stdout, |
382 | _("Failed to stop the ARM service: %s\n")); | 376 | _("Failed to stop the ARM service: %s\n"), |
383 | FPRINTF (stdout, msg, ret_string (result)); | 377 | ret_string (result)); |
384 | GNUNET_free (msg); | ||
385 | GNUNET_SCHEDULER_shutdown (); | 378 | GNUNET_SCHEDULER_shutdown (); |
386 | return; | 379 | return; |
387 | } | 380 | } |
@@ -476,11 +469,10 @@ term_callback (void *cls, | |||
476 | if ((GNUNET_ARM_RESULT_STOPPED != result) && | 469 | if ((GNUNET_ARM_RESULT_STOPPED != result) && |
477 | (GNUNET_ARM_RESULT_IS_STOPPED_ALREADY != result)) | 470 | (GNUNET_ARM_RESULT_IS_STOPPED_ALREADY != result)) |
478 | { | 471 | { |
479 | GNUNET_asprintf (&msg, | 472 | FPRINTF (stdout, |
480 | _("Failed to kill the `%s' service: %s\n"), | 473 | _("Failed to kill the `%s' service: %s\n"), |
481 | term, ret_string (result)); | 474 | term, |
482 | FPRINTF (stdout, "%s", msg); | 475 | ret_string (result)); |
483 | GNUNET_free (msg); | ||
484 | GNUNET_SCHEDULER_shutdown (); | 476 | GNUNET_SCHEDULER_shutdown (); |
485 | return; | 477 | return; |
486 | } | 478 | } |
diff --git a/src/consensus/Makefile.am b/src/consensus/Makefile.am index 2b1987fbc..c0205ee5d 100644 --- a/src/consensus/Makefile.am +++ b/src/consensus/Makefile.am | |||
@@ -18,8 +18,6 @@ if USE_COVERAGE | |||
18 | AM_CFLAGS = -fprofile-arcs -ftest-coverage | 18 | AM_CFLAGS = -fprofile-arcs -ftest-coverage |
19 | endif | 19 | endif |
20 | 20 | ||
21 | bin_PROGRAMS = \ | ||
22 | gnunet-consensus-profiler | ||
23 | 21 | ||
24 | libexec_PROGRAMS = \ | 22 | libexec_PROGRAMS = \ |
25 | gnunet-service-consensus | 23 | gnunet-service-consensus |
@@ -86,6 +84,9 @@ libgnunet_plugin_block_consensus_la_LDFLAGS = \ | |||
86 | 84 | ||
87 | 85 | ||
88 | if HAVE_TESTING | 86 | if HAVE_TESTING |
87 | bin_PROGRAMS = \ | ||
88 | gnunet-consensus-profiler | ||
89 | |||
89 | check_PROGRAMS = \ | 90 | check_PROGRAMS = \ |
90 | test_consensus_api | 91 | test_consensus_api |
91 | 92 | ||
diff --git a/src/fs/fs_directory.c b/src/fs/fs_directory.c index a18a903be..514eb64b3 100644 --- a/src/fs/fs_directory.c +++ b/src/fs/fs_directory.c | |||
@@ -170,13 +170,14 @@ find_full_data (void *cls, const char *plugin_name, | |||
170 | * @param data pointer to the beginning of the directory | 170 | * @param data pointer to the beginning of the directory |
171 | * @param offset offset of data in the directory | 171 | * @param offset offset of data in the directory |
172 | * @param dep function to call on each entry | 172 | * @param dep function to call on each entry |
173 | * @param dep_cls closure for dep | 173 | * @param dep_cls closure for @a dep |
174 | * @return GNUNET_OK if this could be a block in a directory, | 174 | * @return #GNUNET_OK if this could be a block in a directory, |
175 | * GNUNET_NO if this could be part of a directory (but not 100% OK) | 175 | * #GNUNET_NO if this could be part of a directory (but not 100% OK) |
176 | * GNUNET_SYSERR if 'data' does not represent a directory | 176 | * #GNUNET_SYSERR if @a data does not represent a directory |
177 | */ | 177 | */ |
178 | int | 178 | int |
179 | GNUNET_FS_directory_list_contents (size_t size, const void *data, | 179 | GNUNET_FS_directory_list_contents (size_t size, |
180 | const void *data, | ||
180 | uint64_t offset, | 181 | uint64_t offset, |
181 | GNUNET_FS_DirectoryEntryProcessor dep, | 182 | GNUNET_FS_DirectoryEntryProcessor dep, |
182 | void *dep_cls) | 183 | void *dep_cls) |
@@ -194,12 +195,16 @@ GNUNET_FS_directory_list_contents (size_t size, const void *data, | |||
194 | 195 | ||
195 | if ((offset == 0) && | 196 | if ((offset == 0) && |
196 | ((size < 8 + sizeof (uint32_t)) || | 197 | ((size < 8 + sizeof (uint32_t)) || |
197 | (0 != memcmp (cdata, GNUNET_FS_DIRECTORY_MAGIC, 8)))) | 198 | (0 != memcmp (cdata, |
199 | GNUNET_FS_DIRECTORY_MAGIC, | ||
200 | 8)))) | ||
198 | return GNUNET_SYSERR; | 201 | return GNUNET_SYSERR; |
199 | pos = offset; | 202 | pos = offset; |
200 | if (offset == 0) | 203 | if (offset == 0) |
201 | { | 204 | { |
202 | GNUNET_memcpy (&mdSize, &cdata[8], sizeof (uint32_t)); | 205 | GNUNET_memcpy (&mdSize, |
206 | &cdata[8], | ||
207 | sizeof (uint32_t)); | ||
203 | mdSize = ntohl (mdSize); | 208 | mdSize = ntohl (mdSize); |
204 | if (mdSize > size - 8 - sizeof (uint32_t)) | 209 | if (mdSize > size - 8 - sizeof (uint32_t)) |
205 | { | 210 | { |
@@ -215,7 +220,12 @@ GNUNET_FS_directory_list_contents (size_t size, const void *data, | |||
215 | GNUNET_break (0); | 220 | GNUNET_break (0); |
216 | return GNUNET_SYSERR; /* malformed ! */ | 221 | return GNUNET_SYSERR; /* malformed ! */ |
217 | } | 222 | } |
218 | dep (dep_cls, NULL, NULL, md, 0, NULL); | 223 | dep (dep_cls, |
224 | NULL, | ||
225 | NULL, | ||
226 | md, | ||
227 | 0, | ||
228 | NULL); | ||
219 | GNUNET_CONTAINER_meta_data_destroy (md); | 229 | GNUNET_CONTAINER_meta_data_destroy (md); |
220 | pos = 8 + sizeof (uint32_t) + mdSize; | 230 | pos = 8 + sizeof (uint32_t) + mdSize; |
221 | } | 231 | } |
@@ -247,7 +257,7 @@ GNUNET_FS_directory_list_contents (size_t size, const void *data, | |||
247 | 257 | ||
248 | uri = GNUNET_FS_uri_parse (&cdata[pos], &emsg); | 258 | uri = GNUNET_FS_uri_parse (&cdata[pos], &emsg); |
249 | pos = epos + 1; | 259 | pos = epos + 1; |
250 | if (uri == NULL) | 260 | if (NULL == uri) |
251 | { | 261 | { |
252 | GNUNET_free (emsg); | 262 | GNUNET_free (emsg); |
253 | pos--; /* go back to '\0' to force going to next alignment */ | 263 | pos--; /* go back to '\0' to force going to next alignment */ |
@@ -260,7 +270,9 @@ GNUNET_FS_directory_list_contents (size_t size, const void *data, | |||
260 | return GNUNET_NO; /* illegal in directory! */ | 270 | return GNUNET_NO; /* illegal in directory! */ |
261 | } | 271 | } |
262 | 272 | ||
263 | GNUNET_memcpy (&mdSize, &cdata[pos], sizeof (uint32_t)); | 273 | GNUNET_memcpy (&mdSize, |
274 | &cdata[pos], | ||
275 | sizeof (uint32_t)); | ||
264 | mdSize = ntohl (mdSize); | 276 | mdSize = ntohl (mdSize); |
265 | pos += sizeof (uint32_t); | 277 | pos += sizeof (uint32_t); |
266 | if (pos + mdSize > size) | 278 | if (pos + mdSize > size) |
@@ -269,8 +281,9 @@ GNUNET_FS_directory_list_contents (size_t size, const void *data, | |||
269 | return GNUNET_NO; /* malformed - or partial download */ | 281 | return GNUNET_NO; /* malformed - or partial download */ |
270 | } | 282 | } |
271 | 283 | ||
272 | md = GNUNET_CONTAINER_meta_data_deserialize (&cdata[pos], mdSize); | 284 | md = GNUNET_CONTAINER_meta_data_deserialize (&cdata[pos], |
273 | if (md == NULL) | 285 | mdSize); |
286 | if (NULL == md) | ||
274 | { | 287 | { |
275 | GNUNET_FS_uri_destroy (uri); | 288 | GNUNET_FS_uri_destroy (uri); |
276 | GNUNET_break (0); | 289 | GNUNET_break (0); |
@@ -282,10 +295,17 @@ GNUNET_FS_directory_list_contents (size_t size, const void *data, | |||
282 | EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME); | 295 | EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME); |
283 | full_data.size = 0; | 296 | full_data.size = 0; |
284 | full_data.data = NULL; | 297 | full_data.data = NULL; |
285 | GNUNET_CONTAINER_meta_data_iterate (md, &find_full_data, &full_data); | 298 | GNUNET_CONTAINER_meta_data_iterate (md, |
286 | if (dep != NULL) | 299 | &find_full_data, |
300 | &full_data); | ||
301 | if (NULL != dep) | ||
287 | { | 302 | { |
288 | dep (dep_cls, filename, uri, md, full_data.size, full_data.data); | 303 | dep (dep_cls, |
304 | filename, | ||
305 | uri, | ||
306 | md, | ||
307 | full_data.size, | ||
308 | full_data.data); | ||
289 | } | 309 | } |
290 | GNUNET_free_non_null (full_data.data); | 310 | GNUNET_free_non_null (full_data.data); |
291 | GNUNET_free_non_null (filename); | 311 | GNUNET_free_non_null (filename); |
@@ -548,11 +568,12 @@ block_align (size_t start, unsigned int count, const size_t * sizes, | |||
548 | * @param bld directory to finish | 568 | * @param bld directory to finish |
549 | * @param rsize set to the number of bytes needed | 569 | * @param rsize set to the number of bytes needed |
550 | * @param rdata set to the encoded directory | 570 | * @param rdata set to the encoded directory |
551 | * @return GNUNET_OK on success | 571 | * @return #GNUNET_OK on success |
552 | */ | 572 | */ |
553 | int | 573 | int |
554 | GNUNET_FS_directory_builder_finish (struct GNUNET_FS_DirectoryBuilder *bld, | 574 | GNUNET_FS_directory_builder_finish (struct GNUNET_FS_DirectoryBuilder *bld, |
555 | size_t * rsize, void **rdata) | 575 | size_t * rsize, |
576 | void **rdata) | ||
556 | { | 577 | { |
557 | char *data; | 578 | char *data; |
558 | char *sptr; | 579 | char *sptr; |
@@ -575,9 +596,12 @@ GNUNET_FS_directory_builder_finish (struct GNUNET_FS_DirectoryBuilder *bld, | |||
575 | bes = NULL; | 596 | bes = NULL; |
576 | if (0 < bld->count) | 597 | if (0 < bld->count) |
577 | { | 598 | { |
578 | sizes = GNUNET_malloc (bld->count * sizeof (size_t)); | 599 | sizes = GNUNET_new_array (bld->count, |
579 | perm = GNUNET_malloc (bld->count * sizeof (unsigned int)); | 600 | size_t); |
580 | bes = GNUNET_malloc (bld->count * sizeof (struct BuilderEntry *)); | 601 | perm = GNUNET_new_array (bld->count, |
602 | unsigned int); | ||
603 | bes = GNUNET_new_array (bld->count, | ||
604 | struct BuilderEntry *); | ||
581 | pos = bld->head; | 605 | pos = bld->head; |
582 | for (i = 0; i < bld->count; i++) | 606 | for (i = 0; i < bld->count; i++) |
583 | { | 607 | { |
@@ -599,7 +623,8 @@ GNUNET_FS_directory_builder_finish (struct GNUNET_FS_DirectoryBuilder *bld, | |||
599 | data = GNUNET_malloc_large (size); | 623 | data = GNUNET_malloc_large (size); |
600 | if (data == NULL) | 624 | if (data == NULL) |
601 | { | 625 | { |
602 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "malloc"); | 626 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, |
627 | "malloc"); | ||
603 | *rsize = 0; | 628 | *rsize = 0; |
604 | *rdata = NULL; | 629 | *rdata = NULL; |
605 | GNUNET_free_non_null (sizes); | 630 | GNUNET_free_non_null (sizes); |
@@ -608,17 +633,22 @@ GNUNET_FS_directory_builder_finish (struct GNUNET_FS_DirectoryBuilder *bld, | |||
608 | return GNUNET_SYSERR; | 633 | return GNUNET_SYSERR; |
609 | } | 634 | } |
610 | *rdata = data; | 635 | *rdata = data; |
611 | GNUNET_memcpy (data, GNUNET_DIRECTORY_MAGIC, strlen (GNUNET_DIRECTORY_MAGIC)); | 636 | GNUNET_memcpy (data, |
637 | GNUNET_DIRECTORY_MAGIC, | ||
638 | strlen (GNUNET_DIRECTORY_MAGIC)); | ||
612 | off = strlen (GNUNET_DIRECTORY_MAGIC); | 639 | off = strlen (GNUNET_DIRECTORY_MAGIC); |
613 | 640 | ||
614 | sptr = &data[off + sizeof (uint32_t)]; | 641 | sptr = &data[off + sizeof (uint32_t)]; |
615 | ret = | 642 | ret = |
616 | GNUNET_CONTAINER_meta_data_serialize (bld->meta, &sptr, | 643 | GNUNET_CONTAINER_meta_data_serialize (bld->meta, |
644 | &sptr, | ||
617 | size - off - sizeof (uint32_t), | 645 | size - off - sizeof (uint32_t), |
618 | GNUNET_CONTAINER_META_DATA_SERIALIZE_FULL); | 646 | GNUNET_CONTAINER_META_DATA_SERIALIZE_FULL); |
619 | GNUNET_assert (ret != -1); | 647 | GNUNET_assert (ret != -1); |
620 | big = htonl (ret); | 648 | big = htonl (ret); |
621 | GNUNET_memcpy (&data[off], &big, sizeof (uint32_t)); | 649 | GNUNET_memcpy (&data[off], |
650 | &big, | ||
651 | sizeof (uint32_t)); | ||
622 | off += sizeof (uint32_t) + ret; | 652 | off += sizeof (uint32_t) + ret; |
623 | for (j = 0; j < bld->count; j++) | 653 | for (j = 0; j < bld->count; j++) |
624 | { | 654 | { |
diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c index 0789162bf..ce852f2d0 100644 --- a/src/fs/fs_download.c +++ b/src/fs/fs_download.c | |||
@@ -37,14 +37,14 @@ static int | |||
37 | is_recursive_download (struct GNUNET_FS_DownloadContext *dc) | 37 | is_recursive_download (struct GNUNET_FS_DownloadContext *dc) |
38 | { | 38 | { |
39 | return (0 != (dc->options & GNUNET_FS_DOWNLOAD_OPTION_RECURSIVE)) && | 39 | return (0 != (dc->options & GNUNET_FS_DOWNLOAD_OPTION_RECURSIVE)) && |
40 | ((GNUNET_YES == GNUNET_FS_meta_data_test_for_directory (dc->meta)) || | 40 | ( (GNUNET_YES == GNUNET_FS_meta_data_test_for_directory (dc->meta)) || |
41 | ((NULL == dc->meta) && | 41 | ( (NULL == dc->meta) && |
42 | ((NULL == dc->filename) || | 42 | ( (NULL == dc->filename) || |
43 | ((strlen (dc->filename) >= strlen (GNUNET_FS_DIRECTORY_EXT)) && | 43 | ( (strlen (dc->filename) >= strlen (GNUNET_FS_DIRECTORY_EXT)) && |
44 | (NULL != | 44 | (NULL != |
45 | strstr (dc->filename + strlen (dc->filename) - | 45 | strstr (dc->filename + strlen (dc->filename) - |
46 | strlen (GNUNET_FS_DIRECTORY_EXT), | 46 | strlen (GNUNET_FS_DIRECTORY_EXT), |
47 | GNUNET_FS_DIRECTORY_EXT)))))); | 47 | GNUNET_FS_DIRECTORY_EXT)) ) ) ) ); |
48 | } | 48 | } |
49 | 49 | ||
50 | 50 | ||
@@ -278,10 +278,12 @@ try_reconnect (struct GNUNET_FS_DownloadContext *dc); | |||
278 | * @param data contents of the file (or NULL if they were not inlined) | 278 | * @param data contents of the file (or NULL if they were not inlined) |
279 | */ | 279 | */ |
280 | static void | 280 | static void |
281 | trigger_recursive_download (void *cls, const char *filename, | 281 | trigger_recursive_download (void *cls, |
282 | const char *filename, | ||
282 | const struct GNUNET_FS_Uri *uri, | 283 | const struct GNUNET_FS_Uri *uri, |
283 | const struct GNUNET_CONTAINER_MetaData *meta, | 284 | const struct GNUNET_CONTAINER_MetaData *meta, |
284 | size_t length, const void *data); | 285 | size_t length, |
286 | const void *data); | ||
285 | 287 | ||
286 | 288 | ||
287 | /** | 289 | /** |
@@ -304,24 +306,28 @@ full_recursive_download (struct GNUNET_FS_DownloadContext *dc) | |||
304 | if (size64 != (uint64_t) size) | 306 | if (size64 != (uint64_t) size) |
305 | { | 307 | { |
306 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 308 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
307 | _ | 309 | _("Recursive downloads of directories larger than 4 GB are not supported on 32-bit systems\n")); |
308 | ("Recursive downloads of directories larger than 4 GB are not supported on 32-bit systems\n")); | ||
309 | return; | 310 | return; |
310 | } | 311 | } |
311 | if (NULL != dc->filename) | 312 | if (NULL != dc->filename) |
312 | { | 313 | { |
313 | h = GNUNET_DISK_file_open (dc->filename, GNUNET_DISK_OPEN_READ, | 314 | h = GNUNET_DISK_file_open (dc->filename, |
315 | GNUNET_DISK_OPEN_READ, | ||
314 | GNUNET_DISK_PERM_NONE); | 316 | GNUNET_DISK_PERM_NONE); |
315 | } | 317 | } |
316 | else | 318 | else |
317 | { | 319 | { |
318 | GNUNET_assert (NULL != dc->temp_filename); | 320 | GNUNET_assert (NULL != dc->temp_filename); |
319 | h = GNUNET_DISK_file_open (dc->temp_filename, GNUNET_DISK_OPEN_READ, | 321 | h = GNUNET_DISK_file_open (dc->temp_filename, |
322 | GNUNET_DISK_OPEN_READ, | ||
320 | GNUNET_DISK_PERM_NONE); | 323 | GNUNET_DISK_PERM_NONE); |
321 | } | 324 | } |
322 | if (NULL == h) | 325 | if (NULL == h) |
323 | return; /* oops */ | 326 | return; /* oops */ |
324 | data = GNUNET_DISK_file_map (h, &m, GNUNET_DISK_MAP_TYPE_READ, size); | 327 | data = GNUNET_DISK_file_map (h, |
328 | &m, | ||
329 | GNUNET_DISK_MAP_TYPE_READ, | ||
330 | size); | ||
325 | if (NULL == data) | 331 | if (NULL == data) |
326 | { | 332 | { |
327 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 333 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
@@ -329,15 +335,25 @@ full_recursive_download (struct GNUNET_FS_DownloadContext *dc) | |||
329 | } | 335 | } |
330 | else | 336 | else |
331 | { | 337 | { |
332 | GNUNET_FS_directory_list_contents (size, data, 0, | 338 | if (GNUNET_OK != |
333 | &trigger_recursive_download, dc); | 339 | GNUNET_FS_directory_list_contents (size, |
340 | data, | ||
341 | 0, | ||
342 | &trigger_recursive_download, | ||
343 | dc)) | ||
344 | { | ||
345 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
346 | _("Failed to access full directroy contents of `%s' for recursive download\n"), | ||
347 | dc->filename); | ||
348 | } | ||
334 | GNUNET_DISK_file_unmap (m); | 349 | GNUNET_DISK_file_unmap (m); |
335 | } | 350 | } |
336 | GNUNET_DISK_file_close (h); | 351 | GNUNET_DISK_file_close (h); |
337 | if (NULL == dc->filename) | 352 | if (NULL == dc->filename) |
338 | { | 353 | { |
339 | if (0 != UNLINK (dc->temp_filename)) | 354 | if (0 != UNLINK (dc->temp_filename)) |
340 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "unlink", | 355 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, |
356 | "unlink", | ||
341 | dc->temp_filename); | 357 | dc->temp_filename); |
342 | GNUNET_free (dc->temp_filename); | 358 | GNUNET_free (dc->temp_filename); |
343 | dc->temp_filename = NULL; | 359 | dc->temp_filename = NULL; |
@@ -362,14 +378,16 @@ check_completed (struct GNUNET_FS_DownloadContext *dc) | |||
362 | struct GNUNET_FS_DownloadContext *pos; | 378 | struct GNUNET_FS_DownloadContext *pos; |
363 | 379 | ||
364 | /* first, check if we need to download children */ | 380 | /* first, check if we need to download children */ |
365 | if ((NULL == dc->child_head) && (is_recursive_download (dc))) | 381 | if (is_recursive_download (dc)) |
366 | full_recursive_download (dc); | 382 | full_recursive_download (dc); |
367 | /* then, check if children are done already */ | 383 | /* then, check if children are done already */ |
368 | for (pos = dc->child_head; NULL != pos; pos = pos->next) | 384 | for (pos = dc->child_head; NULL != pos; pos = pos->next) |
369 | { | 385 | { |
370 | if ((pos->emsg == NULL) && (pos->completed < pos->length)) | 386 | if ( (NULL == pos->emsg) && |
387 | (pos->completed < pos->length) ) | ||
371 | return; /* not done yet */ | 388 | return; /* not done yet */ |
372 | if ((pos->child_head != NULL) && (pos->has_finished != GNUNET_YES)) | 389 | if ( (NULL != pos->child_head) && |
390 | (pos->has_finished != GNUNET_YES) ) | ||
373 | return; /* not transitively done yet */ | 391 | return; /* not transitively done yet */ |
374 | } | 392 | } |
375 | /* All of our children are done, so mark this download done */ | 393 | /* All of our children are done, so mark this download done */ |
@@ -471,7 +489,11 @@ try_match_block (struct GNUNET_FS_DownloadContext *dc, | |||
471 | } | 489 | } |
472 | GNUNET_CRYPTO_hash (&data[dr->offset], dlen, &in_chk.key); | 490 | GNUNET_CRYPTO_hash (&data[dr->offset], dlen, &in_chk.key); |
473 | GNUNET_CRYPTO_hash_to_aes_key (&in_chk.key, &sk, &iv); | 491 | GNUNET_CRYPTO_hash_to_aes_key (&in_chk.key, &sk, &iv); |
474 | if (-1 == GNUNET_CRYPTO_symmetric_encrypt (&data[dr->offset], dlen, &sk, &iv, enc)) | 492 | if (-1 == GNUNET_CRYPTO_symmetric_encrypt (&data[dr->offset], |
493 | dlen, | ||
494 | &sk, | ||
495 | &iv, | ||
496 | enc)) | ||
475 | { | 497 | { |
476 | GNUNET_break (0); | 498 | GNUNET_break (0); |
477 | return; | 499 | return; |
@@ -484,7 +506,9 @@ try_match_block (struct GNUNET_FS_DownloadContext *dc, | |||
484 | dr->state = BRS_RECONSTRUCT_META_UP; | 506 | dr->state = BRS_RECONSTRUCT_META_UP; |
485 | break; | 507 | break; |
486 | case BRS_CHK_SET: | 508 | case BRS_CHK_SET: |
487 | if (0 != memcmp (&in_chk, &dr->chk, sizeof (struct ContentHashKey))) | 509 | if (0 != memcmp (&in_chk, |
510 | &dr->chk, | ||
511 | sizeof (struct ContentHashKey))) | ||
488 | { | 512 | { |
489 | /* other peer provided bogus meta data */ | 513 | /* other peer provided bogus meta data */ |
490 | GNUNET_break_op (0); | 514 | GNUNET_break_op (0); |
@@ -591,7 +615,10 @@ match_full_data (void *cls, const char *plugin_name, | |||
591 | GNUNET_break_op (0); | 615 | GNUNET_break_op (0); |
592 | return 1; /* bogus meta data */ | 616 | return 1; /* bogus meta data */ |
593 | } | 617 | } |
594 | try_match_block (dc, dc->top_request, data, data_len); | 618 | try_match_block (dc, |
619 | dc->top_request, | ||
620 | data, | ||
621 | data_len); | ||
595 | return 1; | 622 | return 1; |
596 | } | 623 | } |
597 | 624 | ||
@@ -820,10 +847,12 @@ schedule_block_download (struct GNUNET_FS_DownloadContext *dc, | |||
820 | * @param data contents of the file (or NULL if they were not inlined) | 847 | * @param data contents of the file (or NULL if they were not inlined) |
821 | */ | 848 | */ |
822 | static void | 849 | static void |
823 | trigger_recursive_download (void *cls, const char *filename, | 850 | trigger_recursive_download (void *cls, |
851 | const char *filename, | ||
824 | const struct GNUNET_FS_Uri *uri, | 852 | const struct GNUNET_FS_Uri *uri, |
825 | const struct GNUNET_CONTAINER_MetaData *meta, | 853 | const struct GNUNET_CONTAINER_MetaData *meta, |
826 | size_t length, const void *data) | 854 | size_t length, |
855 | const void *data) | ||
827 | { | 856 | { |
828 | struct GNUNET_FS_DownloadContext *dc = cls; | 857 | struct GNUNET_FS_DownloadContext *dc = cls; |
829 | struct GNUNET_FS_DownloadContext *cpos; | 858 | struct GNUNET_FS_DownloadContext *cpos; |
@@ -936,9 +965,17 @@ trigger_recursive_download (void *cls, const char *filename, | |||
936 | (unsigned long long) GNUNET_FS_uri_chk_get_file_size (uri), | 965 | (unsigned long long) GNUNET_FS_uri_chk_get_file_size (uri), |
937 | (unsigned int) | 966 | (unsigned int) |
938 | GNUNET_CONTAINER_meta_data_get_serialized_size (meta)); | 967 | GNUNET_CONTAINER_meta_data_get_serialized_size (meta)); |
939 | GNUNET_FS_download_start (dc->h, uri, meta, full_name, temp_name, 0, | 968 | GNUNET_FS_download_start (dc->h, |
969 | uri, | ||
970 | meta, | ||
971 | full_name, | ||
972 | temp_name, | ||
973 | 0, | ||
940 | GNUNET_FS_uri_chk_get_file_size (uri), | 974 | GNUNET_FS_uri_chk_get_file_size (uri), |
941 | dc->anonymity, dc->options, NULL, dc); | 975 | dc->anonymity, |
976 | dc->options, | ||
977 | NULL, | ||
978 | dc); | ||
942 | GNUNET_free_non_null (full_name); | 979 | GNUNET_free_non_null (full_name); |
943 | GNUNET_free_non_null (temp_name); | 980 | GNUNET_free_non_null (temp_name); |
944 | GNUNET_free_non_null (fn); | 981 | GNUNET_free_non_null (fn); |
@@ -953,11 +990,9 @@ trigger_recursive_download (void *cls, const char *filename, | |||
953 | void | 990 | void |
954 | GNUNET_FS_free_download_request_ (struct DownloadRequest *dr) | 991 | GNUNET_FS_free_download_request_ (struct DownloadRequest *dr) |
955 | { | 992 | { |
956 | unsigned int i; | ||
957 | |||
958 | if (NULL == dr) | 993 | if (NULL == dr) |
959 | return; | 994 | return; |
960 | for (i = 0; i < dr->num_children; i++) | 995 | for (unsigned int i = 0; i < dr->num_children; i++) |
961 | GNUNET_FS_free_download_request_ (dr->children[i]); | 996 | GNUNET_FS_free_download_request_ (dr->children[i]); |
962 | GNUNET_free_non_null (dr->children); | 997 | GNUNET_free_non_null (dr->children); |
963 | GNUNET_free (dr); | 998 | GNUNET_free (dr); |
@@ -1509,13 +1544,17 @@ create_download_request (struct DownloadRequest *parent, | |||
1509 | GNUNET_assert (dr->num_children > 0); | 1544 | GNUNET_assert (dr->num_children > 0); |
1510 | 1545 | ||
1511 | dr->children = | 1546 | dr->children = |
1512 | GNUNET_malloc (dr->num_children * sizeof (struct DownloadRequest *)); | 1547 | GNUNET_new_array (dr->num_children, |
1548 | struct DownloadRequest *); | ||
1513 | for (i = 0; i < dr->num_children; i++) | 1549 | for (i = 0; i < dr->num_children; i++) |
1514 | { | 1550 | { |
1515 | dr->children[i] = | 1551 | dr->children[i] = |
1516 | create_download_request (dr, i + head_skip, depth - 1, | 1552 | create_download_request (dr, |
1553 | i + head_skip, | ||
1554 | depth - 1, | ||
1517 | dr_offset + (i + head_skip) * child_block_size, | 1555 | dr_offset + (i + head_skip) * child_block_size, |
1518 | file_start_offset, desired_length); | 1556 | file_start_offset, |
1557 | desired_length); | ||
1519 | } | 1558 | } |
1520 | return dr; | 1559 | return dr; |
1521 | } | 1560 | } |
diff --git a/src/fs/fs_search.c b/src/fs/fs_search.c index 3cbf2afef..e31115f39 100644 --- a/src/fs/fs_search.c +++ b/src/fs/fs_search.c | |||
@@ -1383,9 +1383,10 @@ GNUNET_FS_search_start_searching_ (struct GNUNET_FS_SearchContext *sc) | |||
1383 | GNUNET_assert (0 != sc->uri->data.ksk.keywordCount); | 1383 | GNUNET_assert (0 != sc->uri->data.ksk.keywordCount); |
1384 | anon = GNUNET_CRYPTO_ecdsa_key_get_anonymous (); | 1384 | anon = GNUNET_CRYPTO_ecdsa_key_get_anonymous (); |
1385 | GNUNET_CRYPTO_ecdsa_key_get_public (anon, &anon_pub); | 1385 | GNUNET_CRYPTO_ecdsa_key_get_public (anon, &anon_pub); |
1386 | sc->requests = | 1386 | sc->requests |
1387 | GNUNET_malloc (sizeof (struct SearchRequestEntry) * | 1387 | = GNUNET_new_array (sc->uri->data.ksk.keywordCount, |
1388 | sc->uri->data.ksk.keywordCount); | 1388 | struct SearchRequestEntry); |
1389 | |||
1389 | for (i = 0; i < sc->uri->data.ksk.keywordCount; i++) | 1390 | for (i = 0; i < sc->uri->data.ksk.keywordCount; i++) |
1390 | { | 1391 | { |
1391 | keyword = &sc->uri->data.ksk.keywords[i][1]; | 1392 | keyword = &sc->uri->data.ksk.keywords[i][1]; |
diff --git a/src/fs/fs_tree.c b/src/fs/fs_tree.c index b3c632203..e57e4e494 100644 --- a/src/fs/fs_tree.c +++ b/src/fs/fs_tree.c | |||
@@ -285,9 +285,9 @@ GNUNET_FS_tree_encoder_create (struct GNUNET_FS_Handle *h, uint64_t size, | |||
285 | te->progress = progress; | 285 | te->progress = progress; |
286 | te->cont = cont; | 286 | te->cont = cont; |
287 | te->chk_tree_depth = GNUNET_FS_compute_depth (size); | 287 | te->chk_tree_depth = GNUNET_FS_compute_depth (size); |
288 | te->chk_tree = | 288 | te->chk_tree |
289 | GNUNET_malloc (te->chk_tree_depth * CHK_PER_INODE * | 289 | = GNUNET_new_array (te->chk_tree_depth * CHK_PER_INODE, |
290 | sizeof (struct ContentHashKey)); | 290 | struct ContentHashKey); |
291 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 291 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
292 | "Created tree encoder for file with %llu bytes and depth %u\n", | 292 | "Created tree encoder for file with %llu bytes and depth %u\n", |
293 | (unsigned long long) size, | 293 | (unsigned long long) size, |
diff --git a/src/fs/fs_unindex.c b/src/fs/fs_unindex.c index a672b84d5..ad1499f00 100644 --- a/src/fs/fs_unindex.c +++ b/src/fs/fs_unindex.c | |||
@@ -454,7 +454,8 @@ continue_after_remove (void *cls, | |||
454 | * Function called from datastore with result from us looking for | 454 | * Function called from datastore with result from us looking for |
455 | * a UBlock. There are four cases: | 455 | * a UBlock. There are four cases: |
456 | * 1) no result, means we move on to the next keyword | 456 | * 1) no result, means we move on to the next keyword |
457 | * 2) UID is the same as the first UID, means we move on to next keyword | 457 | * 2) data hash is the same as an already seen data hash, means we move on to |
458 | * next keyword | ||
458 | * 3) UBlock for a different CHK, means we keep looking for more | 459 | * 3) UBlock for a different CHK, means we keep looking for more |
459 | * 4) UBlock is for our CHK, means we remove the block and then move | 460 | * 4) UBlock is for our CHK, means we remove the block and then move |
460 | * on to the next keyword | 461 | * on to the next keyword |
diff --git a/src/fs/fs_uri.c b/src/fs/fs_uri.c index fa27e6e9b..11968b750 100644 --- a/src/fs/fs_uri.c +++ b/src/fs/fs_uri.c | |||
@@ -309,7 +309,8 @@ uri_ksk_parse (const char *s, | |||
309 | } | 309 | } |
310 | iret = max; | 310 | iret = max; |
311 | dup = GNUNET_strdup (s); | 311 | dup = GNUNET_strdup (s); |
312 | keywords = GNUNET_malloc (max * sizeof (char *)); | 312 | keywords = GNUNET_new_array (max, |
313 | char *); | ||
313 | for (i = slen - 1; i >= (int) pos; i--) | 314 | for (i = slen - 1; i >= (int) pos; i--) |
314 | { | 315 | { |
315 | if ((s[i] == '%') && (&s[i] == strstr (&s[i], "%22"))) | 316 | if ((s[i] == '%') && (&s[i] == strstr (&s[i], "%22"))) |
@@ -937,7 +938,8 @@ GNUNET_FS_uri_ksk_merge (const struct GNUNET_FS_Uri *u1, | |||
937 | return NULL; | 938 | return NULL; |
938 | } | 939 | } |
939 | kc = u1->data.ksk.keywordCount; | 940 | kc = u1->data.ksk.keywordCount; |
940 | kl = GNUNET_malloc ((kc + u2->data.ksk.keywordCount) * sizeof (char *)); | 941 | kl = GNUNET_new_array (kc + u2->data.ksk.keywordCount, |
942 | char *); | ||
941 | for (i = 0; i < u1->data.ksk.keywordCount; i++) | 943 | for (i = 0; i < u1->data.ksk.keywordCount; i++) |
942 | kl[i] = GNUNET_strdup (u1->data.ksk.keywords[i]); | 944 | kl[i] = GNUNET_strdup (u1->data.ksk.keywords[i]); |
943 | for (i = 0; i < u2->data.ksk.keywordCount; i++) | 945 | for (i = 0; i < u2->data.ksk.keywordCount; i++) |
@@ -991,8 +993,9 @@ GNUNET_FS_uri_dup (const struct GNUNET_FS_Uri *uri) | |||
991 | } | 993 | } |
992 | if (ret->data.ksk.keywordCount > 0) | 994 | if (ret->data.ksk.keywordCount > 0) |
993 | { | 995 | { |
994 | ret->data.ksk.keywords = | 996 | ret->data.ksk.keywords |
995 | GNUNET_malloc (ret->data.ksk.keywordCount * sizeof (char *)); | 997 | = GNUNET_new_array (ret->data.ksk.keywordCount, |
998 | char *); | ||
996 | for (i = 0; i < ret->data.ksk.keywordCount; i++) | 999 | for (i = 0; i < ret->data.ksk.keywordCount; i++) |
997 | ret->data.ksk.keywords[i] = GNUNET_strdup (uri->data.ksk.keywords[i]); | 1000 | ret->data.ksk.keywords[i] = GNUNET_strdup (uri->data.ksk.keywords[i]); |
998 | } | 1001 | } |
@@ -1078,7 +1081,8 @@ GNUNET_FS_uri_ksk_create (const char *keywords, | |||
1078 | *emsg = GNUNET_strdup (_("Number of double-quotes not balanced!\n")); | 1081 | *emsg = GNUNET_strdup (_("Number of double-quotes not balanced!\n")); |
1079 | return NULL; | 1082 | return NULL; |
1080 | } | 1083 | } |
1081 | keywordarr = GNUNET_malloc (num_Words * sizeof (char *)); | 1084 | keywordarr = GNUNET_new_array (num_Words, |
1085 | char *); | ||
1082 | num_Words = 0; | 1086 | num_Words = 0; |
1083 | inWord = 0; | 1087 | inWord = 0; |
1084 | pos = searchString; | 1088 | pos = searchString; |
@@ -1151,7 +1155,8 @@ GNUNET_FS_uri_ksk_create_from_args (unsigned int argc, | |||
1151 | uri = GNUNET_new (struct GNUNET_FS_Uri); | 1155 | uri = GNUNET_new (struct GNUNET_FS_Uri); |
1152 | uri->type = GNUNET_FS_URI_KSK; | 1156 | uri->type = GNUNET_FS_URI_KSK; |
1153 | uri->data.ksk.keywordCount = argc; | 1157 | uri->data.ksk.keywordCount = argc; |
1154 | uri->data.ksk.keywords = GNUNET_malloc (argc * sizeof (char *)); | 1158 | uri->data.ksk.keywords = GNUNET_new_array (argc, |
1159 | char *); | ||
1155 | for (i = 0; i < argc; i++) | 1160 | for (i = 0; i < argc; i++) |
1156 | { | 1161 | { |
1157 | keyword = argv[i]; | 1162 | keyword = argv[i]; |
@@ -1766,8 +1771,9 @@ GNUNET_FS_uri_ksk_create_from_meta_data (const struct GNUNET_CONTAINER_MetaData | |||
1766 | } | 1771 | } |
1767 | /* x3 because there might be a normalized variant of every keyword, | 1772 | /* x3 because there might be a normalized variant of every keyword, |
1768 | plus theoretically one more for mime... */ | 1773 | plus theoretically one more for mime... */ |
1769 | ret->data.ksk.keywords = GNUNET_malloc | 1774 | ret->data.ksk.keywords |
1770 | (sizeof (char *) * (ent + tok_keywords + paren_keywords) * 3); | 1775 | = GNUNET_new_array ((ent + tok_keywords + paren_keywords) * 3, |
1776 | char *); | ||
1771 | GNUNET_CONTAINER_meta_data_iterate (md, &gather_uri_data, ret); | 1777 | GNUNET_CONTAINER_meta_data_iterate (md, &gather_uri_data, ret); |
1772 | } | 1778 | } |
1773 | if (tok_keywords > 0) | 1779 | if (tok_keywords > 0) |
diff --git a/src/include/gnunet_arm_service.h b/src/include/gnunet_arm_service.h index 7fb14d3ac..f8d71bd8b 100644 --- a/src/include/gnunet_arm_service.h +++ b/src/include/gnunet_arm_service.h | |||
@@ -62,25 +62,9 @@ enum GNUNET_ARM_RequestStatus | |||
62 | GNUNET_ARM_REQUEST_SENT_OK = 0, | 62 | GNUNET_ARM_REQUEST_SENT_OK = 0, |
63 | 63 | ||
64 | /** | 64 | /** |
65 | * Misconfiguration (can't connect to the ARM service). | ||
66 | */ | ||
67 | GNUNET_ARM_REQUEST_CONFIGURATION_ERROR = 1, | ||
68 | |||
69 | /** | ||
70 | * We disconnected from ARM, and request was not sent. | 65 | * We disconnected from ARM, and request was not sent. |
71 | */ | 66 | */ |
72 | GNUNET_ARM_REQUEST_DISCONNECTED = 2, | 67 | GNUNET_ARM_REQUEST_DISCONNECTED = 2 |
73 | |||
74 | /** | ||
75 | * ARM API is busy (probably trying to connect to ARM), | ||
76 | * and request was not sent. Try again later. | ||
77 | */ | ||
78 | GNUNET_ARM_REQUEST_BUSY = 3, | ||
79 | |||
80 | /** | ||
81 | * Request time ran out before we had a chance to send it. | ||
82 | */ | ||
83 | GNUNET_ARM_REQUEST_TIMEOUT = 5 | ||
84 | 68 | ||
85 | }; | 69 | }; |
86 | 70 | ||
diff --git a/src/include/gnunet_configuration_lib.h b/src/include/gnunet_configuration_lib.h index 746dea61f..c1537e4f8 100644 --- a/src/include/gnunet_configuration_lib.h +++ b/src/include/gnunet_configuration_lib.h | |||
@@ -281,8 +281,8 @@ GNUNET_CONFIGURATION_get_value_number (const struct GNUNET_CONFIGURATION_Handle | |||
281 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 281 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
282 | */ | 282 | */ |
283 | int | 283 | int |
284 | GNUNET_CONFIGURATION_get_value_float (const struct GNUNET_CONFIGURATION_Handle | 284 | GNUNET_CONFIGURATION_get_value_float (const struct GNUNET_CONFIGURATION_Handle *cfg, |
285 | *cfg, const char *section, | 285 | const char *section, |
286 | const char *option, | 286 | const char *option, |
287 | float *number); | 287 | float *number); |
288 | 288 | ||
@@ -454,9 +454,6 @@ GNUNET_CONFIGURATION_get_data (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
454 | size_t buf_size); | 454 | size_t buf_size); |
455 | 455 | ||
456 | 456 | ||
457 | |||
458 | |||
459 | |||
460 | /** | 457 | /** |
461 | * Expand an expression of the form "$FOO/BAR" to "DIRECTORY/BAR" | 458 | * Expand an expression of the form "$FOO/BAR" to "DIRECTORY/BAR" |
462 | * where either in the "PATHS" section or the environtment "FOO" is | 459 | * where either in the "PATHS" section or the environtment "FOO" is |
diff --git a/src/include/gnunet_core_service.h b/src/include/gnunet_core_service.h index 8136770b7..ace223c11 100644 --- a/src/include/gnunet_core_service.h +++ b/src/include/gnunet_core_service.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009-2014, 2016 GNUnet e.V. | 3 | Copyright (C) 2009-2017 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -197,57 +197,6 @@ GNUNET_CORE_get_mq (const struct GNUNET_CORE_Handle *h, | |||
197 | 197 | ||
198 | 198 | ||
199 | /** | 199 | /** |
200 | * Handle for a transmission request. | ||
201 | */ | ||
202 | struct GNUNET_CORE_TransmitHandle; | ||
203 | |||
204 | |||
205 | /** | ||
206 | * Ask the core to call @a notify once it is ready to transmit the | ||
207 | * given number of bytes to the specified @a target. Must only be | ||
208 | * called after a connection to the respective peer has been | ||
209 | * established (and the client has been informed about this). You may | ||
210 | * have one request of this type pending for each connected peer at | ||
211 | * any time. If a peer disconnects, the application MUST call | ||
212 | * #GNUNET_CORE_notify_transmit_ready_cancel() on the respective | ||
213 | * transmission request, if one such request is pending. | ||
214 | * | ||
215 | * @param handle connection to core service | ||
216 | * @param cork is corking allowed for this transmission? | ||
217 | * @param priority how important is the message? | ||
218 | * @param maxdelay how long can the message wait? Only effective if @a cork is #GNUNET_YES | ||
219 | * @param target who should receive the message, never NULL (can be this peer's identity for loopback) | ||
220 | * @param notify_size how many bytes of buffer space does @a notify want? | ||
221 | * @param notify function to call when buffer space is available; | ||
222 | * will be called with NULL on timeout; clients MUST cancel | ||
223 | * all pending transmission requests DURING the disconnect | ||
224 | * handler | ||
225 | * @param notify_cls closure for @a notify | ||
226 | * @return non-NULL if the notify callback was queued, | ||
227 | * NULL if we can not even queue the request (request already pending); | ||
228 | * if NULL is returned, @a notify will NOT be called. | ||
229 | */ | ||
230 | struct GNUNET_CORE_TransmitHandle * | ||
231 | GNUNET_CORE_notify_transmit_ready (struct GNUNET_CORE_Handle *handle, | ||
232 | int cork, | ||
233 | enum GNUNET_CORE_Priority priority, | ||
234 | struct GNUNET_TIME_Relative maxdelay, | ||
235 | const struct GNUNET_PeerIdentity *target, | ||
236 | size_t notify_size, | ||
237 | GNUNET_CONNECTION_TransmitReadyNotify notify, | ||
238 | void *notify_cls); | ||
239 | |||
240 | |||
241 | /** | ||
242 | * Cancel the specified transmission-ready notification. | ||
243 | * | ||
244 | * @param th handle that was returned by #GNUNET_CORE_notify_transmit_ready(). | ||
245 | */ | ||
246 | void | ||
247 | GNUNET_CORE_notify_transmit_ready_cancel (struct GNUNET_CORE_TransmitHandle *th); | ||
248 | |||
249 | |||
250 | /** | ||
251 | * Handle to a CORE monitoring operation. | 200 | * Handle to a CORE monitoring operation. |
252 | */ | 201 | */ |
253 | struct GNUNET_CORE_MonitorHandle; | 202 | struct GNUNET_CORE_MonitorHandle; |
diff --git a/src/secretsharing/Makefile.am b/src/secretsharing/Makefile.am index 485183e36..4b9a06c40 100644 --- a/src/secretsharing/Makefile.am +++ b/src/secretsharing/Makefile.am | |||
@@ -17,9 +17,6 @@ if USE_COVERAGE | |||
17 | endif | 17 | endif |
18 | 18 | ||
19 | 19 | ||
20 | bin_PROGRAMS = \ | ||
21 | gnunet-secretsharing-profiler | ||
22 | |||
23 | libexec_PROGRAMS = \ | 20 | libexec_PROGRAMS = \ |
24 | gnunet-service-secretsharing | 21 | gnunet-service-secretsharing |
25 | 22 | ||
@@ -57,6 +54,9 @@ libgnunetsecretsharing_la_LDFLAGS = \ | |||
57 | $(GN_LIB_LDFLAGS) | 54 | $(GN_LIB_LDFLAGS) |
58 | 55 | ||
59 | if HAVE_TESTING | 56 | if HAVE_TESTING |
57 | bin_PROGRAMS = \ | ||
58 | gnunet-secretsharing-profiler | ||
59 | |||
60 | check_PROGRAMS = \ | 60 | check_PROGRAMS = \ |
61 | test_secretsharing_api | 61 | test_secretsharing_api |
62 | 62 | ||
diff --git a/src/testbed/gnunet-service-testbed_peers.c b/src/testbed/gnunet-service-testbed_peers.c index a977b2b9b..aacd62583 100644 --- a/src/testbed/gnunet-service-testbed_peers.c +++ b/src/testbed/gnunet-service-testbed_peers.c | |||
@@ -1137,14 +1137,8 @@ arm_req_string (enum GNUNET_ARM_RequestStatus rs) | |||
1137 | { | 1137 | { |
1138 | case GNUNET_ARM_REQUEST_SENT_OK: | 1138 | case GNUNET_ARM_REQUEST_SENT_OK: |
1139 | return _("Message was sent successfully"); | 1139 | return _("Message was sent successfully"); |
1140 | case GNUNET_ARM_REQUEST_CONFIGURATION_ERROR: | ||
1141 | return _("Misconfiguration (can't connect to the ARM service)"); | ||
1142 | case GNUNET_ARM_REQUEST_DISCONNECTED: | 1140 | case GNUNET_ARM_REQUEST_DISCONNECTED: |
1143 | return _("We disconnected from ARM before we could send a request"); | 1141 | return _("We disconnected from ARM before we could send a request"); |
1144 | case GNUNET_ARM_REQUEST_BUSY: | ||
1145 | return _("ARM API is busy"); | ||
1146 | case GNUNET_ARM_REQUEST_TIMEOUT: | ||
1147 | return _("Request timed out"); | ||
1148 | } | 1142 | } |
1149 | return _("Unknown request status"); | 1143 | return _("Unknown request status"); |
1150 | } | 1144 | } |
diff --git a/src/util/disk.c b/src/util/disk.c index d3d5d87dc..d536ec897 100644 --- a/src/util/disk.c +++ b/src/util/disk.c | |||
@@ -329,8 +329,10 @@ GNUNET_DISK_file_get_identifiers (const char *filename, uint64_t * dev, | |||
329 | BY_HANDLE_FILE_INFORMATION info; | 329 | BY_HANDLE_FILE_INFORMATION info; |
330 | int succ; | 330 | int succ; |
331 | 331 | ||
332 | fh = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_READ, 0); | 332 | fh = GNUNET_DISK_file_open (filename, |
333 | if (fh == NULL) | 333 | GNUNET_DISK_OPEN_READ, |
334 | GNUNET_DISK_PERM_NONE); | ||
335 | if (NULL == fh) | ||
334 | return GNUNET_SYSERR; | 336 | return GNUNET_SYSERR; |
335 | succ = GetFileInformationByHandle (fh->h, &info); | 337 | succ = GetFileInformationByHandle (fh->h, &info); |
336 | GNUNET_DISK_file_close (fh); | 338 | GNUNET_DISK_file_close (fh); |
@@ -1191,7 +1193,7 @@ GNUNET_DISK_fn_write (const char *fn, | |||
1191 | fh = GNUNET_DISK_file_open (fn, | 1193 | fh = GNUNET_DISK_file_open (fn, |
1192 | GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_TRUNCATE | 1194 | GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_TRUNCATE |
1193 | | GNUNET_DISK_OPEN_CREATE, mode); | 1195 | | GNUNET_DISK_OPEN_CREATE, mode); |
1194 | if (!fh) | 1196 | if (! fh) |
1195 | return GNUNET_SYSERR; | 1197 | return GNUNET_SYSERR; |
1196 | ret = GNUNET_DISK_file_write (fh, buffer, n); | 1198 | ret = GNUNET_DISK_file_write (fh, buffer, n); |
1197 | GNUNET_assert (GNUNET_OK == GNUNET_DISK_file_close (fh)); | 1199 | GNUNET_assert (GNUNET_OK == GNUNET_DISK_file_close (fh)); |
@@ -1756,9 +1758,10 @@ GNUNET_DISK_file_open (const char *fn, | |||
1756 | 1758 | ||
1757 | 1759 | ||
1758 | /** | 1760 | /** |
1759 | * Close an open file | 1761 | * Close an open file. |
1762 | * | ||
1760 | * @param h file handle | 1763 | * @param h file handle |
1761 | * @return GNUNET_OK on success, GNUNET_SYSERR otherwise | 1764 | * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise |
1762 | */ | 1765 | */ |
1763 | int | 1766 | int |
1764 | GNUNET_DISK_file_close (struct GNUNET_DISK_FileHandle *h) | 1767 | GNUNET_DISK_file_close (struct GNUNET_DISK_FileHandle *h) |
@@ -1773,7 +1776,7 @@ GNUNET_DISK_file_close (struct GNUNET_DISK_FileHandle *h) | |||
1773 | ret = GNUNET_OK; | 1776 | ret = GNUNET_OK; |
1774 | 1777 | ||
1775 | #if MINGW | 1778 | #if MINGW |
1776 | if (!CloseHandle (h->h)) | 1779 | if (! CloseHandle (h->h)) |
1777 | { | 1780 | { |
1778 | SetErrnoFromWinError (GetLastError ()); | 1781 | SetErrnoFromWinError (GetLastError ()); |
1779 | LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "close"); | 1782 | LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "close"); |
@@ -1781,7 +1784,7 @@ GNUNET_DISK_file_close (struct GNUNET_DISK_FileHandle *h) | |||
1781 | } | 1784 | } |
1782 | if (h->oOverlapRead) | 1785 | if (h->oOverlapRead) |
1783 | { | 1786 | { |
1784 | if (!CloseHandle (h->oOverlapRead->hEvent)) | 1787 | if (! CloseHandle (h->oOverlapRead->hEvent)) |
1785 | { | 1788 | { |
1786 | SetErrnoFromWinError (GetLastError ()); | 1789 | SetErrnoFromWinError (GetLastError ()); |
1787 | LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "close"); | 1790 | LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "close"); |
@@ -1822,7 +1825,6 @@ struct GNUNET_DISK_FileHandle * | |||
1822 | GNUNET_DISK_get_handle_from_w32_handle (HANDLE osfh) | 1825 | GNUNET_DISK_get_handle_from_w32_handle (HANDLE osfh) |
1823 | { | 1826 | { |
1824 | struct GNUNET_DISK_FileHandle *fh; | 1827 | struct GNUNET_DISK_FileHandle *fh; |
1825 | |||
1826 | DWORD dwret; | 1828 | DWORD dwret; |
1827 | enum GNUNET_FILE_Type ftype; | 1829 | enum GNUNET_FILE_Type ftype; |
1828 | 1830 | ||
@@ -1836,7 +1838,8 @@ GNUNET_DISK_get_handle_from_w32_handle (HANDLE osfh) | |||
1836 | ftype = GNUNET_DISK_HANLDE_TYPE_PIPE; | 1838 | ftype = GNUNET_DISK_HANLDE_TYPE_PIPE; |
1837 | break; | 1839 | break; |
1838 | case FILE_TYPE_UNKNOWN: | 1840 | case FILE_TYPE_UNKNOWN: |
1839 | if (GetLastError () == NO_ERROR || GetLastError () == ERROR_INVALID_HANDLE) | 1841 | if ( (GetLastError () == NO_ERROR) || |
1842 | (GetLastError () == ERROR_INVALID_HANDLE) ) | ||
1840 | { | 1843 | { |
1841 | if (0 != ResetEvent (osfh)) | 1844 | if (0 != ResetEvent (osfh)) |
1842 | ftype = GNUNET_DISK_HANLDE_TYPE_EVENT; | 1845 | ftype = GNUNET_DISK_HANLDE_TYPE_EVENT; |