diff options
Diffstat (limited to 'src')
42 files changed, 594 insertions, 316 deletions
diff --git a/src/abe/Makefile.am b/src/abe/Makefile.am index 308e6c67c..23a7ae68e 100644 --- a/src/abe/Makefile.am +++ b/src/abe/Makefile.am | |||
@@ -7,9 +7,6 @@ libexecdir= $(pkglibdir)/libexec/ | |||
7 | 7 | ||
8 | pkgcfgdir= $(pkgdatadir)/config.d/ | 8 | pkgcfgdir= $(pkgdatadir)/config.d/ |
9 | 9 | ||
10 | dist_pkgcfg_DATA = \ | ||
11 | abe.conf | ||
12 | |||
13 | if USE_COVERAGE | 10 | if USE_COVERAGE |
14 | AM_CFLAGS = --coverage -O0 | 11 | AM_CFLAGS = --coverage -O0 |
15 | XLIB = -lgcov | 12 | XLIB = -lgcov |
diff --git a/src/cadet/cadet_api.c b/src/cadet/cadet_api.c index 497c9a4f0..6b07ab7b7 100644 --- a/src/cadet/cadet_api.c +++ b/src/cadet/cadet_api.c | |||
@@ -491,7 +491,7 @@ cadet_mq_send_impl (struct GNUNET_MQ_Handle *mq, | |||
491 | struct GNUNET_CADET_Handle *h = ch->cadet; | 491 | struct GNUNET_CADET_Handle *h = ch->cadet; |
492 | uint16_t msize; | 492 | uint16_t msize; |
493 | struct GNUNET_MQ_Envelope *env; | 493 | struct GNUNET_MQ_Envelope *env; |
494 | struct GNUNET_CADET_LocalData *cadet_msg; | 494 | struct GNUNET_CADET_LocalData *cadet_msg = NULL; |
495 | 495 | ||
496 | if (NULL == h->mq) | 496 | if (NULL == h->mq) |
497 | { | 497 | { |
@@ -638,7 +638,6 @@ handle_channel_created (void *cls, | |||
638 | ch = create_channel (h, | 638 | ch = create_channel (h, |
639 | &ccn); | 639 | &ccn); |
640 | ch->peer = msg->peer; | 640 | ch->peer = msg->peer; |
641 | ch->cadet = h; | ||
642 | ch->incoming_port = port; | 641 | ch->incoming_port = port; |
643 | ch->options = ntohl (msg->opt); | 642 | ch->options = ntohl (msg->opt); |
644 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 643 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
diff --git a/src/credential/test_credential_verify_simple.sh b/src/credential/test_credential_verify_simple.sh index c4fd8c7a3..bcb3f9877 100755 --- a/src/credential/test_credential_verify_simple.sh +++ b/src/credential/test_credential_verify_simple.sh | |||
@@ -31,17 +31,19 @@ CRED=`$DO_TIMEOUT gnunet-credential --issue --ego=testissuer --subject=$SUBJECT_ | |||
31 | TEST_CREDENTIAL="t1" | 31 | TEST_CREDENTIAL="t1" |
32 | gnunet-namestore -p -z testsubject -a -n $TEST_CREDENTIAL -t CRED -V "$CRED" -e 5m -c test_credential_lookup.conf | 32 | gnunet-namestore -p -z testsubject -a -n $TEST_CREDENTIAL -t CRED -V "$CRED" -e 5m -c test_credential_lookup.conf |
33 | 33 | ||
34 | CREDS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$ISSUER_KEY --attribute=$TEST_ATTR --ego=testsubject -c test_credential_lookup.conf | paste -d, -s` | ||
35 | |||
36 | |||
34 | #TODO2 Add -z swich like in gnunet-gns | 37 | #TODO2 Add -z swich like in gnunet-gns |
35 | #RES_CRED=`$DO_TIMEOUT gnunet-credential --verify --issuer=$ISSUER_KEY --attribute="$TEST_ATTR" --subject=$SUBJECT_KEY --credential=$TEST_CREDENTIAL -c test_credential_lookup.conf` | 38 | #RES_CRED=`$DO_TIMEOUT gnunet-credential --verify --issuer=$ISSUER_KEY --attribute="$TEST_ATTR" --subject=$SUBJECT_KEY --credential=$TEST_CREDENTIAL -c test_credential_lookup.conf` |
36 | RES_CRED=`gnunet-credential --verify --issuer=$ISSUER_KEY --attribute=$TEST_ATTR --subject=$SUBJECT_KEY --credential=$TEST_CREDENTIAL -c test_credential_lookup.conf` | 39 | RES_CRED=`gnunet-credential --verify --issuer=$ISSUER_KEY --attribute=$TEST_ATTR --subject=$SUBJECT_KEY --credential="$CREDS" -c test_credential_lookup.conf` |
37 | 40 | ||
38 | #TODO cleanup properly | 41 | #TODO cleanup properly |
39 | gnunet-namestore -z testsubject -d -n $TEST_CREDENTIAL -t CRED -e never -c test_credential_lookup.conf | 42 | gnunet-namestore -z testsubject -d -n $TEST_CREDENTIAL -t CRED -e never -c test_credential_lookup.conf |
40 | gnunet-identity -D testsubject -c test_credential_lookup.conf | 43 | gnunet-identity -D testsubject -c test_credential_lookup.conf |
41 | gnunet-arm -e -c test_credential_lookup.conf | 44 | gnunet-arm -e -c test_credential_lookup.conf |
42 | echo $RES_CRED | ||
43 | #TODO3 proper test | 45 | #TODO3 proper test |
44 | if [ "$RES_CRED" == "Successful." ] | 46 | if [ "$RES_CRED" != "Failed." ] |
45 | then | 47 | then |
46 | exit 0 | 48 | exit 0 |
47 | else | 49 | else |
diff --git a/src/curl/curl.c b/src/curl/curl.c index 6087cbddb..0a9fc5ffb 100644 --- a/src/curl/curl.c +++ b/src/curl/curl.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | Copyright (C) 2014, 2015, 2016 GNUnet e.V. | 3 | Copyright (C) 2014, 2015, 2016, 2018 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify it under the | 5 | GNUnet is free software; you can redistribute it and/or modify it under the |
6 | terms of the GNU General Public License as published by the Free Software | 6 | terms of the GNU General Public License as published by the Free Software |
@@ -466,6 +466,7 @@ GNUNET_CURL_perform (struct GNUNET_CURL_Context *ctx) | |||
466 | CURLINFO_PRIVATE, | 466 | CURLINFO_PRIVATE, |
467 | (char **) &job)); | 467 | (char **) &job)); |
468 | GNUNET_assert (job->ctx == ctx); | 468 | GNUNET_assert (job->ctx == ctx); |
469 | response_code = 0; | ||
469 | j = download_get_result (&job->db, | 470 | j = download_get_result (&job->db, |
470 | job->easy_handle, | 471 | job->easy_handle, |
471 | &response_code); | 472 | &response_code); |
diff --git a/src/datacache/plugin_datacache_postgres.c b/src/datacache/plugin_datacache_postgres.c index 2fe6498a5..2c233c4c2 100644 --- a/src/datacache/plugin_datacache_postgres.c +++ b/src/datacache/plugin_datacache_postgres.c | |||
@@ -538,6 +538,14 @@ extract_result_cb (void *cls, | |||
538 | GNUNET_PQ_result_spec_end | 538 | GNUNET_PQ_result_spec_end |
539 | }; | 539 | }; |
540 | 540 | ||
541 | if (GNUNET_YES != | ||
542 | GNUNET_PQ_extract_result (result, | ||
543 | rs, | ||
544 | i)) | ||
545 | { | ||
546 | GNUNET_break (0); | ||
547 | return; | ||
548 | } | ||
541 | if (0 != (path_len % sizeof (struct GNUNET_PeerIdentity))) | 549 | if (0 != (path_len % sizeof (struct GNUNET_PeerIdentity))) |
542 | { | 550 | { |
543 | GNUNET_break (0); | 551 | GNUNET_break (0); |
diff --git a/src/dns/dnsparser.c b/src/dns/dnsparser.c index 30d9245ff..1fe6f595f 100644 --- a/src/dns/dnsparser.c +++ b/src/dns/dnsparser.c | |||
@@ -1170,7 +1170,10 @@ GNUNET_DNSPARSER_pack (const struct GNUNET_DNSPARSER_Packet *p, | |||
1170 | trc = GNUNET_NO; | 1170 | trc = GNUNET_NO; |
1171 | for (i=0;i<p->num_queries;i++) | 1171 | for (i=0;i<p->num_queries;i++) |
1172 | { | 1172 | { |
1173 | ret = GNUNET_DNSPARSER_builder_add_query (tmp, sizeof (tmp), &off, &p->queries[i]); | 1173 | ret = GNUNET_DNSPARSER_builder_add_query (tmp, |
1174 | sizeof (tmp), | ||
1175 | &off, | ||
1176 | &p->queries[i]); | ||
1174 | if (GNUNET_SYSERR == ret) | 1177 | if (GNUNET_SYSERR == ret) |
1175 | return GNUNET_SYSERR; | 1178 | return GNUNET_SYSERR; |
1176 | if (GNUNET_NO == ret) | 1179 | if (GNUNET_NO == ret) |
@@ -1182,7 +1185,10 @@ GNUNET_DNSPARSER_pack (const struct GNUNET_DNSPARSER_Packet *p, | |||
1182 | } | 1185 | } |
1183 | for (i=0;i<p->num_answers;i++) | 1186 | for (i=0;i<p->num_answers;i++) |
1184 | { | 1187 | { |
1185 | ret = add_record (tmp, sizeof (tmp), &off, &p->answers[i]); | 1188 | ret = add_record (tmp, |
1189 | sizeof (tmp), | ||
1190 | &off, | ||
1191 | &p->answers[i]); | ||
1186 | if (GNUNET_SYSERR == ret) | 1192 | if (GNUNET_SYSERR == ret) |
1187 | return GNUNET_SYSERR; | 1193 | return GNUNET_SYSERR; |
1188 | if (GNUNET_NO == ret) | 1194 | if (GNUNET_NO == ret) |
@@ -1194,7 +1200,10 @@ GNUNET_DNSPARSER_pack (const struct GNUNET_DNSPARSER_Packet *p, | |||
1194 | } | 1200 | } |
1195 | for (i=0;i<p->num_authority_records;i++) | 1201 | for (i=0;i<p->num_authority_records;i++) |
1196 | { | 1202 | { |
1197 | ret = add_record (tmp, sizeof (tmp), &off, &p->authority_records[i]); | 1203 | ret = add_record (tmp, |
1204 | sizeof (tmp), | ||
1205 | &off, | ||
1206 | &p->authority_records[i]); | ||
1198 | if (GNUNET_SYSERR == ret) | 1207 | if (GNUNET_SYSERR == ret) |
1199 | return GNUNET_SYSERR; | 1208 | return GNUNET_SYSERR; |
1200 | if (GNUNET_NO == ret) | 1209 | if (GNUNET_NO == ret) |
@@ -1206,7 +1215,10 @@ GNUNET_DNSPARSER_pack (const struct GNUNET_DNSPARSER_Packet *p, | |||
1206 | } | 1215 | } |
1207 | for (i=0;i<p->num_additional_records;i++) | 1216 | for (i=0;i<p->num_additional_records;i++) |
1208 | { | 1217 | { |
1209 | ret = add_record (tmp, sizeof (tmp), &off, &p->additional_records[i]); | 1218 | ret = add_record (tmp, |
1219 | sizeof (tmp), | ||
1220 | &off, | ||
1221 | &p->additional_records[i]); | ||
1210 | if (GNUNET_SYSERR == ret) | 1222 | if (GNUNET_SYSERR == ret) |
1211 | return GNUNET_SYSERR; | 1223 | return GNUNET_SYSERR; |
1212 | if (GNUNET_NO == ret) | 1224 | if (GNUNET_NO == ret) |
@@ -1219,11 +1231,15 @@ GNUNET_DNSPARSER_pack (const struct GNUNET_DNSPARSER_Packet *p, | |||
1219 | 1231 | ||
1220 | if (GNUNET_YES == trc) | 1232 | if (GNUNET_YES == trc) |
1221 | dns.flags.message_truncated = 1; | 1233 | dns.flags.message_truncated = 1; |
1222 | GNUNET_memcpy (tmp, &dns, sizeof (struct GNUNET_TUN_DnsHeader)); | 1234 | GNUNET_memcpy (tmp, |
1235 | &dns, | ||
1236 | sizeof (struct GNUNET_TUN_DnsHeader)); | ||
1223 | 1237 | ||
1224 | *buf = GNUNET_malloc (off); | 1238 | *buf = GNUNET_malloc (off); |
1225 | *buf_length = off; | 1239 | *buf_length = off; |
1226 | GNUNET_memcpy (*buf, tmp, off); | 1240 | GNUNET_memcpy (*buf, |
1241 | tmp, | ||
1242 | off); | ||
1227 | if (GNUNET_YES == trc) | 1243 | if (GNUNET_YES == trc) |
1228 | return GNUNET_NO; | 1244 | return GNUNET_NO; |
1229 | return GNUNET_OK; | 1245 | return GNUNET_OK; |
diff --git a/src/fs/fs_dirmetascan.c b/src/fs/fs_dirmetascan.c index 8a3e37b49..e904b9092 100644 --- a/src/fs/fs_dirmetascan.c +++ b/src/fs/fs_dirmetascan.c | |||
@@ -211,9 +211,9 @@ expand_tree (struct GNUNET_FS_ShareTreeItem *parent, | |||
211 | chld->short_filename[slen-1] = '\0'; | 211 | chld->short_filename[slen-1] = '\0'; |
212 | chld->is_directory = is_directory; | 212 | chld->is_directory = is_directory; |
213 | if (NULL != parent) | 213 | if (NULL != parent) |
214 | GNUNET_CONTAINER_DLL_insert (parent->children_head, | 214 | GNUNET_CONTAINER_DLL_insert (parent->children_head, |
215 | parent->children_tail, | 215 | parent->children_tail, |
216 | chld); | 216 | chld); |
217 | return chld; | 217 | return chld; |
218 | } | 218 | } |
219 | 219 | ||
@@ -259,7 +259,8 @@ process_helper_msgs (void *cls, | |||
259 | size_t left; | 259 | size_t left; |
260 | 260 | ||
261 | #if 0 | 261 | #if 0 |
262 | fprintf (stderr, "DMS parses %u-byte message of type %u\n", | 262 | fprintf (stderr, |
263 | "DMS parses %u-byte message of type %u\n", | ||
263 | (unsigned int) ntohs (msg->size), | 264 | (unsigned int) ntohs (msg->size), |
264 | (unsigned int) ntohs (msg->type)); | 265 | (unsigned int) ntohs (msg->type)); |
265 | #endif | 266 | #endif |
@@ -277,11 +278,18 @@ process_helper_msgs (void *cls, | |||
277 | filename, GNUNET_NO, | 278 | filename, GNUNET_NO, |
278 | GNUNET_FS_DIRSCANNER_FILE_START); | 279 | GNUNET_FS_DIRSCANNER_FILE_START); |
279 | if (NULL == ds->toplevel) | 280 | if (NULL == ds->toplevel) |
281 | { | ||
280 | ds->toplevel = expand_tree (ds->pos, | 282 | ds->toplevel = expand_tree (ds->pos, |
281 | filename, GNUNET_NO); | 283 | filename, |
284 | GNUNET_NO); | ||
285 | } | ||
282 | else | 286 | else |
287 | { | ||
288 | GNUNET_assert (NULL != ds->pos); | ||
283 | (void) expand_tree (ds->pos, | 289 | (void) expand_tree (ds->pos, |
284 | filename, GNUNET_NO); | 290 | filename, |
291 | GNUNET_NO); | ||
292 | } | ||
285 | return GNUNET_OK; | 293 | return GNUNET_OK; |
286 | case GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_PROGRESS_DIRECTORY: | 294 | case GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_PROGRESS_DIRECTORY: |
287 | if (filename[left-1] != '\0') | 295 | if (filename[left-1] != '\0') |
@@ -303,7 +311,8 @@ process_helper_msgs (void *cls, | |||
303 | filename, GNUNET_YES, | 311 | filename, GNUNET_YES, |
304 | GNUNET_FS_DIRSCANNER_FILE_START); | 312 | GNUNET_FS_DIRSCANNER_FILE_START); |
305 | ds->pos = expand_tree (ds->pos, | 313 | ds->pos = expand_tree (ds->pos, |
306 | filename, GNUNET_YES); | 314 | filename, |
315 | GNUNET_YES); | ||
307 | if (NULL == ds->toplevel) | 316 | if (NULL == ds->toplevel) |
308 | ds->toplevel = ds->pos; | 317 | ds->toplevel = ds->pos; |
309 | return GNUNET_OK; | 318 | return GNUNET_OK; |
@@ -360,11 +369,13 @@ process_helper_msgs (void *cls, | |||
360 | break; | 369 | break; |
361 | } | 370 | } |
362 | ds->progress_callback (ds->progress_callback_cls, | 371 | ds->progress_callback (ds->progress_callback_cls, |
363 | filename, GNUNET_YES, | 372 | filename, |
373 | GNUNET_YES, | ||
364 | GNUNET_FS_DIRSCANNER_EXTRACT_FINISHED); | 374 | GNUNET_FS_DIRSCANNER_EXTRACT_FINISHED); |
365 | if (0 < left) | 375 | if (0 < left) |
366 | { | 376 | { |
367 | ds->pos->meta = GNUNET_CONTAINER_meta_data_deserialize (end, left); | 377 | ds->pos->meta = GNUNET_CONTAINER_meta_data_deserialize (end, |
378 | left); | ||
368 | if (NULL == ds->pos->meta) | 379 | if (NULL == ds->pos->meta) |
369 | { | 380 | { |
370 | GNUNET_break (0); | 381 | GNUNET_break (0); |
diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c index ce852f2d0..c2a3d4c5d 100644 --- a/src/fs/fs_download.c +++ b/src/fs/fs_download.c | |||
@@ -37,7 +37,8 @@ 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 == |
41 | GNUNET_FS_meta_data_test_for_directory (dc->meta)) || | ||
41 | ( (NULL == dc->meta) && | 42 | ( (NULL == dc->meta) && |
42 | ( (NULL == dc->filename) || | 43 | ( (NULL == dc->filename) || |
43 | ( (strlen (dc->filename) >= strlen (GNUNET_FS_DIRECTORY_EXT)) && | 44 | ( (strlen (dc->filename) >= strlen (GNUNET_FS_DIRECTORY_EXT)) && |
diff --git a/src/fs/gnunet-download.c b/src/fs/gnunet-download.c index 83c1eb505..27266a18a 100644 --- a/src/fs/gnunet-download.c +++ b/src/fs/gnunet-download.c | |||
@@ -124,7 +124,8 @@ display_bar (unsigned long long x, | |||
124 | * field in the `struct GNUNET_FS_ProgressInfo` | 124 | * field in the `struct GNUNET_FS_ProgressInfo` |
125 | */ | 125 | */ |
126 | static void * | 126 | static void * |
127 | progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info) | 127 | progress_cb (void *cls, |
128 | const struct GNUNET_FS_ProgressInfo *info) | ||
128 | { | 129 | { |
129 | char *s; | 130 | char *s; |
130 | const char *s2; | 131 | const char *s2; |
@@ -134,7 +135,8 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info) | |||
134 | { | 135 | { |
135 | case GNUNET_FS_STATUS_DOWNLOAD_START: | 136 | case GNUNET_FS_STATUS_DOWNLOAD_START: |
136 | if (verbose > 1) | 137 | if (verbose > 1) |
137 | FPRINTF (stderr, _("Starting download `%s'.\n"), | 138 | FPRINTF (stderr, |
139 | _("Starting download `%s'.\n"), | ||
138 | info->value.download.filename); | 140 | info->value.download.filename); |
139 | break; | 141 | break; |
140 | case GNUNET_FS_STATUS_DOWNLOAD_PROGRESS: | 142 | case GNUNET_FS_STATUS_DOWNLOAD_PROGRESS: |
@@ -146,8 +148,7 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info) | |||
146 | == GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us) | 148 | == GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us) |
147 | s2 = _("<unknown time>"); | 149 | s2 = _("<unknown time>"); |
148 | else | 150 | else |
149 | s2 = GNUNET_STRINGS_relative_time_to_string ( | 151 | s2 = GNUNET_STRINGS_relative_time_to_string (info->value.download.specifics.progress.block_download_duration, |
150 | info->value.download.specifics.progress.block_download_duration, | ||
151 | GNUNET_YES); | 152 | GNUNET_YES); |
152 | t = GNUNET_STRINGS_byte_size_fancy (info->value.download.completed * | 153 | t = GNUNET_STRINGS_byte_size_fancy (info->value.download.completed * |
153 | 1000LL / | 154 | 1000LL / |
@@ -157,7 +158,10 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info) | |||
157 | _("Downloading `%s' at %llu/%llu (%s remaining, %s/s). Block took %s to download\n"), | 158 | _("Downloading `%s' at %llu/%llu (%s remaining, %s/s). Block took %s to download\n"), |
158 | info->value.download.filename, | 159 | info->value.download.filename, |
159 | (unsigned long long) info->value.download.completed, | 160 | (unsigned long long) info->value.download.completed, |
160 | (unsigned long long) info->value.download.size, s, t, s2); | 161 | (unsigned long long) info->value.download.size, |
162 | s, | ||
163 | t, | ||
164 | s2); | ||
161 | GNUNET_free (s); | 165 | GNUNET_free (s); |
162 | GNUNET_free (t); | 166 | GNUNET_free (t); |
163 | } | 167 | } |
@@ -173,7 +177,8 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info) | |||
173 | if (0 != isatty (1)) | 177 | if (0 != isatty (1)) |
174 | fprintf (stdout, "\n"); | 178 | fprintf (stdout, "\n"); |
175 | #else | 179 | #else |
176 | if (FILE_TYPE_CHAR == GetFileType (GetStdHandle (STD_OUTPUT_HANDLE))) | 180 | if (FILE_TYPE_CHAR == |
181 | GetFileType (GetStdHandle (STD_OUTPUT_HANDLE))) | ||
177 | fprintf (stdout, "\n"); | 182 | fprintf (stdout, "\n"); |
178 | #endif | 183 | #endif |
179 | FPRINTF (stderr, _("Error downloading: %s.\n"), | 184 | FPRINTF (stderr, _("Error downloading: %s.\n"), |
@@ -188,10 +193,12 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info) | |||
188 | if (0 != isatty (1)) | 193 | if (0 != isatty (1)) |
189 | fprintf (stdout, "\n"); | 194 | fprintf (stdout, "\n"); |
190 | #else | 195 | #else |
191 | if (FILE_TYPE_CHAR == GetFileType (GetStdHandle (STD_OUTPUT_HANDLE))) | 196 | if (FILE_TYPE_CHAR == |
197 | GetFileType (GetStdHandle (STD_OUTPUT_HANDLE))) | ||
192 | fprintf (stdout, "\n"); | 198 | fprintf (stdout, "\n"); |
193 | #endif | 199 | #endif |
194 | FPRINTF (stdout, _("Downloading `%s' done (%s/s).\n"), | 200 | FPRINTF (stdout, |
201 | _("Downloading `%s' done (%s/s).\n"), | ||
195 | info->value.download.filename, s); | 202 | info->value.download.filename, s); |
196 | GNUNET_free (s); | 203 | GNUNET_free (s); |
197 | if (info->value.download.dc == dc) | 204 | if (info->value.download.dc == dc) |
@@ -205,7 +212,9 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info) | |||
205 | case GNUNET_FS_STATUS_DOWNLOAD_INACTIVE: | 212 | case GNUNET_FS_STATUS_DOWNLOAD_INACTIVE: |
206 | break; | 213 | break; |
207 | default: | 214 | default: |
208 | FPRINTF (stderr, _("Unexpected status: %d\n"), info->status); | 215 | FPRINTF (stderr, |
216 | _("Unexpected status: %d\n"), | ||
217 | info->status); | ||
209 | break; | 218 | break; |
210 | } | 219 | } |
211 | return NULL; | 220 | return NULL; |
@@ -221,7 +230,9 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info) | |||
221 | * @param c configuration | 230 | * @param c configuration |
222 | */ | 231 | */ |
223 | static void | 232 | static void |
224 | run (void *cls, char *const *args, const char *cfgfile, | 233 | run (void *cls, |
234 | char *const *args, | ||
235 | const char *cfgfile, | ||
225 | const struct GNUNET_CONFIGURATION_Handle *c) | 236 | const struct GNUNET_CONFIGURATION_Handle *c) |
226 | { | 237 | { |
227 | struct GNUNET_FS_Uri *uri; | 238 | struct GNUNET_FS_Uri *uri; |
@@ -230,41 +241,55 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
230 | 241 | ||
231 | if (NULL == args[0]) | 242 | if (NULL == args[0]) |
232 | { | 243 | { |
233 | FPRINTF (stderr, "%s", _("You need to specify a URI argument.\n")); | 244 | FPRINTF (stderr, |
245 | "%s", | ||
246 | _("You need to specify a URI argument.\n")); | ||
234 | return; | 247 | return; |
235 | } | 248 | } |
236 | uri = GNUNET_FS_uri_parse (args[0], &emsg); | 249 | uri = GNUNET_FS_uri_parse (args[0], &emsg); |
237 | if (NULL == uri) | 250 | if (NULL == uri) |
238 | { | 251 | { |
239 | FPRINTF (stderr, _("Failed to parse URI: %s\n"), emsg); | 252 | FPRINTF (stderr, |
253 | _("Failed to parse URI: %s\n"), | ||
254 | emsg); | ||
240 | GNUNET_free (emsg); | 255 | GNUNET_free (emsg); |
241 | ret = 1; | 256 | ret = 1; |
242 | return; | 257 | return; |
243 | } | 258 | } |
244 | if ((!GNUNET_FS_uri_test_chk (uri)) && (!GNUNET_FS_uri_test_loc (uri))) | 259 | if ( (! GNUNET_FS_uri_test_chk (uri)) && |
260 | (! GNUNET_FS_uri_test_loc (uri))) | ||
245 | { | 261 | { |
246 | FPRINTF (stderr, "%s", _("Only CHK or LOC URIs supported.\n")); | 262 | FPRINTF (stderr, |
263 | "%s", | ||
264 | _("Only CHK or LOC URIs supported.\n")); | ||
247 | ret = 1; | 265 | ret = 1; |
248 | GNUNET_FS_uri_destroy (uri); | 266 | GNUNET_FS_uri_destroy (uri); |
249 | return; | 267 | return; |
250 | } | 268 | } |
251 | if (NULL == filename) | 269 | if (NULL == filename) |
252 | { | 270 | { |
253 | FPRINTF (stderr, "%s", _("Target filename must be specified.\n")); | 271 | FPRINTF (stderr, |
272 | "%s", | ||
273 | _("Target filename must be specified.\n")); | ||
254 | ret = 1; | 274 | ret = 1; |
255 | GNUNET_FS_uri_destroy (uri); | 275 | GNUNET_FS_uri_destroy (uri); |
256 | return; | 276 | return; |
257 | } | 277 | } |
258 | cfg = c; | 278 | cfg = c; |
259 | ctx = | 279 | ctx = GNUNET_FS_start (cfg, |
260 | GNUNET_FS_start (cfg, "gnunet-download", &progress_cb, NULL, | 280 | "gnunet-download", |
261 | GNUNET_FS_FLAGS_NONE, | 281 | &progress_cb, NULL, |
262 | GNUNET_FS_OPTIONS_DOWNLOAD_PARALLELISM, parallelism, | 282 | GNUNET_FS_FLAGS_NONE, |
263 | GNUNET_FS_OPTIONS_REQUEST_PARALLELISM, | 283 | GNUNET_FS_OPTIONS_DOWNLOAD_PARALLELISM, |
264 | request_parallelism, GNUNET_FS_OPTIONS_END); | 284 | parallelism, |
285 | GNUNET_FS_OPTIONS_REQUEST_PARALLELISM, | ||
286 | request_parallelism, | ||
287 | GNUNET_FS_OPTIONS_END); | ||
265 | if (NULL == ctx) | 288 | if (NULL == ctx) |
266 | { | 289 | { |
267 | FPRINTF (stderr, _("Could not initialize `%s' subsystem.\n"), "FS"); | 290 | FPRINTF (stderr, |
291 | _("Could not initialize `%s' subsystem.\n"), | ||
292 | "FS"); | ||
268 | GNUNET_FS_uri_destroy (uri); | 293 | GNUNET_FS_uri_destroy (uri); |
269 | ret = 1; | 294 | ret = 1; |
270 | return; | 295 | return; |
@@ -274,9 +299,17 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
274 | options |= GNUNET_FS_DOWNLOAD_OPTION_RECURSIVE; | 299 | options |= GNUNET_FS_DOWNLOAD_OPTION_RECURSIVE; |
275 | if (local_only) | 300 | if (local_only) |
276 | options |= GNUNET_FS_DOWNLOAD_OPTION_LOOPBACK_ONLY; | 301 | options |= GNUNET_FS_DOWNLOAD_OPTION_LOOPBACK_ONLY; |
277 | dc = GNUNET_FS_download_start (ctx, uri, NULL, filename, NULL, 0, | 302 | dc = GNUNET_FS_download_start (ctx, |
303 | uri, | ||
304 | NULL, | ||
305 | filename, | ||
306 | NULL, | ||
307 | 0, | ||
278 | GNUNET_FS_uri_chk_get_file_size (uri), | 308 | GNUNET_FS_uri_chk_get_file_size (uri), |
279 | anonymity, options, NULL, NULL); | 309 | anonymity, |
310 | options, | ||
311 | NULL, | ||
312 | NULL); | ||
280 | GNUNET_FS_uri_destroy (uri); | 313 | GNUNET_FS_uri_destroy (uri); |
281 | if (dc == NULL) | 314 | if (dc == NULL) |
282 | { | 315 | { |
@@ -301,60 +334,58 @@ main (int argc, char *const *argv) | |||
301 | { | 334 | { |
302 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 335 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
303 | GNUNET_GETOPT_option_uint ('a', | 336 | GNUNET_GETOPT_option_uint ('a', |
304 | "anonymity", | 337 | "anonymity", |
305 | "LEVEL", | 338 | "LEVEL", |
306 | gettext_noop ("set the desired LEVEL of receiver-anonymity"), | 339 | gettext_noop ("set the desired LEVEL of receiver-anonymity"), |
307 | &anonymity), | 340 | &anonymity), |
308 | 341 | ||
309 | GNUNET_GETOPT_option_flag ('D', | 342 | GNUNET_GETOPT_option_flag ('D', |
310 | "delete-incomplete", | 343 | "delete-incomplete", |
311 | gettext_noop ("delete incomplete downloads (when aborted with CTRL-C)"), | 344 | gettext_noop ("delete incomplete downloads (when aborted with CTRL-C)"), |
312 | &delete_incomplete), | 345 | &delete_incomplete), |
313 | 346 | ||
314 | GNUNET_GETOPT_option_flag ('n', | 347 | GNUNET_GETOPT_option_flag ('n', |
315 | "no-network", | 348 | "no-network", |
316 | gettext_noop ("only search the local peer (no P2P network search)"), | 349 | gettext_noop ("only search the local peer (no P2P network search)"), |
317 | &local_only), | 350 | &local_only), |
318 | |||
319 | GNUNET_GETOPT_option_string ('o', | 351 | GNUNET_GETOPT_option_string ('o', |
320 | "output", | 352 | "output", |
321 | "FILENAME", | 353 | "FILENAME", |
322 | gettext_noop ("write the file to FILENAME"), | 354 | gettext_noop ("write the file to FILENAME"), |
323 | &filename), | 355 | &filename), |
324 | |||
325 | GNUNET_GETOPT_option_uint ('p', | 356 | GNUNET_GETOPT_option_uint ('p', |
326 | "parallelism", | 357 | "parallelism", |
327 | "DOWNLOADS", | 358 | "DOWNLOADS", |
328 | gettext_noop ("set the maximum number of parallel downloads that is allowed"), | 359 | gettext_noop ("set the maximum number of parallel downloads that is allowed"), |
329 | ¶llelism), | 360 | ¶llelism), |
330 | |||
331 | GNUNET_GETOPT_option_uint ('r', | 361 | GNUNET_GETOPT_option_uint ('r', |
332 | "request-parallelism", | 362 | "request-parallelism", |
333 | "REQUESTS", | 363 | "REQUESTS", |
334 | gettext_noop ("set the maximum number of parallel requests for blocks that is allowed"), | 364 | gettext_noop ("set the maximum number of parallel requests for blocks that is allowed"), |
335 | &request_parallelism), | 365 | &request_parallelism), |
336 | |||
337 | GNUNET_GETOPT_option_flag ('R', | 366 | GNUNET_GETOPT_option_flag ('R', |
338 | "recursive", | 367 | "recursive", |
339 | gettext_noop ("download a GNUnet directory recursively"), | 368 | gettext_noop ("download a GNUnet directory recursively"), |
340 | &do_recursive), | 369 | &do_recursive), |
341 | |||
342 | GNUNET_GETOPT_option_increment_uint ('V', | 370 | GNUNET_GETOPT_option_increment_uint ('V', |
343 | "verbose", | 371 | "verbose", |
344 | gettext_noop ("be verbose (print progress information)"), | 372 | gettext_noop ("be verbose (print progress information)"), |
345 | &verbose), | 373 | &verbose), |
346 | |||
347 | GNUNET_GETOPT_OPTION_END | 374 | GNUNET_GETOPT_OPTION_END |
348 | }; | 375 | }; |
349 | 376 | ||
350 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) | 377 | if (GNUNET_OK != |
378 | GNUNET_STRINGS_get_utf8_args (argc, argv, | ||
379 | &argc, &argv)) | ||
351 | return 2; | 380 | return 2; |
352 | 381 | ||
353 | ret = (GNUNET_OK == | 382 | ret = (GNUNET_OK == |
354 | GNUNET_PROGRAM_run (argc, argv, "gnunet-download [OPTIONS] URI", | 383 | GNUNET_PROGRAM_run (argc, argv, |
384 | "gnunet-download [OPTIONS] URI", | ||
355 | gettext_noop | 385 | gettext_noop |
356 | ("Download files from GNUnet using a GNUnet CHK or LOC URI (gnunet://fs/chk/...)"), | 386 | ("Download files from GNUnet using a GNUnet CHK or LOC URI (gnunet://fs/chk/...)"), |
357 | options, &run, NULL)) ? ret : 1; | 387 | options, |
388 | &run, NULL)) ? ret : 1; | ||
358 | GNUNET_free ((void*) argv); | 389 | GNUNET_free ((void*) argv); |
359 | return ret; | 390 | return ret; |
360 | } | 391 | } |
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index c58190599..5bf443267 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c | |||
@@ -327,7 +327,7 @@ struct GNS_ResolverHandle | |||
327 | /** | 327 | /** |
328 | * ID of a task associated with the resolution process. | 328 | * ID of a task associated with the resolution process. |
329 | */ | 329 | */ |
330 | struct GNUNET_SCHEDULER_Task * task_id; | 330 | struct GNUNET_SCHEDULER_Task *task_id; |
331 | 331 | ||
332 | /** | 332 | /** |
333 | * The name to resolve | 333 | * The name to resolve |
@@ -658,6 +658,8 @@ resolver_lookup_get_next_label (struct GNS_ResolverHandle *rh) | |||
658 | } | 658 | } |
659 | rh->protocol = pe->p_proto; | 659 | rh->protocol = pe->p_proto; |
660 | rh->service = se->s_port; | 660 | rh->service = se->s_port; |
661 | GNUNET_free (proto_name); | ||
662 | GNUNET_free (srv_name); | ||
661 | } | 663 | } |
662 | return ret; | 664 | return ret; |
663 | } | 665 | } |
@@ -806,10 +808,10 @@ recursive_resolution (void *cls); | |||
806 | * Begin the resolution process from 'name', starting with | 808 | * Begin the resolution process from 'name', starting with |
807 | * the identification of the zone specified by 'name'. | 809 | * the identification of the zone specified by 'name'. |
808 | * | 810 | * |
809 | * @param rh resolution to perform | 811 | * @param cls closure with `struct GNS_ResolverHandle *rh` |
810 | */ | 812 | */ |
811 | static void | 813 | static void |
812 | start_resolver_lookup (struct GNS_ResolverHandle *rh); | 814 | start_resolver_lookup (void *cls); |
813 | 815 | ||
814 | 816 | ||
815 | /** | 817 | /** |
@@ -833,6 +835,7 @@ dns_result_parser (void *cls, | |||
833 | unsigned int rd_count; | 835 | unsigned int rd_count; |
834 | unsigned int i; | 836 | unsigned int i; |
835 | 837 | ||
838 | (void) rs; | ||
836 | rh->dns_request = NULL; | 839 | rh->dns_request = NULL; |
837 | GNUNET_SCHEDULER_cancel (rh->task_id); | 840 | GNUNET_SCHEDULER_cancel (rh->task_id); |
838 | rh->task_id = NULL; | 841 | rh->task_id = NULL; |
@@ -857,7 +860,8 @@ dns_result_parser (void *cls, | |||
857 | GNUNET_free (rh->name); | 860 | GNUNET_free (rh->name); |
858 | rh->name = GNUNET_strdup (p->answers[0].data.hostname); | 861 | rh->name = GNUNET_strdup (p->answers[0].data.hostname); |
859 | rh->name_resolution_pos = strlen (rh->name); | 862 | rh->name_resolution_pos = strlen (rh->name); |
860 | start_resolver_lookup (rh); | 863 | rh->task_id = GNUNET_SCHEDULER_add_now (&start_resolver_lookup, |
864 | rh); | ||
861 | GNUNET_DNSPARSER_free_packet (p); | 865 | GNUNET_DNSPARSER_free_packet (p); |
862 | return; | 866 | return; |
863 | } | 867 | } |
@@ -1017,6 +1021,7 @@ recursive_dns_resolution (struct GNS_ResolverHandle *rh) | |||
1017 | struct GNUNET_DNSPARSER_Packet *p; | 1021 | struct GNUNET_DNSPARSER_Packet *p; |
1018 | char *dns_request; | 1022 | char *dns_request; |
1019 | size_t dns_request_length; | 1023 | size_t dns_request_length; |
1024 | int ret; | ||
1020 | 1025 | ||
1021 | ac = rh->ac_tail; | 1026 | ac = rh->ac_tail; |
1022 | GNUNET_assert (NULL != ac); | 1027 | GNUNET_assert (NULL != ac); |
@@ -1049,11 +1054,16 @@ recursive_dns_resolution (struct GNS_ResolverHandle *rh) | |||
1049 | UINT16_MAX); | 1054 | UINT16_MAX); |
1050 | p->flags.opcode = GNUNET_TUN_DNS_OPCODE_QUERY; | 1055 | p->flags.opcode = GNUNET_TUN_DNS_OPCODE_QUERY; |
1051 | p->flags.recursion_desired = 1; | 1056 | p->flags.recursion_desired = 1; |
1052 | if (GNUNET_OK != | 1057 | ret = GNUNET_DNSPARSER_pack (p, |
1053 | GNUNET_DNSPARSER_pack (p, 1024, &dns_request, &dns_request_length)) | 1058 | 1024, |
1059 | &dns_request, | ||
1060 | &dns_request_length); | ||
1061 | if (GNUNET_OK != ret) | ||
1054 | { | 1062 | { |
1055 | GNUNET_break (0); | 1063 | GNUNET_break (0); |
1056 | rh->proc (rh->proc_cls, 0, NULL); | 1064 | rh->proc (rh->proc_cls, |
1065 | 0, | ||
1066 | NULL); | ||
1057 | GNS_resolver_lookup_cancel (rh); | 1067 | GNS_resolver_lookup_cancel (rh); |
1058 | } | 1068 | } |
1059 | else | 1069 | else |
@@ -1069,7 +1079,8 @@ recursive_dns_resolution (struct GNS_ResolverHandle *rh) | |||
1069 | &fail_resolution, | 1079 | &fail_resolution, |
1070 | rh); | 1080 | rh); |
1071 | } | 1081 | } |
1072 | GNUNET_free (dns_request); | 1082 | if (GNUNET_SYSERR != ret) |
1083 | GNUNET_free (dns_request); | ||
1073 | GNUNET_DNSPARSER_free_packet (p); | 1084 | GNUNET_DNSPARSER_free_packet (p); |
1074 | } | 1085 | } |
1075 | 1086 | ||
@@ -1132,7 +1143,8 @@ handle_gns_cname_result (struct GNS_ResolverHandle *rh, | |||
1132 | GNUNET_free (rh->name); | 1143 | GNUNET_free (rh->name); |
1133 | rh->name = GNUNET_strdup (cname); | 1144 | rh->name = GNUNET_strdup (cname); |
1134 | rh->name_resolution_pos = strlen (rh->name); | 1145 | rh->name_resolution_pos = strlen (rh->name); |
1135 | start_resolver_lookup (rh); | 1146 | rh->task_id = GNUNET_SCHEDULER_add_now (&start_resolver_lookup, |
1147 | rh); | ||
1136 | } | 1148 | } |
1137 | 1149 | ||
1138 | 1150 | ||
@@ -1460,10 +1472,10 @@ handle_gns_resolution_result (void *cls, | |||
1460 | vpn_ctx->rd_data = GNUNET_malloc (vpn_ctx->rd_data_size); | 1472 | vpn_ctx->rd_data = GNUNET_malloc (vpn_ctx->rd_data_size); |
1461 | vpn_ctx->rd_count = rd_count; | 1473 | vpn_ctx->rd_count = rd_count; |
1462 | GNUNET_assert (vpn_ctx->rd_data_size == | 1474 | GNUNET_assert (vpn_ctx->rd_data_size == |
1463 | GNUNET_GNSRECORD_records_serialize (rd_count, | 1475 | (size_t) GNUNET_GNSRECORD_records_serialize (rd_count, |
1464 | rd, | 1476 | rd, |
1465 | vpn_ctx->rd_data_size, | 1477 | vpn_ctx->rd_data_size, |
1466 | vpn_ctx->rd_data)); | 1478 | vpn_ctx->rd_data)); |
1467 | vpn_ctx->vpn_request = GNUNET_VPN_redirect_to_peer (vpn_handle, | 1479 | vpn_ctx->vpn_request = GNUNET_VPN_redirect_to_peer (vpn_handle, |
1468 | af, | 1480 | af, |
1469 | ntohs (vpn->proto), | 1481 | ntohs (vpn->proto), |
@@ -1830,7 +1842,9 @@ handle_gns_resolution_result (void *cls, | |||
1830 | g2dc->rh->options = GNUNET_GNS_LO_DEFAULT; | 1842 | g2dc->rh->options = GNUNET_GNS_LO_DEFAULT; |
1831 | g2dc->rh->loop_limiter = rh->loop_limiter + 1; | 1843 | g2dc->rh->loop_limiter = rh->loop_limiter + 1; |
1832 | rh->g2dc = g2dc; | 1844 | rh->g2dc = g2dc; |
1833 | start_resolver_lookup (g2dc->rh); | 1845 | g2dc->rh->task_id |
1846 | = GNUNET_SCHEDULER_add_now (&start_resolver_lookup, | ||
1847 | g2dc->rh); | ||
1834 | return; | 1848 | return; |
1835 | } | 1849 | } |
1836 | case GNUNET_DNSPARSER_TYPE_CNAME: | 1850 | case GNUNET_DNSPARSER_TYPE_CNAME: |
@@ -1884,7 +1898,7 @@ namecache_cache_continuation (void *cls, | |||
1884 | struct CacheOps *co = cls; | 1898 | struct CacheOps *co = cls; |
1885 | 1899 | ||
1886 | co->namecache_qe_cache = NULL; | 1900 | co->namecache_qe_cache = NULL; |
1887 | if (NULL != emsg) | 1901 | if (GNUNET_OK != success) |
1888 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1902 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
1889 | _("Failed to cache GNS resolution: %s\n"), | 1903 | _("Failed to cache GNS resolution: %s\n"), |
1890 | emsg); | 1904 | emsg); |
@@ -1921,13 +1935,21 @@ handle_dht_response (void *cls, | |||
1921 | const struct GNUNET_PeerIdentity *put_path, | 1935 | const struct GNUNET_PeerIdentity *put_path, |
1922 | unsigned int put_path_length, | 1936 | unsigned int put_path_length, |
1923 | enum GNUNET_BLOCK_Type type, | 1937 | enum GNUNET_BLOCK_Type type, |
1924 | size_t size, const void *data) | 1938 | size_t size, |
1939 | const void *data) | ||
1925 | { | 1940 | { |
1926 | struct GNS_ResolverHandle *rh = cls; | 1941 | struct GNS_ResolverHandle *rh = cls; |
1927 | struct AuthorityChain *ac = rh->ac_tail; | 1942 | struct AuthorityChain *ac = rh->ac_tail; |
1928 | const struct GNUNET_GNSRECORD_Block *block; | 1943 | const struct GNUNET_GNSRECORD_Block *block; |
1929 | struct CacheOps *co; | 1944 | struct CacheOps *co; |
1930 | 1945 | ||
1946 | (void) exp; | ||
1947 | (void) key; | ||
1948 | (void) get_path; | ||
1949 | (void) get_path_length; | ||
1950 | (void) put_path; | ||
1951 | (void) put_path_length; | ||
1952 | (void) type; | ||
1931 | GNUNET_DHT_get_stop (rh->get_handle); | 1953 | GNUNET_DHT_get_stop (rh->get_handle); |
1932 | rh->get_handle = NULL; | 1954 | rh->get_handle = NULL; |
1933 | GNUNET_CONTAINER_heap_remove_node (rh->dht_heap_node); | 1955 | GNUNET_CONTAINER_heap_remove_node (rh->dht_heap_node); |
@@ -2230,16 +2252,18 @@ recursive_resolution (void *cls) | |||
2230 | * Begin the resolution process from 'name', starting with | 2252 | * Begin the resolution process from 'name', starting with |
2231 | * the identification of the zone specified by 'name'. | 2253 | * the identification of the zone specified by 'name'. |
2232 | * | 2254 | * |
2233 | * @param rh resolution to perform | 2255 | * @param cls the `struct GNS_ResolverHandle` |
2234 | */ | 2256 | */ |
2235 | static void | 2257 | static void |
2236 | start_resolver_lookup (struct GNS_ResolverHandle *rh) | 2258 | start_resolver_lookup (void *cls) |
2237 | { | 2259 | { |
2260 | struct GNS_ResolverHandle *rh = cls; | ||
2238 | struct AuthorityChain *ac; | 2261 | struct AuthorityChain *ac; |
2239 | char *y; | 2262 | char *y; |
2240 | struct in_addr v4; | 2263 | struct in_addr v4; |
2241 | struct in6_addr v6; | 2264 | struct in6_addr v6; |
2242 | 2265 | ||
2266 | rh->task_id = NULL; | ||
2243 | if (1 == inet_pton (AF_INET, | 2267 | if (1 == inet_pton (AF_INET, |
2244 | rh->name, | 2268 | rh->name, |
2245 | &v4)) | 2269 | &v4)) |
@@ -2360,7 +2384,8 @@ GNS_resolver_lookup (const struct GNUNET_CRYPTO_EcdsaPublicKey *zone, | |||
2360 | uint32_t record_type, | 2384 | uint32_t record_type, |
2361 | const char *name, | 2385 | const char *name, |
2362 | enum GNUNET_GNS_LocalOptions options, | 2386 | enum GNUNET_GNS_LocalOptions options, |
2363 | GNS_ResultProcessor proc, void *proc_cls) | 2387 | GNS_ResultProcessor proc, |
2388 | void *proc_cls) | ||
2364 | { | 2389 | { |
2365 | struct GNS_ResolverHandle *rh; | 2390 | struct GNS_ResolverHandle *rh; |
2366 | 2391 | ||
@@ -2378,7 +2403,8 @@ GNS_resolver_lookup (const struct GNUNET_CRYPTO_EcdsaPublicKey *zone, | |||
2378 | rh->record_type = record_type; | 2403 | rh->record_type = record_type; |
2379 | rh->name = GNUNET_strdup (name); | 2404 | rh->name = GNUNET_strdup (name); |
2380 | rh->name_resolution_pos = strlen (name); | 2405 | rh->name_resolution_pos = strlen (name); |
2381 | start_resolver_lookup (rh); | 2406 | rh->task_id = GNUNET_SCHEDULER_add_now (&start_resolver_lookup, |
2407 | rh); | ||
2382 | return rh; | 2408 | return rh; |
2383 | } | 2409 | } |
2384 | 2410 | ||
diff --git a/src/identity-provider/gnunet-service-identity-provider.c b/src/identity-provider/gnunet-service-identity-provider.c index 4e1de36cd..711ae76ce 100644 --- a/src/identity-provider/gnunet-service-identity-provider.c +++ b/src/identity-provider/gnunet-service-identity-provider.c | |||
@@ -95,11 +95,6 @@ static struct GNUNET_GNS_Handle *gns_handle; | |||
95 | static struct GNUNET_CREDENTIAL_Handle *credential_handle; | 95 | static struct GNUNET_CREDENTIAL_Handle *credential_handle; |
96 | 96 | ||
97 | /** | 97 | /** |
98 | * Stats handle | ||
99 | */ | ||
100 | static struct GNUNET_STATISTICS_Handle *stats_handle; | ||
101 | |||
102 | /** | ||
103 | * Namestore qe | 98 | * Namestore qe |
104 | */ | 99 | */ |
105 | static struct GNUNET_NAMESTORE_QueueEntry *ns_qe; | 100 | static struct GNUNET_NAMESTORE_QueueEntry *ns_qe; |
@@ -635,8 +630,6 @@ cleanup() | |||
635 | GNUNET_NAMESTORE_cancel (ns_qe); | 630 | GNUNET_NAMESTORE_cancel (ns_qe); |
636 | if (NULL != ns_handle) | 631 | if (NULL != ns_handle) |
637 | GNUNET_NAMESTORE_disconnect (ns_handle); | 632 | GNUNET_NAMESTORE_disconnect (ns_handle); |
638 | if (NULL != stats_handle) | ||
639 | GNUNET_STATISTICS_destroy (stats_handle, GNUNET_NO); | ||
640 | GNUNET_free_non_null (token); | 633 | GNUNET_free_non_null (token); |
641 | GNUNET_free_non_null (label); | 634 | GNUNET_free_non_null (label); |
642 | 635 | ||
@@ -1553,11 +1546,11 @@ process_parallel_lookup2 (void *cls, uint32_t rd_count, | |||
1553 | parallel_lookup); | 1546 | parallel_lookup); |
1554 | GNUNET_free (parallel_lookup->label); | 1547 | GNUNET_free (parallel_lookup->label); |
1555 | 1548 | ||
1556 | GNUNET_STATISTICS_update (stats_handle, | 1549 | GNUNET_STATISTICS_update (stats, |
1557 | "attribute_lookup_time_total", | 1550 | "attribute_lookup_time_total", |
1558 | GNUNET_TIME_absolute_get_duration (parallel_lookup->lookup_start_time).rel_value_us, | 1551 | GNUNET_TIME_absolute_get_duration (parallel_lookup->lookup_start_time).rel_value_us, |
1559 | GNUNET_YES); | 1552 | GNUNET_YES); |
1560 | GNUNET_STATISTICS_update (stats_handle, | 1553 | GNUNET_STATISTICS_update (stats, |
1561 | "attribute_lookups_count", | 1554 | "attribute_lookups_count", |
1562 | 1, | 1555 | 1, |
1563 | GNUNET_YES); | 1556 | GNUNET_YES); |
@@ -1575,11 +1568,11 @@ process_parallel_lookup2 (void *cls, uint32_t rd_count, | |||
1575 | (void**)&data); | 1568 | (void**)&data); |
1576 | if (GNUNET_SYSERR != attr_len) | 1569 | if (GNUNET_SYSERR != attr_len) |
1577 | { | 1570 | { |
1578 | GNUNET_STATISTICS_update (stats_handle, | 1571 | GNUNET_STATISTICS_update (stats, |
1579 | "abe_decrypt_time_total", | 1572 | "abe_decrypt_time_total", |
1580 | GNUNET_TIME_absolute_get_duration (decrypt_duration).rel_value_us, | 1573 | GNUNET_TIME_absolute_get_duration (decrypt_duration).rel_value_us, |
1581 | GNUNET_YES); | 1574 | GNUNET_YES); |
1582 | GNUNET_STATISTICS_update (stats_handle, | 1575 | GNUNET_STATISTICS_update (stats, |
1583 | "abe_decrypt_count", | 1576 | "abe_decrypt_count", |
1584 | 1, | 1577 | 1, |
1585 | GNUNET_YES); | 1578 | GNUNET_YES); |
@@ -1700,11 +1693,11 @@ process_consume_abe_key (void *cls, uint32_t rd_count, | |||
1700 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1693 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1701 | "Decrypted bytes: %zd Expected bytes: %zd\n", | 1694 | "Decrypted bytes: %zd Expected bytes: %zd\n", |
1702 | size, rd->data_size - sizeof (struct GNUNET_CRYPTO_EcdhePublicKey)); | 1695 | size, rd->data_size - sizeof (struct GNUNET_CRYPTO_EcdhePublicKey)); |
1703 | GNUNET_STATISTICS_update (stats_handle, | 1696 | GNUNET_STATISTICS_update (stats, |
1704 | "abe_key_lookup_time_total", | 1697 | "abe_key_lookup_time_total", |
1705 | GNUNET_TIME_absolute_get_duration (handle->lookup_start_time).rel_value_us, | 1698 | GNUNET_TIME_absolute_get_duration (handle->lookup_start_time).rel_value_us, |
1706 | GNUNET_YES); | 1699 | GNUNET_YES); |
1707 | GNUNET_STATISTICS_update (stats_handle, | 1700 | GNUNET_STATISTICS_update (stats, |
1708 | "abe_key_lookups_count", | 1701 | "abe_key_lookups_count", |
1709 | 1, | 1702 | 1, |
1710 | GNUNET_YES); | 1703 | GNUNET_YES); |
@@ -2392,8 +2385,6 @@ run (void *cls, | |||
2392 | identity_handle = GNUNET_IDENTITY_connect (cfg, | 2385 | identity_handle = GNUNET_IDENTITY_connect (cfg, |
2393 | NULL, | 2386 | NULL, |
2394 | NULL); | 2387 | NULL); |
2395 | stats_handle = GNUNET_STATISTICS_create ("identity-provider", | ||
2396 | cfg); | ||
2397 | /* Loading DB plugin */ | 2388 | /* Loading DB plugin */ |
2398 | if (GNUNET_OK != | 2389 | if (GNUNET_OK != |
2399 | GNUNET_CONFIGURATION_get_value_string (cfg, | 2390 | GNUNET_CONFIGURATION_get_value_string (cfg, |
diff --git a/src/identity/plugin_rest_identity.c b/src/identity/plugin_rest_identity.c index 5f34d0f1b..33804143d 100644 --- a/src/identity/plugin_rest_identity.c +++ b/src/identity/plugin_rest_identity.c | |||
@@ -593,6 +593,7 @@ ego_edit_cont (struct GNUNET_REST_RequestHandle *con, | |||
593 | struct GNUNET_JSONAPI_Resource *json_res; | 593 | struct GNUNET_JSONAPI_Resource *json_res; |
594 | struct RequestHandle *handle = cls; | 594 | struct RequestHandle *handle = cls; |
595 | struct EgoEntry *ego_entry; | 595 | struct EgoEntry *ego_entry; |
596 | struct EgoEntry *ego_entry_tmp; | ||
596 | struct MHD_Response *resp; | 597 | struct MHD_Response *resp; |
597 | json_t *subsys_json; | 598 | json_t *subsys_json; |
598 | json_t *name_json; | 599 | json_t *name_json; |
@@ -684,12 +685,12 @@ ego_edit_cont (struct GNUNET_REST_RequestHandle *con, | |||
684 | if ((NULL != name_json) && json_is_string (name_json)) | 685 | if ((NULL != name_json) && json_is_string (name_json)) |
685 | { | 686 | { |
686 | newname = json_string_value (name_json); | 687 | newname = json_string_value (name_json); |
687 | for (ego_entry = handle->ego_head; | 688 | for (ego_entry_tmp = handle->ego_head; |
688 | NULL != ego_entry; | 689 | NULL != ego_entry_tmp; |
689 | ego_entry = ego_entry->next) | 690 | ego_entry_tmp = ego_entry_tmp->next) |
690 | { | 691 | { |
691 | if (0 == strcasecmp (newname, ego_entry->identifier) && | 692 | if (0 == strcasecmp (newname, ego_entry_tmp->identifier) && |
692 | 0 != strcasecmp (keystring, ego_entry->keystring)) | 693 | 0 != strcasecmp (keystring, ego_entry_tmp->keystring)) |
693 | { | 694 | { |
694 | //Ego with same name not allowed | 695 | //Ego with same name not allowed |
695 | GNUNET_JSONAPI_document_delete (json_obj); | 696 | GNUNET_JSONAPI_document_delete (json_obj); |
diff --git a/src/include/gnunet_network_lib.h b/src/include/gnunet_network_lib.h index 9e692bbbf..2c344749f 100644 --- a/src/include/gnunet_network_lib.h +++ b/src/include/gnunet_network_lib.h | |||
@@ -53,7 +53,7 @@ struct GNUNET_NETWORK_FDSet | |||
53 | { | 53 | { |
54 | 54 | ||
55 | /** | 55 | /** |
56 | * Maximum number of any socket socket descriptor in the set (plus one) | 56 | * Maximum number of any socket descriptor in the set (plus one) |
57 | */ | 57 | */ |
58 | int nsds; | 58 | int nsds; |
59 | 59 | ||
diff --git a/src/include/gnunet_set_service.h b/src/include/gnunet_set_service.h index a2999aebc..0c14aa945 100644 --- a/src/include/gnunet_set_service.h +++ b/src/include/gnunet_set_service.h | |||
@@ -530,6 +530,7 @@ GNUNET_SET_iterate (struct GNUNET_SET_Handle *set, | |||
530 | GNUNET_SET_ElementIterator iter, | 530 | GNUNET_SET_ElementIterator iter, |
531 | void *iter_cls); | 531 | void *iter_cls); |
532 | 532 | ||
533 | |||
533 | /** | 534 | /** |
534 | * Stop iteration over all elements in the given set. Can only | 535 | * Stop iteration over all elements in the given set. Can only |
535 | * be called before the iteration has "naturally" completed its | 536 | * be called before the iteration has "naturally" completed its |
@@ -540,6 +541,7 @@ GNUNET_SET_iterate (struct GNUNET_SET_Handle *set, | |||
540 | void | 541 | void |
541 | GNUNET_SET_iterate_cancel (struct GNUNET_SET_Handle *set); | 542 | GNUNET_SET_iterate_cancel (struct GNUNET_SET_Handle *set); |
542 | 543 | ||
544 | |||
543 | /** | 545 | /** |
544 | * Create a copy of an element. The copy | 546 | * Create a copy of an element. The copy |
545 | * must be GNUNET_free-d by the caller. | 547 | * must be GNUNET_free-d by the caller. |
@@ -550,6 +552,7 @@ GNUNET_SET_iterate_cancel (struct GNUNET_SET_Handle *set); | |||
550 | struct GNUNET_SET_Element * | 552 | struct GNUNET_SET_Element * |
551 | GNUNET_SET_element_dup (const struct GNUNET_SET_Element *element); | 553 | GNUNET_SET_element_dup (const struct GNUNET_SET_Element *element); |
552 | 554 | ||
555 | |||
553 | /** | 556 | /** |
554 | * Hash a set element. | 557 | * Hash a set element. |
555 | * | 558 | * |
diff --git a/src/jsonapi/test_jsonapi.c b/src/jsonapi/test_jsonapi.c index 379dab9af..36c7b5c6c 100644 --- a/src/jsonapi/test_jsonapi.c +++ b/src/jsonapi/test_jsonapi.c | |||
@@ -1,18 +1,18 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | (C) 2015, 2016 GNUnet e.V. | 3 | (C) 2015, 2016 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify it under the | 5 | GNUnet is free software; you can redistribute it and/or modify it under the |
6 | terms of the GNU General Public License as published by the Free Software | 6 | terms of the GNU General Public License as published by the Free Software |
7 | Foundation; either version 3, or (at your option) any later version. | 7 | Foundation; either version 3, or (at your option) any later version. |
8 | 8 | ||
9 | GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY | 9 | GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY |
10 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | 10 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
11 | A PARTICULAR PURPOSE. See the GNU General Public License for more details. | 11 | A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU General Public License along with | 13 | You should have received a copy of the GNU General Public License along with |
14 | GNUnet; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/> | 14 | GNUnet; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/> |
15 | */ | 15 | */ |
16 | 16 | ||
17 | /** | 17 | /** |
18 | * @file json/test_jsonapi.c | 18 | * @file json/test_jsonapi.c |
@@ -24,7 +24,7 @@ | |||
24 | #include "gnunet_jsonapi_lib.h" | 24 | #include "gnunet_jsonapi_lib.h" |
25 | #include "gnunet_json_lib.h" | 25 | #include "gnunet_json_lib.h" |
26 | 26 | ||
27 | #define TEST_JSONAPI_DOCUMENT "{\"data\":{\"id\":\"1\",\"type\":\"bar\",\"attributes\":{\"foo\":\"bar\"}}}" | 27 | #define TEST_JSONAPI_DOCUMENT "{\"data\":[{\"id\":\"1\",\"type\":\"bar\",\"attributes\":{\"foo\":\"bar\"}}]}" |
28 | 28 | ||
29 | #define TEST_JSONAPI_DOCUMENT_ERR "{\"errors\":[{\"id\":\"1\",\"status\":\"403\",\"code\":\"23\", \"title\":\"Error\", \"detail\":\"Error details\"}]}" | 29 | #define TEST_JSONAPI_DOCUMENT_ERR "{\"errors\":[{\"id\":\"1\",\"status\":\"403\",\"code\":\"23\", \"title\":\"Error\", \"detail\":\"Error details\"}]}" |
30 | 30 | ||
@@ -74,7 +74,8 @@ test_document () | |||
74 | json_t *doc_json; | 74 | json_t *doc_json; |
75 | json_t *data_js; | 75 | json_t *data_js; |
76 | json_error_t err; | 76 | json_error_t err; |
77 | 77 | int ret; | |
78 | |||
78 | obj = GNUNET_JSONAPI_document_new (); | 79 | obj = GNUNET_JSONAPI_document_new (); |
79 | res = GNUNET_JSONAPI_resource_new ("bar", | 80 | res = GNUNET_JSONAPI_resource_new ("bar", |
80 | "1"); | 81 | "1"); |
@@ -94,11 +95,11 @@ test_document () | |||
94 | JSON_DECODE_ANY, | 95 | JSON_DECODE_ANY, |
95 | &err); | 96 | &err); |
96 | GNUNET_assert (NULL != data_js); | 97 | GNUNET_assert (NULL != data_js); |
97 | GNUNET_assert (0 != json_equal (data_js, doc_json)); | 98 | ret = json_equal (data_js, doc_json) ? 0 : 1; |
98 | GNUNET_JSONAPI_document_delete (obj); | 99 | GNUNET_JSONAPI_document_delete (obj); |
99 | json_decref (data_js); | 100 | json_decref (data_js); |
100 | json_decref (doc_json); | 101 | json_decref (doc_json); |
101 | return 0; | 102 | return ret; |
102 | } | 103 | } |
103 | 104 | ||
104 | static int | 105 | static int |
@@ -106,6 +107,7 @@ test_serialize () | |||
106 | { | 107 | { |
107 | struct GNUNET_JSONAPI_Document *obj; | 108 | struct GNUNET_JSONAPI_Document *obj; |
108 | char* tmp_data; | 109 | char* tmp_data; |
110 | int ret; | ||
109 | json_t* data_js; | 111 | json_t* data_js; |
110 | json_t* tmp_data_js; | 112 | json_t* tmp_data_js; |
111 | json_error_t err; | 113 | json_error_t err; |
@@ -125,11 +127,11 @@ test_serialize () | |||
125 | GNUNET_JSON_parse_free (jsonapispec); | 127 | GNUNET_JSON_parse_free (jsonapispec); |
126 | tmp_data_js = json_loads (tmp_data, JSON_DECODE_ANY, &err); | 128 | tmp_data_js = json_loads (tmp_data, JSON_DECODE_ANY, &err); |
127 | GNUNET_assert (NULL != tmp_data_js); | 129 | GNUNET_assert (NULL != tmp_data_js); |
128 | GNUNET_assert (0 != json_equal (tmp_data_js, data_js)); | 130 | ret = (1 == json_equal (tmp_data_js, data_js)) ? 0 : 1; |
129 | json_decref (data_js); | 131 | json_decref (data_js); |
130 | json_decref (tmp_data_js); | 132 | json_decref (tmp_data_js); |
131 | GNUNET_free (tmp_data); | 133 | GNUNET_free (tmp_data); |
132 | return 0; | 134 | return ret; |
133 | } | 135 | } |
134 | 136 | ||
135 | /** | 137 | /** |
diff --git a/src/multicast/gnunet-service-multicast.c b/src/multicast/gnunet-service-multicast.c index ba1086cc5..d01227e2c 100644 --- a/src/multicast/gnunet-service-multicast.c +++ b/src/multicast/gnunet-service-multicast.c | |||
@@ -664,6 +664,7 @@ client_send_random (struct GNUNET_HashCode *pub_key_hash, | |||
664 | if (n <= 0) | 664 | if (n <= 0) |
665 | n = GNUNET_CONTAINER_multihashmap_get_random (members, client_send_member_cb, | 665 | n = GNUNET_CONTAINER_multihashmap_get_random (members, client_send_member_cb, |
666 | (void *) env); | 666 | (void *) env); |
667 | GNUNET_MQ_discard (env); | ||
667 | return n; | 668 | return n; |
668 | } | 669 | } |
669 | 670 | ||
diff --git a/src/peerinfo/gnunet-service-peerinfo.c b/src/peerinfo/gnunet-service-peerinfo.c index af1eb2d1d..bdb6e5e0d 100644 --- a/src/peerinfo/gnunet-service-peerinfo.c +++ b/src/peerinfo/gnunet-service-peerinfo.c | |||
@@ -198,6 +198,8 @@ count_addresses (void *cls, | |||
198 | { | 198 | { |
199 | unsigned int *cnt = cls; | 199 | unsigned int *cnt = cls; |
200 | 200 | ||
201 | (void) address; | ||
202 | (void) expiration; | ||
201 | (*cnt)++; | 203 | (*cnt)++; |
202 | return GNUNET_OK; | 204 | return GNUNET_OK; |
203 | } | 205 | } |
@@ -290,7 +292,7 @@ read_host_file (const char *fn, | |||
290 | const struct GNUNET_HELLO_Message *hello; | 292 | const struct GNUNET_HELLO_Message *hello; |
291 | struct GNUNET_HELLO_Message *hello_clean; | 293 | struct GNUNET_HELLO_Message *hello_clean; |
292 | size_t read_pos; | 294 | size_t read_pos; |
293 | int size_hello; | 295 | uint16_t size_hello; |
294 | 296 | ||
295 | r->friend_only_hello = NULL; | 297 | r->friend_only_hello = NULL; |
296 | r->hello = NULL; | 298 | r->hello = NULL; |
@@ -304,7 +306,8 @@ read_host_file (const char *fn, | |||
304 | "Read %d bytes from `%s'\n", | 306 | "Read %d bytes from `%s'\n", |
305 | (int) size_total, | 307 | (int) size_total, |
306 | fn); | 308 | fn); |
307 | if (size_total < sizeof (struct GNUNET_MessageHeader)) | 309 | if ( (size_total < 0) || |
310 | (((size_t) size_total) < sizeof (struct GNUNET_MessageHeader)) ) | ||
308 | { | 311 | { |
309 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 312 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
310 | _("Failed to parse HELLO in file `%s': %s\n"), | 313 | _("Failed to parse HELLO in file `%s': %s\n"), |
@@ -320,12 +323,12 @@ read_host_file (const char *fn, | |||
320 | } | 323 | } |
321 | 324 | ||
322 | read_pos = 0; | 325 | read_pos = 0; |
323 | while (read_pos < size_total) | 326 | while (read_pos < (size_t) size_total) |
324 | { | 327 | { |
325 | hello = (const struct GNUNET_HELLO_Message *) &buffer[read_pos]; | 328 | hello = (const struct GNUNET_HELLO_Message *) &buffer[read_pos]; |
326 | size_hello = GNUNET_HELLO_size (hello); | 329 | size_hello = GNUNET_HELLO_size (hello); |
327 | if ( (0 == size_hello) || | 330 | if ( (0 == size_hello) || |
328 | (size_total - read_pos < size_hello) ) | 331 | (((size_t) size_total) - read_pos < size_hello) ) |
329 | { | 332 | { |
330 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 333 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
331 | _("Failed to parse HELLO in file `%s'\n"), | 334 | _("Failed to parse HELLO in file `%s'\n"), |
@@ -559,11 +562,11 @@ hosts_directory_scan_callback (void *cls, | |||
559 | if (GNUNET_OK != | 562 | if (GNUNET_OK != |
560 | GNUNET_HELLO_get_id (r.friend_only_hello, | 563 | GNUNET_HELLO_get_id (r.friend_only_hello, |
561 | &id_friend)) | 564 | &id_friend)) |
565 | { | ||
562 | if (GNUNET_YES == dsc->remove_files) | 566 | if (GNUNET_YES == dsc->remove_files) |
563 | { | ||
564 | remove_garbage (fullname); | 567 | remove_garbage (fullname); |
565 | return GNUNET_OK; | 568 | return GNUNET_OK; |
566 | } | 569 | } |
567 | id = id_friend; | 570 | id = id_friend; |
568 | } | 571 | } |
569 | if (NULL != r.hello) | 572 | if (NULL != r.hello) |
@@ -571,11 +574,11 @@ hosts_directory_scan_callback (void *cls, | |||
571 | if (GNUNET_OK != | 574 | if (GNUNET_OK != |
572 | GNUNET_HELLO_get_id (r.hello, | 575 | GNUNET_HELLO_get_id (r.hello, |
573 | &id_public)) | 576 | &id_public)) |
577 | { | ||
574 | if (GNUNET_YES == dsc->remove_files) | 578 | if (GNUNET_YES == dsc->remove_files) |
575 | { | ||
576 | remove_garbage (fullname); | 579 | remove_garbage (fullname); |
577 | return GNUNET_OK; | 580 | return GNUNET_OK; |
578 | } | 581 | } |
579 | id = id_public; | 582 | id = id_public; |
580 | } | 583 | } |
581 | 584 | ||
@@ -640,6 +643,7 @@ cron_scan_directory_data_hosts (void *cls) | |||
640 | static unsigned int retries; | 643 | static unsigned int retries; |
641 | struct DirScanContext dsc; | 644 | struct DirScanContext dsc; |
642 | 645 | ||
646 | (void) cls; | ||
643 | cron_scan = NULL; | 647 | cron_scan = NULL; |
644 | if (GNUNET_SYSERR == | 648 | if (GNUNET_SYSERR == |
645 | GNUNET_DISK_directory_create (networkIdDirectory)) | 649 | GNUNET_DISK_directory_create (networkIdDirectory)) |
@@ -730,7 +734,7 @@ update_hello (const struct GNUNET_PeerIdentity *peer, | |||
730 | int friend_hello_type; | 734 | int friend_hello_type; |
731 | int store_hello; | 735 | int store_hello; |
732 | int store_friend_hello; | 736 | int store_friend_hello; |
733 | int pos; | 737 | unsigned int pos; |
734 | char *buffer; | 738 | char *buffer; |
735 | 739 | ||
736 | host = GNUNET_CONTAINER_multipeermap_get (hostmap, peer); | 740 | host = GNUNET_CONTAINER_multipeermap_get (hostmap, peer); |
@@ -849,8 +853,8 @@ update_hello (const struct GNUNET_PeerIdentity *peer, | |||
849 | if (GNUNET_YES == store_friend_hello) | 853 | if (GNUNET_YES == store_friend_hello) |
850 | { | 854 | { |
851 | GNUNET_memcpy (&buffer[pos], | 855 | GNUNET_memcpy (&buffer[pos], |
852 | host->friend_only_hello, | 856 | host->friend_only_hello, |
853 | GNUNET_HELLO_size (host->friend_only_hello)); | 857 | GNUNET_HELLO_size (host->friend_only_hello)); |
854 | pos += GNUNET_HELLO_size (host->friend_only_hello); | 858 | pos += GNUNET_HELLO_size (host->friend_only_hello); |
855 | } | 859 | } |
856 | GNUNET_assert (pos == size); | 860 | GNUNET_assert (pos == size); |
@@ -988,16 +992,31 @@ discard_hosts_helper (void *cls, | |||
988 | unsigned int cnt; | 992 | unsigned int cnt; |
989 | char *writebuffer; | 993 | char *writebuffer; |
990 | uint64_t fsize; | 994 | uint64_t fsize; |
995 | |||
996 | if (GNUNET_OK != | ||
997 | GNUNET_DISK_file_size (fn, | ||
998 | &fsize, | ||
999 | GNUNET_YES, | ||
1000 | GNUNET_YES)) | ||
1001 | { | ||
1002 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING | | ||
1003 | GNUNET_ERROR_TYPE_BULK, | ||
1004 | "fstat", | ||
1005 | fn); | ||
1006 | return GNUNET_OK; | ||
1007 | } | ||
1008 | read_size = GNUNET_DISK_fn_read (fn, | ||
1009 | buffer, | ||
1010 | sizeof (buffer)); | ||
991 | 1011 | ||
992 | GNUNET_DISK_file_size (fn, &fsize, GNUNET_YES, GNUNET_YES); | 1012 | if ( (read_size < (int) sizeof (struct GNUNET_MessageHeader)) || |
993 | read_size = GNUNET_DISK_fn_read (fn, buffer, sizeof (buffer)); | 1013 | (fsize > GNUNET_MAX_MESSAGE_SIZE) ) |
994 | |||
995 | if ((read_size < (int) sizeof (struct GNUNET_MessageHeader)) || | ||
996 | (fsize > GNUNET_MAX_MESSAGE_SIZE)) | ||
997 | { | 1014 | { |
998 | if (0 != UNLINK (fn)) | 1015 | if (0 != UNLINK (fn)) |
999 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING | | 1016 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING | |
1000 | GNUNET_ERROR_TYPE_BULK, "unlink", fn); | 1017 | GNUNET_ERROR_TYPE_BULK, |
1018 | "unlink", | ||
1019 | fn); | ||
1001 | return GNUNET_OK; | 1020 | return GNUNET_OK; |
1002 | } | 1021 | } |
1003 | 1022 | ||
@@ -1074,6 +1093,7 @@ cron_clean_data_hosts (void *cls) | |||
1074 | { | 1093 | { |
1075 | struct GNUNET_TIME_Absolute now; | 1094 | struct GNUNET_TIME_Absolute now; |
1076 | 1095 | ||
1096 | (void) cls; | ||
1077 | cron_clean = NULL; | 1097 | cron_clean = NULL; |
1078 | now = GNUNET_TIME_absolute_get (); | 1098 | now = GNUNET_TIME_absolute_get (); |
1079 | GNUNET_log (GNUNET_ERROR_TYPE_INFO | GNUNET_ERROR_TYPE_BULK, | 1099 | GNUNET_log (GNUNET_ERROR_TYPE_INFO | GNUNET_ERROR_TYPE_BULK, |
@@ -1101,6 +1121,7 @@ check_hello (void *cls, | |||
1101 | { | 1121 | { |
1102 | struct GNUNET_PeerIdentity pid; | 1122 | struct GNUNET_PeerIdentity pid; |
1103 | 1123 | ||
1124 | (void) cls; | ||
1104 | if (GNUNET_OK != | 1125 | if (GNUNET_OK != |
1105 | GNUNET_HELLO_get_id (hello, | 1126 | GNUNET_HELLO_get_id (hello, |
1106 | &pid)) | 1127 | &pid)) |
@@ -1252,6 +1273,8 @@ client_connect_cb (void *cls, | |||
1252 | struct GNUNET_SERVICE_Client *client, | 1273 | struct GNUNET_SERVICE_Client *client, |
1253 | struct GNUNET_MQ_Handle *mq) | 1274 | struct GNUNET_MQ_Handle *mq) |
1254 | { | 1275 | { |
1276 | (void) cls; | ||
1277 | (void) mq; | ||
1255 | return client; | 1278 | return client; |
1256 | } | 1279 | } |
1257 | 1280 | ||
@@ -1268,6 +1291,7 @@ client_disconnect_cb (void *cls, | |||
1268 | struct GNUNET_SERVICE_Client *client, | 1291 | struct GNUNET_SERVICE_Client *client, |
1269 | void *app_ctx) | 1292 | void *app_ctx) |
1270 | { | 1293 | { |
1294 | (void) cls; | ||
1271 | GNUNET_assert (app_ctx == client); | 1295 | GNUNET_assert (app_ctx == client); |
1272 | } | 1296 | } |
1273 | 1297 | ||
@@ -1287,6 +1311,8 @@ free_host_entry (void *cls, | |||
1287 | { | 1311 | { |
1288 | struct HostEntry *he = value; | 1312 | struct HostEntry *he = value; |
1289 | 1313 | ||
1314 | (void) cls; | ||
1315 | (void) key; | ||
1290 | GNUNET_free_non_null (he->hello); | 1316 | GNUNET_free_non_null (he->hello); |
1291 | GNUNET_free_non_null (he->friend_only_hello); | 1317 | GNUNET_free_non_null (he->friend_only_hello); |
1292 | GNUNET_free (he); | 1318 | GNUNET_free (he); |
@@ -1302,6 +1328,7 @@ free_host_entry (void *cls, | |||
1302 | static void | 1328 | static void |
1303 | shutdown_task (void *cls) | 1329 | shutdown_task (void *cls) |
1304 | { | 1330 | { |
1331 | (void) cls; | ||
1305 | GNUNET_notification_context_destroy (notify_list); | 1332 | GNUNET_notification_context_destroy (notify_list); |
1306 | notify_list = NULL; | 1333 | notify_list = NULL; |
1307 | GNUNET_notification_context_destroy (notify_friend_only_list); | 1334 | GNUNET_notification_context_destroy (notify_friend_only_list); |
@@ -1353,6 +1380,8 @@ run (void *cls, | |||
1353 | int noio; | 1380 | int noio; |
1354 | int use_included; | 1381 | int use_included; |
1355 | 1382 | ||
1383 | (void) cls; | ||
1384 | (void) service; | ||
1356 | hostmap | 1385 | hostmap |
1357 | = GNUNET_CONTAINER_multipeermap_create (1024, | 1386 | = GNUNET_CONTAINER_multipeermap_create (1024, |
1358 | GNUNET_YES); | 1387 | GNUNET_YES); |
diff --git a/src/regex/regex_internal_dht.c b/src/regex/regex_internal_dht.c index b80dabca0..828bb1648 100644 --- a/src/regex/regex_internal_dht.c +++ b/src/regex/regex_internal_dht.c | |||
@@ -154,23 +154,30 @@ regex_iterator (void *cls, | |||
154 | NULL, NULL); | 154 | NULL, NULL); |
155 | } | 155 | } |
156 | block = REGEX_BLOCK_create (proof, | 156 | block = REGEX_BLOCK_create (proof, |
157 | num_edges, edges, | 157 | num_edges, |
158 | edges, | ||
158 | accepting, | 159 | accepting, |
159 | &size); | 160 | &size); |
160 | (void) | 161 | if (NULL == block) |
161 | GNUNET_DHT_put (h->dht, key, | 162 | return; |
162 | DHT_REPLICATION, | 163 | (void) GNUNET_DHT_put (h->dht, |
163 | DHT_OPT, | 164 | key, |
164 | GNUNET_BLOCK_TYPE_REGEX, | 165 | DHT_REPLICATION, |
165 | size, block, | 166 | DHT_OPT, |
166 | GNUNET_TIME_relative_to_absolute (DHT_TTL), | 167 | GNUNET_BLOCK_TYPE_REGEX, |
167 | NULL, NULL); | 168 | size, |
169 | block, | ||
170 | GNUNET_TIME_relative_to_absolute (DHT_TTL), | ||
171 | NULL, | ||
172 | NULL); | ||
168 | GNUNET_STATISTICS_update (h->stats, | 173 | GNUNET_STATISTICS_update (h->stats, |
169 | "# regex blocks stored", | 174 | "# regex blocks stored", |
170 | 1, GNUNET_NO); | 175 | 1, |
176 | GNUNET_NO); | ||
171 | GNUNET_STATISTICS_update (h->stats, | 177 | GNUNET_STATISTICS_update (h->stats, |
172 | "# regex block bytes stored", | 178 | "# regex block bytes stored", |
173 | size, GNUNET_NO); | 179 | size, |
180 | GNUNET_NO); | ||
174 | GNUNET_free (block); | 181 | GNUNET_free (block); |
175 | } | 182 | } |
176 | 183 | ||
diff --git a/src/regex/regex_test_lib.c b/src/regex/regex_test_lib.c index f4025f652..814380246 100644 --- a/src/regex/regex_test_lib.c +++ b/src/regex/regex_test_lib.c | |||
@@ -99,8 +99,7 @@ c2i (char c, int size) | |||
99 | static void | 99 | static void |
100 | space (int n) | 100 | space (int n) |
101 | { | 101 | { |
102 | int i; | 102 | for (int i = 0; i < n; i++) |
103 | for (i = 0; i < n; i++) | ||
104 | fprintf (stderr, "| "); | 103 | fprintf (stderr, "| "); |
105 | } | 104 | } |
106 | 105 | ||
@@ -114,8 +113,7 @@ space (int n) | |||
114 | static void | 113 | static void |
115 | debugctx (struct RegexCombineCtx *ctx, int level) | 114 | debugctx (struct RegexCombineCtx *ctx, int level) |
116 | { | 115 | { |
117 | return; | 116 | #if DEBUG_REGEX |
118 | unsigned int i; | ||
119 | if (NULL != ctx->s) | 117 | if (NULL != ctx->s) |
120 | { | 118 | { |
121 | space (level - 1); | 119 | space (level - 1); |
@@ -123,7 +121,7 @@ debugctx (struct RegexCombineCtx *ctx, int level) | |||
123 | } | 121 | } |
124 | else | 122 | else |
125 | fprintf (stderr, "ROOT (base %u)\n", ctx->size); | 123 | fprintf (stderr, "ROOT (base %u)\n", ctx->size); |
126 | for (i = 0; i < ctx->size; i++) | 124 | for (unsigned int i = 0; i < ctx->size; i++) |
127 | { | 125 | { |
128 | if (NULL != ctx->children[i]) | 126 | if (NULL != ctx->children[i]) |
129 | { | 127 | { |
@@ -132,6 +130,7 @@ debugctx (struct RegexCombineCtx *ctx, int level) | |||
132 | } | 130 | } |
133 | } | 131 | } |
134 | fflush(stderr); | 132 | fflush(stderr); |
133 | #endif | ||
135 | } | 134 | } |
136 | 135 | ||
137 | 136 | ||
@@ -142,7 +141,8 @@ debugctx (struct RegexCombineCtx *ctx, int level) | |||
142 | * @param regex Regex to add. | 141 | * @param regex Regex to add. |
143 | */ | 142 | */ |
144 | static void | 143 | static void |
145 | regex_add (struct RegexCombineCtx *ctx, const char *regex); | 144 | regex_add (struct RegexCombineCtx *ctx, |
145 | const char *regex); | ||
146 | 146 | ||
147 | 147 | ||
148 | /** | 148 | /** |
@@ -164,14 +164,18 @@ new_regex_ctx (unsigned int alphabet_size) | |||
164 | return ctx; | 164 | return ctx; |
165 | } | 165 | } |
166 | 166 | ||
167 | |||
167 | static void | 168 | static void |
168 | move_children (struct RegexCombineCtx *dst, const struct RegexCombineCtx *src) | 169 | move_children (struct RegexCombineCtx *dst, |
170 | const struct RegexCombineCtx *src) | ||
169 | { | 171 | { |
170 | size_t array_size; | 172 | size_t array_size; |
171 | 173 | ||
172 | array_size = sizeof(struct RegexCombineCtx *) * src->size; | 174 | array_size = sizeof(struct RegexCombineCtx *) * src->size; |
173 | memcpy (dst->children, src->children, array_size); | 175 | memcpy (dst->children, |
174 | for (int i = 0; i < src->size; i++) | 176 | src->children, |
177 | array_size); | ||
178 | for (unsigned int i = 0; i < src->size; i++) | ||
175 | { | 179 | { |
176 | src->children[i] = NULL; | 180 | src->children[i] = NULL; |
177 | } | 181 | } |
@@ -402,6 +406,7 @@ regex_split (struct RegexCombineCtx *ctx, | |||
402 | tmp = ctx->children; | 406 | tmp = ctx->children; |
403 | ctx->children = GNUNET_malloc (sizeof(*tmp) * ctx->size); | 407 | ctx->children = GNUNET_malloc (sizeof(*tmp) * ctx->size); |
404 | regex_add_multiple (ctx, suffix, tmp); | 408 | regex_add_multiple (ctx, suffix, tmp); |
409 | GNUNET_free (suffix); | ||
405 | GNUNET_free (tmp); | 410 | GNUNET_free (tmp); |
406 | return; | 411 | return; |
407 | } | 412 | } |
diff --git a/src/revocation/gnunet-service-revocation.c b/src/revocation/gnunet-service-revocation.c index 8281e9a16..23f654141 100644 --- a/src/revocation/gnunet-service-revocation.c +++ b/src/revocation/gnunet-service-revocation.c | |||
@@ -759,7 +759,11 @@ handle_revocation_union_request (void *cls, | |||
759 | { | 759 | { |
760 | peer_entry = new_peer_entry (other_peer); | 760 | peer_entry = new_peer_entry (other_peer); |
761 | } | 761 | } |
762 | GNUNET_assert (NULL == peer_entry->so); | 762 | if (NULL != peer_entry->so) |
763 | { | ||
764 | GNUNET_break_op (0); | ||
765 | return; | ||
766 | } | ||
763 | peer_entry->so = GNUNET_SET_accept (request, | 767 | peer_entry->so = GNUNET_SET_accept (request, |
764 | GNUNET_SET_RESULT_ADDED, | 768 | GNUNET_SET_RESULT_ADDED, |
765 | (struct GNUNET_SET_Option[]) {{ 0 }}, | 769 | (struct GNUNET_SET_Option[]) {{ 0 }}, |
@@ -769,8 +773,7 @@ handle_revocation_union_request (void *cls, | |||
769 | GNUNET_SET_commit (peer_entry->so, | 773 | GNUNET_SET_commit (peer_entry->so, |
770 | revocation_set)) | 774 | revocation_set)) |
771 | { | 775 | { |
772 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 776 | GNUNET_break (0); |
773 | _("SET service crashed, terminating revocation service\n")); | ||
774 | GNUNET_SCHEDULER_shutdown (); | 777 | GNUNET_SCHEDULER_shutdown (); |
775 | return; | 778 | return; |
776 | } | 779 | } |
diff --git a/src/set/set_api.c b/src/set/set_api.c index 1d0d00b44..cefc6734a 100644 --- a/src/set/set_api.c +++ b/src/set/set_api.c | |||
@@ -695,6 +695,7 @@ GNUNET_SET_add_element (struct GNUNET_SET_Handle *set, | |||
695 | "adding element of type %u to set %p\n", | 695 | "adding element of type %u to set %p\n", |
696 | (unsigned int) element->element_type, | 696 | (unsigned int) element->element_type, |
697 | set); | 697 | set); |
698 | GNUNET_assert (NULL != set); | ||
698 | if (GNUNET_YES == set->invalid) | 699 | if (GNUNET_YES == set->invalid) |
699 | { | 700 | { |
700 | if (NULL != cont) | 701 | if (NULL != cont) |
@@ -772,6 +773,7 @@ GNUNET_SET_destroy (struct GNUNET_SET_Handle *set) | |||
772 | /* destroying set while iterator is active is currently | 773 | /* destroying set while iterator is active is currently |
773 | not supported; we should expand the API to allow | 774 | not supported; we should expand the API to allow |
774 | clients to explicitly cancel the iteration! */ | 775 | clients to explicitly cancel the iteration! */ |
776 | GNUNET_assert (NULL != set); | ||
775 | if ( (NULL != set->ops_head) || | 777 | if ( (NULL != set->ops_head) || |
776 | (NULL != set->iterator) || | 778 | (NULL != set->iterator) || |
777 | (GNUNET_SYSERR == set->destroy_requested) ) | 779 | (GNUNET_SYSERR == set->destroy_requested) ) |
@@ -1124,11 +1126,12 @@ GNUNET_SET_commit (struct GNUNET_SET_OperationHandle *oh, | |||
1124 | { | 1126 | { |
1125 | if (NULL != oh->set) | 1127 | if (NULL != oh->set) |
1126 | { | 1128 | { |
1127 | /* Some other set was already commited for this | 1129 | /* Some other set was already committed for this |
1128 | * operation, there is a logic bug in the client of this API */ | 1130 | * operation, there is a logic bug in the client of this API */ |
1129 | GNUNET_break (0); | 1131 | GNUNET_break (0); |
1130 | return GNUNET_OK; | 1132 | return GNUNET_OK; |
1131 | } | 1133 | } |
1134 | GNUNET_assert (NULL != set); | ||
1132 | if (GNUNET_YES == set->invalid) | 1135 | if (GNUNET_YES == set->invalid) |
1133 | return GNUNET_SYSERR; | 1136 | return GNUNET_SYSERR; |
1134 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1137 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
diff --git a/src/testbed/gnunet-daemon-testbed-blacklist.c b/src/testbed/gnunet-daemon-testbed-blacklist.c index f2f96ee09..3ebe20258 100644 --- a/src/testbed/gnunet-daemon-testbed-blacklist.c +++ b/src/testbed/gnunet-daemon-testbed-blacklist.c | |||
@@ -190,7 +190,8 @@ run (void *cls, | |||
190 | char *fname; | 190 | char *fname; |
191 | 191 | ||
192 | if (GNUNET_OK != | 192 | if (GNUNET_OK != |
193 | GNUNET_CONFIGURATION_get_value_filename (c, "PATHS", | 193 | GNUNET_CONFIGURATION_get_value_filename (c, |
194 | "PATHS", | ||
194 | "GNUNET_HOME", | 195 | "GNUNET_HOME", |
195 | &shome)) | 196 | &shome)) |
196 | { | 197 | { |
@@ -208,6 +209,7 @@ run (void *cls, | |||
208 | GNUNET_free (fname); | 209 | GNUNET_free (fname); |
209 | return; | 210 | return; |
210 | } | 211 | } |
212 | GNUNET_free (fname); | ||
211 | GNUNET_asprintf (&fname, | 213 | GNUNET_asprintf (&fname, |
212 | "%s/blacklist", | 214 | "%s/blacklist", |
213 | shome); | 215 | shome); |
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index ac72a667c..8d3e47f94 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c | |||
@@ -616,6 +616,8 @@ neighbours_changed_notification (const struct GNUNET_PeerIdentity *peer, | |||
616 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 616 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, |
617 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out) | 617 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out) |
618 | { | 618 | { |
619 | (void) bandwidth_in; | ||
620 | (void) bandwidth_out; | ||
619 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 621 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
620 | "Notifying about change for peer `%s' with address `%s' in state `%s' timing out at %s\n", | 622 | "Notifying about change for peer `%s' with address `%s' in state `%s' timing out at %s\n", |
621 | GNUNET_i2s (peer), | 623 | GNUNET_i2s (peer), |
@@ -993,6 +995,10 @@ send_disconnect_cont (void *cls, | |||
993 | { | 995 | { |
994 | struct NeighbourMapEntry *n; | 996 | struct NeighbourMapEntry *n; |
995 | 997 | ||
998 | (void) cls; | ||
999 | (void) result; | ||
1000 | (void) payload; | ||
1001 | (void) physical; | ||
996 | n = lookup_neighbour (target); | 1002 | n = lookup_neighbour (target); |
997 | if (NULL == n) | 1003 | if (NULL == n) |
998 | return; /* already gone */ | 1004 | return; /* already gone */ |
@@ -1133,8 +1139,10 @@ disconnect_neighbour (struct NeighbourMapEntry *n) | |||
1133 | * | 1139 | * |
1134 | * @param n neighbour entry to change qutoa for | 1140 | * @param n neighbour entry to change qutoa for |
1135 | * @param quota new quota | 1141 | * @param quota new quota |
1142 | * @return #GNUNET_YES if @a n is still valid, @GNUNET_NO if | ||
1143 | * @a n was freed | ||
1136 | */ | 1144 | */ |
1137 | static void | 1145 | static int |
1138 | set_incoming_quota (struct NeighbourMapEntry *n, | 1146 | set_incoming_quota (struct NeighbourMapEntry *n, |
1139 | struct GNUNET_BANDWIDTH_Value32NBO quota) | 1147 | struct GNUNET_BANDWIDTH_Value32NBO quota) |
1140 | { | 1148 | { |
@@ -1158,7 +1166,7 @@ set_incoming_quota (struct NeighbourMapEntry *n, | |||
1158 | GNUNET_TIME_UNIT_FOREVER_REL, | 1166 | GNUNET_TIME_UNIT_FOREVER_REL, |
1159 | GNUNET_NO, | 1167 | GNUNET_NO, |
1160 | NULL, NULL); | 1168 | NULL, NULL); |
1161 | return; | 1169 | return GNUNET_YES; |
1162 | } | 1170 | } |
1163 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1171 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
1164 | "Disconnecting peer `%s' due to SET_QUOTA\n", | 1172 | "Disconnecting peer `%s' due to SET_QUOTA\n", |
@@ -1168,6 +1176,7 @@ set_incoming_quota (struct NeighbourMapEntry *n, | |||
1168 | gettext_noop ("# disconnects due to quota of 0"), | 1176 | gettext_noop ("# disconnects due to quota of 0"), |
1169 | 1, GNUNET_NO); | 1177 | 1, GNUNET_NO); |
1170 | disconnect_neighbour (n); | 1178 | disconnect_neighbour (n); |
1179 | return GNUNET_NO; | ||
1171 | } | 1180 | } |
1172 | 1181 | ||
1173 | 1182 | ||
@@ -1196,8 +1205,10 @@ set_primary_address (struct NeighbourMapEntry *n, | |||
1196 | if (n->primary_address.bandwidth_in.value__ != bandwidth_in.value__) | 1205 | if (n->primary_address.bandwidth_in.value__ != bandwidth_in.value__) |
1197 | { | 1206 | { |
1198 | n->primary_address.bandwidth_in = bandwidth_in; | 1207 | n->primary_address.bandwidth_in = bandwidth_in; |
1199 | set_incoming_quota (n, | 1208 | if (GNUNET_YES != |
1200 | bandwidth_in); | 1209 | set_incoming_quota (n, |
1210 | bandwidth_in)) | ||
1211 | return; | ||
1201 | } | 1212 | } |
1202 | if (n->primary_address.bandwidth_out.value__ != bandwidth_out.value__) | 1213 | if (n->primary_address.bandwidth_out.value__ != bandwidth_out.value__) |
1203 | { | 1214 | { |
@@ -1237,8 +1248,10 @@ set_primary_address (struct NeighbourMapEntry *n, | |||
1237 | /* subsystems about address use */ | 1248 | /* subsystems about address use */ |
1238 | GST_validation_set_address_use (n->primary_address.address, | 1249 | GST_validation_set_address_use (n->primary_address.address, |
1239 | GNUNET_YES); | 1250 | GNUNET_YES); |
1240 | set_incoming_quota (n, | 1251 | if (GNUNET_YES != |
1241 | bandwidth_in); | 1252 | set_incoming_quota (n, |
1253 | bandwidth_in)) | ||
1254 | return; | ||
1242 | send_outbound_quota_to_clients (n); | 1255 | send_outbound_quota_to_clients (n); |
1243 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1256 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
1244 | "Neighbour `%s' switched to address `%s'\n", | 1257 | "Neighbour `%s' switched to address `%s'\n", |
@@ -1805,6 +1818,9 @@ send_session_syn_cont (void *cls, | |||
1805 | { | 1818 | { |
1806 | struct NeighbourMapEntry *n; | 1819 | struct NeighbourMapEntry *n; |
1807 | 1820 | ||
1821 | (void) cls; | ||
1822 | (void) size_payload; | ||
1823 | (void) size_on_wire; | ||
1808 | n = lookup_neighbour (target); | 1824 | n = lookup_neighbour (target); |
1809 | if (NULL == n) | 1825 | if (NULL == n) |
1810 | { | 1826 | { |
@@ -1978,6 +1994,9 @@ send_session_syn_ack_cont (void *cls, | |||
1978 | { | 1994 | { |
1979 | struct NeighbourMapEntry *n; | 1995 | struct NeighbourMapEntry *n; |
1980 | 1996 | ||
1997 | (void) cls; | ||
1998 | (void) size_payload; | ||
1999 | (void) size_on_wire; | ||
1981 | n = lookup_neighbour (target); | 2000 | n = lookup_neighbour (target); |
1982 | if (NULL == n) | 2001 | if (NULL == n) |
1983 | { | 2002 | { |
@@ -2393,8 +2412,10 @@ try_run_fast_ats_update (const struct GNUNET_HELLO_Address *address, | |||
2393 | if (n->primary_address.bandwidth_in.value__ != bandwidth_in.value__) | 2412 | if (n->primary_address.bandwidth_in.value__ != bandwidth_in.value__) |
2394 | { | 2413 | { |
2395 | n->primary_address.bandwidth_in = bandwidth_in; | 2414 | n->primary_address.bandwidth_in = bandwidth_in; |
2396 | set_incoming_quota (n, | 2415 | if (GNUNET_YES != |
2397 | bandwidth_in); | 2416 | set_incoming_quota (n, |
2417 | bandwidth_in)) | ||
2418 | return GNUNET_NO; | ||
2398 | } | 2419 | } |
2399 | if (n->primary_address.bandwidth_out.value__ != bandwidth_out.value__) | 2420 | if (n->primary_address.bandwidth_out.value__ != bandwidth_out.value__) |
2400 | { | 2421 | { |
@@ -2805,6 +2826,7 @@ send_utilization_data (void *cls, | |||
2805 | uint32_t bps_out; | 2826 | uint32_t bps_out; |
2806 | struct GNUNET_TIME_Relative delta; | 2827 | struct GNUNET_TIME_Relative delta; |
2807 | 2828 | ||
2829 | (void) cls; | ||
2808 | if ( (GNUNET_YES != test_connected (n)) || | 2830 | if ( (GNUNET_YES != test_connected (n)) || |
2809 | (NULL == n->primary_address.address) ) | 2831 | (NULL == n->primary_address.address) ) |
2810 | return GNUNET_OK; | 2832 | return GNUNET_OK; |
@@ -2835,11 +2857,12 @@ send_utilization_data (void *cls, | |||
2835 | /** | 2857 | /** |
2836 | * Task transmitting utilization in a regular interval | 2858 | * Task transmitting utilization in a regular interval |
2837 | * | 2859 | * |
2838 | * @param cls the 'struct NeighbourMapEntry' for which we are running | 2860 | * @param cls the `struct NeighbourMapEntry` for which we are running |
2839 | */ | 2861 | */ |
2840 | static void | 2862 | static void |
2841 | utilization_transmission (void *cls) | 2863 | utilization_transmission (void *cls) |
2842 | { | 2864 | { |
2865 | (void) cls; | ||
2843 | util_transmission_tk = NULL; | 2866 | util_transmission_tk = NULL; |
2844 | GNUNET_CONTAINER_multipeermap_iterate (neighbours, | 2867 | GNUNET_CONTAINER_multipeermap_iterate (neighbours, |
2845 | &send_utilization_data, | 2868 | &send_utilization_data, |
@@ -3095,6 +3118,7 @@ GST_neighbours_handle_session_syn_ack (const struct GNUNET_MessageHeader *messag | |||
3095 | struct GNUNET_TIME_Absolute ts; | 3118 | struct GNUNET_TIME_Absolute ts; |
3096 | struct NeighbourMapEntry *n; | 3119 | struct NeighbourMapEntry *n; |
3097 | 3120 | ||
3121 | (void) session; | ||
3098 | if (ntohs (message->size) != sizeof (struct TransportSynMessage)) | 3122 | if (ntohs (message->size) != sizeof (struct TransportSynMessage)) |
3099 | { | 3123 | { |
3100 | GNUNET_break_op (0); | 3124 | GNUNET_break_op (0); |
@@ -3368,6 +3392,7 @@ GST_neighbours_handle_session_ack (const struct GNUNET_MessageHeader *message, | |||
3368 | { | 3392 | { |
3369 | struct NeighbourMapEntry *n; | 3393 | struct NeighbourMapEntry *n; |
3370 | 3394 | ||
3395 | (void) session; | ||
3371 | if (ntohs (message->size) != sizeof (struct GNUNET_MessageHeader)) | 3396 | if (ntohs (message->size) != sizeof (struct GNUNET_MessageHeader)) |
3372 | { | 3397 | { |
3373 | GNUNET_break_op (0); | 3398 | GNUNET_break_op (0); |
@@ -3641,6 +3666,7 @@ neighbours_iterate (void *cls, | |||
3641 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in; | 3666 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in; |
3642 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out; | 3667 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out; |
3643 | 3668 | ||
3669 | (void) key; | ||
3644 | if (NULL != n->primary_address.address) | 3670 | if (NULL != n->primary_address.address) |
3645 | { | 3671 | { |
3646 | bandwidth_in = n->primary_address.bandwidth_in; | 3672 | bandwidth_in = n->primary_address.bandwidth_in; |
@@ -3733,6 +3759,7 @@ GST_neighbour_get_current_address (const struct GNUNET_PeerIdentity *peer) | |||
3733 | void | 3759 | void |
3734 | GST_neighbours_start (unsigned int max_fds) | 3760 | GST_neighbours_start (unsigned int max_fds) |
3735 | { | 3761 | { |
3762 | (void) max_fds; | ||
3736 | neighbours = GNUNET_CONTAINER_multipeermap_create (NEIGHBOUR_TABLE_SIZE, | 3763 | neighbours = GNUNET_CONTAINER_multipeermap_create (NEIGHBOUR_TABLE_SIZE, |
3737 | GNUNET_NO); | 3764 | GNUNET_NO); |
3738 | util_transmission_tk = GNUNET_SCHEDULER_add_delayed (UTIL_TRANSMISSION_INTERVAL, | 3765 | util_transmission_tk = GNUNET_SCHEDULER_add_delayed (UTIL_TRANSMISSION_INTERVAL, |
@@ -3756,6 +3783,8 @@ disconnect_all_neighbours (void *cls, | |||
3756 | { | 3783 | { |
3757 | struct NeighbourMapEntry *n = value; | 3784 | struct NeighbourMapEntry *n = value; |
3758 | 3785 | ||
3786 | (void) cls; | ||
3787 | (void) key; | ||
3759 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3788 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
3760 | "Disconnecting peer `%4s' during shutdown\n", | 3789 | "Disconnecting peer `%4s' during shutdown\n", |
3761 | GNUNET_i2s (&n->id)); | 3790 | GNUNET_i2s (&n->id)); |
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index a63013caa..c5d6e6d34 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c | |||
@@ -3172,8 +3172,6 @@ handle_tcp_welcome (void *cls, | |||
3172 | sizeof(struct GNUNET_PeerIdentity))) | 3172 | sizeof(struct GNUNET_PeerIdentity))) |
3173 | { | 3173 | { |
3174 | /* refuse connections from ourselves */ | 3174 | /* refuse connections from ourselves */ |
3175 | GNUNET_SERVER_receive_done (client, | ||
3176 | GNUNET_SYSERR); | ||
3177 | if (GNUNET_OK == | 3175 | if (GNUNET_OK == |
3178 | GNUNET_SERVER_client_get_address (client, | 3176 | GNUNET_SERVER_client_get_address (client, |
3179 | &vaddr, | 3177 | &vaddr, |
@@ -3185,6 +3183,8 @@ handle_tcp_welcome (void *cls, | |||
3185 | GNUNET_a2s (vaddr, alen)); | 3183 | GNUNET_a2s (vaddr, alen)); |
3186 | GNUNET_free (vaddr); | 3184 | GNUNET_free (vaddr); |
3187 | } | 3185 | } |
3186 | GNUNET_SERVER_receive_done (client, | ||
3187 | GNUNET_SYSERR); | ||
3188 | return; | 3188 | return; |
3189 | } | 3189 | } |
3190 | 3190 | ||
@@ -3348,7 +3348,7 @@ handle_tcp_data (void *cls, | |||
3348 | if (NULL == session) | 3348 | if (NULL == session) |
3349 | { | 3349 | { |
3350 | /* No inbound session found */ | 3350 | /* No inbound session found */ |
3351 | void *vaddr; | 3351 | void *vaddr = NULL; |
3352 | size_t alen; | 3352 | size_t alen; |
3353 | 3353 | ||
3354 | GNUNET_SERVER_client_get_address (client, | 3354 | GNUNET_SERVER_client_get_address (client, |
@@ -3369,7 +3369,7 @@ handle_tcp_data (void *cls, | |||
3369 | if (GNUNET_YES == session->expecting_welcome) | 3369 | if (GNUNET_YES == session->expecting_welcome) |
3370 | { | 3370 | { |
3371 | /* Session is expecting WELCOME message */ | 3371 | /* Session is expecting WELCOME message */ |
3372 | void *vaddr; | 3372 | void *vaddr = NULL; |
3373 | size_t alen; | 3373 | size_t alen; |
3374 | 3374 | ||
3375 | GNUNET_SERVER_client_get_address (client, | 3375 | GNUNET_SERVER_client_get_address (client, |
@@ -3389,7 +3389,7 @@ handle_tcp_data (void *cls, | |||
3389 | 3389 | ||
3390 | session->last_activity = GNUNET_TIME_absolute_get (); | 3390 | session->last_activity = GNUNET_TIME_absolute_get (); |
3391 | { | 3391 | { |
3392 | void *vaddr; | 3392 | void *vaddr = NULL; |
3393 | size_t alen; | 3393 | size_t alen; |
3394 | 3394 | ||
3395 | GNUNET_SERVER_client_get_address (client, | 3395 | GNUNET_SERVER_client_get_address (client, |
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index 1ff962544..0daac4443 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c | |||
@@ -1631,6 +1631,7 @@ enqueue (struct Plugin *plugin, | |||
1631 | if (GNUNET_YES == session->in_destroy) | 1631 | if (GNUNET_YES == session->in_destroy) |
1632 | { | 1632 | { |
1633 | GNUNET_break (0); | 1633 | GNUNET_break (0); |
1634 | GNUNET_free (udpw); | ||
1634 | return; | 1635 | return; |
1635 | } | 1636 | } |
1636 | if (plugin->bytes_in_buffer > INT64_MAX - udpw->msg_size) | 1637 | if (plugin->bytes_in_buffer > INT64_MAX - udpw->msg_size) |
@@ -1913,8 +1914,8 @@ enqueue_fragment (void *cls, | |||
1913 | udpw->qc = &qc_fragment_sent; | 1914 | udpw->qc = &qc_fragment_sent; |
1914 | udpw->qc_cls = plugin; | 1915 | udpw->qc_cls = plugin; |
1915 | GNUNET_memcpy (udpw->msg_buf, | 1916 | GNUNET_memcpy (udpw->msg_buf, |
1916 | msg, | 1917 | msg, |
1917 | msg_len); | 1918 | msg_len); |
1918 | enqueue (plugin, | 1919 | enqueue (plugin, |
1919 | udpw); | 1920 | udpw); |
1920 | if (session->address->address_length == sizeof (struct IPv4UdpAddress)) | 1921 | if (session->address->address_length == sizeof (struct IPv4UdpAddress)) |
@@ -3838,9 +3839,9 @@ libgnunet_plugin_transport_udp_init (void *cls) | |||
3838 | unsigned long long port; | 3839 | unsigned long long port; |
3839 | unsigned long long aport; | 3840 | unsigned long long aport; |
3840 | unsigned long long udp_max_bps; | 3841 | unsigned long long udp_max_bps; |
3841 | unsigned long long enable_v6; | 3842 | int enable_v6; |
3842 | unsigned long long enable_broadcasting; | 3843 | int enable_broadcasting; |
3843 | unsigned long long enable_broadcasting_recv; | 3844 | int enable_broadcasting_recv; |
3844 | char *bind4_address; | 3845 | char *bind4_address; |
3845 | char *bind6_address; | 3846 | char *bind6_address; |
3846 | struct GNUNET_TIME_Relative interval; | 3847 | struct GNUNET_TIME_Relative interval; |
diff --git a/src/transport/tcp_connection_legacy.c b/src/transport/tcp_connection_legacy.c index 5b219a467..17157436d 100644 --- a/src/transport/tcp_connection_legacy.c +++ b/src/transport/tcp_connection_legacy.c | |||
@@ -1218,8 +1218,10 @@ RETRY: | |||
1218 | * @param timeout maximum amount of time to wait | 1218 | * @param timeout maximum amount of time to wait |
1219 | * @param receiver function to call with received data | 1219 | * @param receiver function to call with received data |
1220 | * @param receiver_cls closure for @a receiver | 1220 | * @param receiver_cls closure for @a receiver |
1221 | * @return #GNUNET_SYSERR if @a connection died (receiver was | ||
1222 | * called with error) | ||
1221 | */ | 1223 | */ |
1222 | void | 1224 | int |
1223 | GNUNET_CONNECTION_receive (struct GNUNET_CONNECTION_Handle *connection, | 1225 | GNUNET_CONNECTION_receive (struct GNUNET_CONNECTION_Handle *connection, |
1224 | size_t max, | 1226 | size_t max, |
1225 | struct GNUNET_TIME_Relative timeout, | 1227 | struct GNUNET_TIME_Relative timeout, |
@@ -1241,7 +1243,7 @@ GNUNET_CONNECTION_receive (struct GNUNET_CONNECTION_Handle *connection, | |||
1241 | connection->sock, | 1243 | connection->sock, |
1242 | &receive_ready, | 1244 | &receive_ready, |
1243 | connection); | 1245 | connection); |
1244 | return; | 1246 | return GNUNET_OK; |
1245 | } | 1247 | } |
1246 | if ((NULL == connection->dns_active) && | 1248 | if ((NULL == connection->dns_active) && |
1247 | (NULL == connection->ap_head) && | 1249 | (NULL == connection->ap_head) && |
@@ -1252,8 +1254,9 @@ GNUNET_CONNECTION_receive (struct GNUNET_CONNECTION_Handle *connection, | |||
1252 | NULL, 0, | 1254 | NULL, 0, |
1253 | NULL, 0, | 1255 | NULL, 0, |
1254 | ETIMEDOUT); | 1256 | ETIMEDOUT); |
1255 | return; | 1257 | return GNUNET_SYSERR; |
1256 | } | 1258 | } |
1259 | return GNUNET_OK; | ||
1257 | } | 1260 | } |
1258 | 1261 | ||
1259 | 1262 | ||
diff --git a/src/transport/tcp_server_legacy.c b/src/transport/tcp_server_legacy.c index d0ce790fc..f75b41e8c 100644 --- a/src/transport/tcp_server_legacy.c +++ b/src/transport/tcp_server_legacy.c | |||
@@ -1044,11 +1044,13 @@ process_mst (struct GNUNET_SERVER_Client *client, | |||
1044 | "Server re-enters receive loop, timeout: %s.\n", | 1044 | "Server re-enters receive loop, timeout: %s.\n", |
1045 | GNUNET_STRINGS_relative_time_to_string (client->idle_timeout, GNUNET_YES)); | 1045 | GNUNET_STRINGS_relative_time_to_string (client->idle_timeout, GNUNET_YES)); |
1046 | client->receive_pending = GNUNET_YES; | 1046 | client->receive_pending = GNUNET_YES; |
1047 | GNUNET_CONNECTION_receive (client->connection, | 1047 | if (GNUNET_OK != |
1048 | GNUNET_MAX_MESSAGE_SIZE - 1, | 1048 | GNUNET_CONNECTION_receive (client->connection, |
1049 | client->idle_timeout, | 1049 | GNUNET_MAX_MESSAGE_SIZE - 1, |
1050 | &process_incoming, | 1050 | client->idle_timeout, |
1051 | client); | 1051 | &process_incoming, |
1052 | client)) | ||
1053 | return; | ||
1052 | break; | 1054 | break; |
1053 | } | 1055 | } |
1054 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1056 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
@@ -1287,11 +1289,13 @@ GNUNET_SERVER_connect_socket (struct GNUNET_SERVER_Handle *server, | |||
1287 | for (n = server->connect_notify_list_head; NULL != n; n = n->next) | 1289 | for (n = server->connect_notify_list_head; NULL != n; n = n->next) |
1288 | n->callback (n->callback_cls, client); | 1290 | n->callback (n->callback_cls, client); |
1289 | client->receive_pending = GNUNET_YES; | 1291 | client->receive_pending = GNUNET_YES; |
1290 | GNUNET_CONNECTION_receive (client->connection, | 1292 | if (GNUNET_SYSERR == |
1291 | GNUNET_MAX_MESSAGE_SIZE - 1, | 1293 | GNUNET_CONNECTION_receive (client->connection, |
1292 | client->idle_timeout, | 1294 | GNUNET_MAX_MESSAGE_SIZE - 1, |
1293 | &process_incoming, | 1295 | client->idle_timeout, |
1294 | client); | 1296 | &process_incoming, |
1297 | client)) | ||
1298 | return NULL; | ||
1295 | return client; | 1299 | return client; |
1296 | } | 1300 | } |
1297 | 1301 | ||
diff --git a/src/util/common_logging.c b/src/util/common_logging.c index 3e71fa476..ea5430191 100644 --- a/src/util/common_logging.c +++ b/src/util/common_logging.c | |||
@@ -976,20 +976,25 @@ mylog (enum GNUNET_ErrorType kind, | |||
976 | } | 976 | } |
977 | else | 977 | else |
978 | { | 978 | { |
979 | strftime (date2, | 979 | if (0 == |
980 | DATE_STR_SIZE, | 980 | strftime (date2, |
981 | "%b %d %H:%M:%S-%%020llu", | 981 | DATE_STR_SIZE, |
982 | tmptr); | 982 | "%b %d %H:%M:%S-%%020llu", |
983 | snprintf (date, | 983 | tmptr)) |
984 | sizeof (date), | 984 | abort (); |
985 | date2, | 985 | if (0 > |
986 | (long long) (pc.QuadPart / | 986 | snprintf (date, |
987 | (performance_frequency.QuadPart / 1000))); | 987 | sizeof (date), |
988 | date2, | ||
989 | (long long) (pc.QuadPart / | ||
990 | (performance_frequency.QuadPart / 1000)))) | ||
991 | abort (); | ||
988 | } | 992 | } |
989 | #else | 993 | #else |
990 | struct timeval timeofday; | 994 | struct timeval timeofday; |
991 | 995 | ||
992 | gettimeofday (&timeofday, NULL); | 996 | gettimeofday (&timeofday, |
997 | NULL); | ||
993 | offset = GNUNET_TIME_get_offset (); | 998 | offset = GNUNET_TIME_get_offset (); |
994 | if (offset > 0) | 999 | if (offset > 0) |
995 | { | 1000 | { |
@@ -1022,24 +1027,33 @@ mylog (enum GNUNET_ErrorType kind, | |||
1022 | } | 1027 | } |
1023 | else | 1028 | else |
1024 | { | 1029 | { |
1025 | strftime (date2, | 1030 | if (0 == |
1026 | DATE_STR_SIZE, | 1031 | strftime (date2, |
1027 | "%b %d %H:%M:%S-%%06u", | 1032 | DATE_STR_SIZE, |
1028 | tmptr); | 1033 | "%b %d %H:%M:%S-%%06u", |
1029 | snprintf (date, | 1034 | tmptr)) |
1030 | sizeof (date), | 1035 | abort (); |
1031 | date2, | 1036 | if (0 > |
1032 | timeofday.tv_usec); | 1037 | snprintf (date, |
1038 | sizeof (date), | ||
1039 | date2, | ||
1040 | timeofday.tv_usec)) | ||
1041 | abort (); | ||
1033 | } | 1042 | } |
1034 | #endif | 1043 | #endif |
1035 | VSNPRINTF (buf, size, message, va); | 1044 | VSNPRINTF (buf, |
1045 | size, | ||
1046 | message, | ||
1047 | va); | ||
1036 | #if ! (defined(GNUNET_CULL_LOGGING) || TALER_WALLET_ONLY) | 1048 | #if ! (defined(GNUNET_CULL_LOGGING) || TALER_WALLET_ONLY) |
1037 | if (NULL != tmptr) | 1049 | if (NULL != tmptr) |
1038 | (void) setup_log_file (tmptr); | 1050 | (void) setup_log_file (tmptr); |
1039 | #endif | 1051 | #endif |
1040 | if ((0 != (kind & GNUNET_ERROR_TYPE_BULK)) && | 1052 | if ((0 != (kind & GNUNET_ERROR_TYPE_BULK)) && |
1041 | (0 != last_bulk_time.abs_value_us) && | 1053 | (0 != last_bulk_time.abs_value_us) && |
1042 | (0 == strncmp (buf, last_bulk, sizeof (last_bulk)))) | 1054 | (0 == strncmp (buf, |
1055 | last_bulk, | ||
1056 | sizeof (last_bulk)))) | ||
1043 | { | 1057 | { |
1044 | last_bulk_repeat++; | 1058 | last_bulk_repeat++; |
1045 | if ( (GNUNET_TIME_absolute_get_duration (last_bulk_time).rel_value_us > | 1059 | if ( (GNUNET_TIME_absolute_get_duration (last_bulk_time).rel_value_us > |
diff --git a/src/util/gnunet-config.c b/src/util/gnunet-config.c index fb3b9ebf9..5f7d9fc0d 100644 --- a/src/util/gnunet-config.c +++ b/src/util/gnunet-config.c | |||
@@ -72,12 +72,17 @@ static int rewrite; | |||
72 | * @param value value of the option | 72 | * @param value value of the option |
73 | */ | 73 | */ |
74 | static void | 74 | static void |
75 | print_option (void *cls, const char *section, | 75 | print_option (void *cls, |
76 | const char *section, | ||
76 | const char *option, | 77 | const char *option, |
77 | const char *value) | 78 | const char *value) |
78 | { | 79 | { |
80 | (void) cls; | ||
81 | (void) section; | ||
79 | fprintf (stdout, | 82 | fprintf (stdout, |
80 | "%s = %s\n", option, value); | 83 | "%s = %s\n", |
84 | option, | ||
85 | value); | ||
81 | } | 86 | } |
82 | 87 | ||
83 | 88 | ||
@@ -91,7 +96,10 @@ static void | |||
91 | print_section_name (void *cls, | 96 | print_section_name (void *cls, |
92 | const char *section) | 97 | const char *section) |
93 | { | 98 | { |
94 | fprintf (stdout, "%s\n", section); | 99 | (void) cls; |
100 | fprintf (stdout, | ||
101 | "%s\n", | ||
102 | section); | ||
95 | } | 103 | } |
96 | 104 | ||
97 | 105 | ||
@@ -112,6 +120,8 @@ run (void *cls, | |||
112 | struct GNUNET_CONFIGURATION_Handle *out = NULL; | 120 | struct GNUNET_CONFIGURATION_Handle *out = NULL; |
113 | struct GNUNET_CONFIGURATION_Handle *diff = NULL; | 121 | struct GNUNET_CONFIGURATION_Handle *diff = NULL; |
114 | 122 | ||
123 | (void) cls; | ||
124 | (void) args; | ||
115 | if (rewrite) | 125 | if (rewrite) |
116 | { | 126 | { |
117 | struct GNUNET_CONFIGURATION_Handle *def; | 127 | struct GNUNET_CONFIGURATION_Handle *def; |
@@ -221,36 +231,37 @@ run (void *cls, | |||
221 | * @return 0 ok, 1 on error | 231 | * @return 0 ok, 1 on error |
222 | */ | 232 | */ |
223 | int | 233 | int |
224 | main (int argc, char *const *argv) | 234 | main (int argc, |
235 | char *const *argv) | ||
225 | { | 236 | { |
226 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 237 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
227 | GNUNET_GETOPT_option_flag ('f', | 238 | GNUNET_GETOPT_option_flag ('f', |
228 | "filename", | 239 | "filename", |
229 | gettext_noop ("obtain option of value as a filename (with $-expansion)"), | 240 | gettext_noop ("obtain option of value as a filename (with $-expansion)"), |
230 | &is_filename), | 241 | &is_filename), |
231 | GNUNET_GETOPT_option_string ('s', | 242 | GNUNET_GETOPT_option_string ('s', |
232 | "section", | 243 | "section", |
233 | "SECTION", | 244 | "SECTION", |
234 | gettext_noop ("name of the section to access"), | 245 | gettext_noop ("name of the section to access"), |
235 | §ion), | 246 | §ion), |
236 | GNUNET_GETOPT_option_string ('o', | 247 | GNUNET_GETOPT_option_string ('o', |
237 | "option", | 248 | "option", |
238 | "OPTION", | 249 | "OPTION", |
239 | gettext_noop ("name of the option to access"), | 250 | gettext_noop ("name of the option to access"), |
240 | &option), | 251 | &option), |
241 | GNUNET_GETOPT_option_string ('V', | 252 | GNUNET_GETOPT_option_string ('V', |
242 | "value", | 253 | "value", |
243 | "VALUE", | 254 | "VALUE", |
244 | gettext_noop ("value to set"), | 255 | gettext_noop ("value to set"), |
245 | &value), | 256 | &value), |
246 | GNUNET_GETOPT_option_flag ('S', | 257 | GNUNET_GETOPT_option_flag ('S', |
247 | "list-sections", | 258 | "list-sections", |
248 | gettext_noop ("print available configuration sections"), | 259 | gettext_noop ("print available configuration sections"), |
249 | &list_sections), | 260 | &list_sections), |
250 | GNUNET_GETOPT_option_flag ('w', | 261 | GNUNET_GETOPT_option_flag ('w', |
251 | "rewrite", | 262 | "rewrite", |
252 | gettext_noop ("write configuration file that only contains delta to defaults"), | 263 | gettext_noop ("write configuration file that only contains delta to defaults"), |
253 | &rewrite), | 264 | &rewrite), |
254 | GNUNET_GETOPT_OPTION_END | 265 | GNUNET_GETOPT_OPTION_END |
255 | }; | 266 | }; |
256 | if (GNUNET_OK != | 267 | if (GNUNET_OK != |
diff --git a/src/util/gnunet-ecc.c b/src/util/gnunet-ecc.c index 66a4bd3e9..59a100a8c 100644 --- a/src/util/gnunet-ecc.c +++ b/src/util/gnunet-ecc.c | |||
@@ -281,8 +281,10 @@ print_key (const char *filename) | |||
281 | uint64_t fs; | 281 | uint64_t fs; |
282 | unsigned int total_hostkeys; | 282 | unsigned int total_hostkeys; |
283 | unsigned int c; | 283 | unsigned int c; |
284 | ssize_t sret; | ||
284 | 285 | ||
285 | if (GNUNET_YES != GNUNET_DISK_file_test (filename)) | 286 | if (GNUNET_YES != |
287 | GNUNET_DISK_file_test (filename)) | ||
286 | { | 288 | { |
287 | fprintf (stderr, | 289 | fprintf (stderr, |
288 | _("Hostkeys file `%s' not found\n"), | 290 | _("Hostkeys file `%s' not found\n"), |
@@ -291,7 +293,11 @@ print_key (const char *filename) | |||
291 | } | 293 | } |
292 | 294 | ||
293 | /* Check hostkey file size, read entire thing into memory */ | 295 | /* Check hostkey file size, read entire thing into memory */ |
294 | if (GNUNET_OK != GNUNET_DISK_file_size (filename, &fs, GNUNET_YES, GNUNET_YES)) | 296 | if (GNUNET_OK != |
297 | GNUNET_DISK_file_size (filename, | ||
298 | &fs, | ||
299 | GNUNET_YES, | ||
300 | GNUNET_YES)) | ||
295 | fs = 0; | 301 | fs = 0; |
296 | if (0 == fs) | 302 | if (0 == fs) |
297 | { | 303 | { |
@@ -307,15 +313,22 @@ print_key (const char *filename) | |||
307 | filename); | 313 | filename); |
308 | return; | 314 | return; |
309 | } | 315 | } |
310 | fd = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_READ, | 316 | fd = GNUNET_DISK_file_open (filename, |
311 | GNUNET_DISK_PERM_NONE); | 317 | GNUNET_DISK_OPEN_READ, |
318 | GNUNET_DISK_PERM_NONE); | ||
312 | if (NULL == fd) | 319 | if (NULL == fd) |
313 | { | 320 | { |
314 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "open", filename); | 321 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, |
322 | "open", | ||
323 | filename); | ||
315 | return; | 324 | return; |
316 | } | 325 | } |
317 | hostkeys_data = GNUNET_malloc (fs); | 326 | hostkeys_data = GNUNET_malloc (fs); |
318 | if (fs != GNUNET_DISK_file_read (fd, hostkeys_data, fs)) | 327 | sret = GNUNET_DISK_file_read (fd, |
328 | hostkeys_data, | ||
329 | fs); | ||
330 | if ( (sret < 0) || | ||
331 | (fs != (size_t) sret) ) | ||
319 | { | 332 | { |
320 | fprintf (stderr, | 333 | fprintf (stderr, |
321 | _("Could not read hostkey file: %s\n"), | 334 | _("Could not read hostkey file: %s\n"), |
@@ -351,15 +364,21 @@ print_key (const char *filename) | |||
351 | /** | 364 | /** |
352 | * Main function that will be run by the scheduler. | 365 | * Main function that will be run by the scheduler. |
353 | * | 366 | * |
354 | * @param cls closure | 367 | * @param cls closure, NULL |
355 | * @param args remaining command-line arguments | 368 | * @param args remaining command-line arguments |
356 | * @param cfgfile name of the configuration file used (for saving, can be NULL!) | 369 | * @param cfgfile name of the configuration file used (for saving, can be NULL!) |
357 | * @param cfg configuration | 370 | * @param cfg configuration |
358 | */ | 371 | */ |
359 | static void | 372 | static void |
360 | run (void *cls, char *const *args, const char *cfgfile, | 373 | run (void *cls, |
374 | char *const *args, | ||
375 | const char *cfgfile, | ||
361 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 376 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
362 | { | 377 | { |
378 | (void) cls; | ||
379 | (void) cfgfile; | ||
380 | (void) cfg; | ||
381 | |||
363 | if (print_examples_flag) | 382 | if (print_examples_flag) |
364 | { | 383 | { |
365 | print_examples (); | 384 | print_examples (); |
diff --git a/src/util/gnunet-resolver.c b/src/util/gnunet-resolver.c index 7ffafee32..4954e0398 100644 --- a/src/util/gnunet-resolver.c +++ b/src/util/gnunet-resolver.c | |||
@@ -46,9 +46,12 @@ static void | |||
46 | print_hostname (void *cls, | 46 | print_hostname (void *cls, |
47 | const char *hostname) | 47 | const char *hostname) |
48 | { | 48 | { |
49 | (void) cls; | ||
49 | if (NULL == hostname) | 50 | if (NULL == hostname) |
50 | return; | 51 | return; |
51 | FPRINTF (stdout, "%s\n", hostname); | 52 | FPRINTF (stdout, |
53 | "%s\n", | ||
54 | hostname); | ||
52 | } | 55 | } |
53 | 56 | ||
54 | 57 | ||
@@ -60,11 +63,17 @@ print_hostname (void *cls, | |||
60 | * @param addrlen length of the address | 63 | * @param addrlen length of the address |
61 | */ | 64 | */ |
62 | static void | 65 | static void |
63 | print_sockaddr (void *cls, const struct sockaddr *addr, socklen_t addrlen) | 66 | print_sockaddr (void *cls, |
67 | const struct sockaddr *addr, | ||
68 | socklen_t addrlen) | ||
64 | { | 69 | { |
70 | (void) cls; | ||
65 | if (NULL == addr) | 71 | if (NULL == addr) |
66 | return; | 72 | return; |
67 | FPRINTF (stdout, "%s\n", GNUNET_a2s (addr, addrlen)); | 73 | FPRINTF (stdout, |
74 | "%s\n", | ||
75 | GNUNET_a2s (addr, | ||
76 | addrlen)); | ||
68 | } | 77 | } |
69 | 78 | ||
70 | 79 | ||
@@ -77,7 +86,9 @@ print_sockaddr (void *cls, const struct sockaddr *addr, socklen_t addrlen) | |||
77 | * @param cfg configuration | 86 | * @param cfg configuration |
78 | */ | 87 | */ |
79 | static void | 88 | static void |
80 | run (void *cls, char *const *args, const char *cfgfile, | 89 | run (void *cls, |
90 | char *const *args, | ||
91 | const char *cfgfile, | ||
81 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 92 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
82 | { | 93 | { |
83 | const struct sockaddr *sa; | 94 | const struct sockaddr *sa; |
@@ -85,11 +96,18 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
85 | struct sockaddr_in v4; | 96 | struct sockaddr_in v4; |
86 | struct sockaddr_in6 v6; | 97 | struct sockaddr_in6 v6; |
87 | 98 | ||
88 | if (args[0] == NULL) | 99 | (void) cls; |
100 | (void) cfgfile; | ||
101 | (void) cfg; | ||
102 | if (NULL == args[0]) | ||
89 | return; | 103 | return; |
90 | if (! reverse) | 104 | if (! reverse) |
91 | { | 105 | { |
92 | GNUNET_RESOLVER_ip_get (args[0], AF_UNSPEC, GET_TIMEOUT, &print_sockaddr, NULL); | 106 | GNUNET_RESOLVER_ip_get (args[0], |
107 | AF_UNSPEC, | ||
108 | GET_TIMEOUT, | ||
109 | &print_sockaddr, | ||
110 | NULL); | ||
93 | return; | 111 | return; |
94 | } | 112 | } |
95 | 113 | ||
diff --git a/src/util/gnunet-service-resolver.c b/src/util/gnunet-service-resolver.c index d26bdd212..ccb592349 100644 --- a/src/util/gnunet-service-resolver.c +++ b/src/util/gnunet-service-resolver.c | |||
@@ -582,7 +582,7 @@ get_ip_from_hostname (struct GNUNET_SERVICE_Client *client, | |||
582 | /** | 582 | /** |
583 | * Verify well-formedness of GET-message. | 583 | * Verify well-formedness of GET-message. |
584 | * | 584 | * |
585 | * @param cls closure | 585 | * @param cls closure, unused |
586 | * @param get the actual message | 586 | * @param get the actual message |
587 | * @return #GNUNET_OK if @a get is well-formed | 587 | * @return #GNUNET_OK if @a get is well-formed |
588 | */ | 588 | */ |
@@ -594,6 +594,7 @@ check_get (void *cls, | |||
594 | int direction; | 594 | int direction; |
595 | int af; | 595 | int af; |
596 | 596 | ||
597 | (void) cls; | ||
597 | size = ntohs (get->header.size) - sizeof (*get); | 598 | size = ntohs (get->header.size) - sizeof (*get); |
598 | direction = ntohl (get->direction); | 599 | direction = ntohl (get->direction); |
599 | if (GNUNET_NO == direction) | 600 | if (GNUNET_NO == direction) |
@@ -688,7 +689,7 @@ handle_get (void *cls, | |||
688 | /** | 689 | /** |
689 | * Callback called when a client connects to the service. | 690 | * Callback called when a client connects to the service. |
690 | * | 691 | * |
691 | * @param cls closure for the service | 692 | * @param cls closure for the service, unused |
692 | * @param c the new client that connected to the service | 693 | * @param c the new client that connected to the service |
693 | * @param mq the message queue used to send messages to the client | 694 | * @param mq the message queue used to send messages to the client |
694 | * @return @a c | 695 | * @return @a c |
@@ -698,6 +699,9 @@ connect_cb (void *cls, | |||
698 | struct GNUNET_SERVICE_Client *c, | 699 | struct GNUNET_SERVICE_Client *c, |
699 | struct GNUNET_MQ_Handle *mq) | 700 | struct GNUNET_MQ_Handle *mq) |
700 | { | 701 | { |
702 | (void) cls; | ||
703 | (void) mq; | ||
704 | |||
701 | return c; | 705 | return c; |
702 | } | 706 | } |
703 | 707 | ||
@@ -714,6 +718,8 @@ disconnect_cb (void *cls, | |||
714 | struct GNUNET_SERVICE_Client *c, | 718 | struct GNUNET_SERVICE_Client *c, |
715 | void *internal_cls) | 719 | void *internal_cls) |
716 | { | 720 | { |
721 | (void) cls; | ||
722 | |||
717 | GNUNET_assert (c == internal_cls); | 723 | GNUNET_assert (c == internal_cls); |
718 | } | 724 | } |
719 | 725 | ||
diff --git a/src/util/network.c b/src/util/network.c index cf5ef3e00..973878f93 100644 --- a/src/util/network.c +++ b/src/util/network.c | |||
@@ -1326,9 +1326,10 @@ GNUNET_NETWORK_fdset_handle_set (struct GNUNET_NETWORK_FDSet *fds, | |||
1326 | #else | 1326 | #else |
1327 | int fd; | 1327 | int fd; |
1328 | 1328 | ||
1329 | GNUNET_DISK_internal_file_handle_ (h, | 1329 | GNUNET_assert (GNUNET_OK == |
1330 | &fd, | 1330 | GNUNET_DISK_internal_file_handle_ (h, |
1331 | sizeof (int)); | 1331 | &fd, |
1332 | sizeof (int))); | ||
1332 | FD_SET (fd, | 1333 | FD_SET (fd, |
1333 | &fds->sds); | 1334 | &fds->sds); |
1334 | fds->nsds = GNUNET_MAX (fd + 1, | 1335 | fds->nsds = GNUNET_MAX (fd + 1, |
@@ -1737,6 +1738,7 @@ GNUNET_NETWORK_test_port_free (int ipproto, | |||
1737 | open_port_str, | 1738 | open_port_str, |
1738 | &hint, | 1739 | &hint, |
1739 | &ret)); | 1740 | &ret)); |
1741 | bind_status = GNUNET_NO; | ||
1740 | for (ai = ret; NULL != ai; ai = ai->ai_next) | 1742 | for (ai = ret; NULL != ai; ai = ai->ai_next) |
1741 | { | 1743 | { |
1742 | socket = GNUNET_NETWORK_socket_create (ai->ai_family, | 1744 | socket = GNUNET_NETWORK_socket_create (ai->ai_family, |
diff --git a/src/util/os_installation.c b/src/util/os_installation.c index 1226c5966..2e35de681 100644 --- a/src/util/os_installation.c +++ b/src/util/os_installation.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2006-2016 GNUnet e.V. | 3 | Copyright (C) 2006-2018 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 |
@@ -152,14 +152,21 @@ get_path_from_proc_exe () | |||
152 | ssize_t size; | 152 | ssize_t size; |
153 | char *lep; | 153 | char *lep; |
154 | 154 | ||
155 | GNUNET_snprintf (fn, sizeof (fn), "/proc/%u/exe", getpid ()); | 155 | GNUNET_snprintf (fn, |
156 | size = readlink (fn, lnk, sizeof (lnk) - 1); | 156 | sizeof (fn), |
157 | "/proc/%u/exe", | ||
158 | getpid ()); | ||
159 | size = readlink (fn, | ||
160 | lnk, | ||
161 | sizeof (lnk) - 1); | ||
157 | if (size <= 0) | 162 | if (size <= 0) |
158 | { | 163 | { |
159 | LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR, "readlink", fn); | 164 | LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR, |
165 | "readlink", | ||
166 | fn); | ||
160 | return NULL; | 167 | return NULL; |
161 | } | 168 | } |
162 | GNUNET_assert (size < sizeof (lnk)); | 169 | GNUNET_assert ( ((size_t) size) < sizeof (lnk)); |
163 | lnk[size] = '\0'; | 170 | lnk[size] = '\0'; |
164 | while ((lnk[size] != '/') && (size > 0)) | 171 | while ((lnk[size] != '/') && (size > 0)) |
165 | size--; | 172 | size--; |
@@ -167,12 +174,13 @@ get_path_from_proc_exe () | |||
167 | "/%s/libexec/", | 174 | "/%s/libexec/", |
168 | current_pd->project_dirname); | 175 | current_pd->project_dirname); |
169 | /* test for being in lib/gnunet/libexec/ or lib/MULTIARCH/gnunet/libexec */ | 176 | /* test for being in lib/gnunet/libexec/ or lib/MULTIARCH/gnunet/libexec */ |
170 | if ( (size > strlen (lep)) && | 177 | if ( (((size_t) size) > strlen (lep)) && |
171 | (0 == strcmp (lep, | 178 | (0 == strcmp (lep, |
172 | &lnk[size - strlen (lep)])) ) | 179 | &lnk[size - strlen (lep)])) ) |
173 | size -= strlen (lep) - 1; | 180 | size -= strlen (lep) - 1; |
174 | GNUNET_free (lep); | 181 | GNUNET_free (lep); |
175 | if ((size < 4) || (lnk[size - 4] != '/')) | 182 | if ( (size < 4) || |
183 | (lnk[size - 4] != '/') ) | ||
176 | { | 184 | { |
177 | /* not installed in "/bin/" -- binary path probably useless */ | 185 | /* not installed in "/bin/" -- binary path probably useless */ |
178 | return NULL; | 186 | return NULL; |
@@ -903,6 +911,7 @@ GNUNET_OS_check_helper_binary (const char *binary, | |||
903 | if (check_suid) | 911 | if (check_suid) |
904 | { | 912 | { |
905 | #ifndef MINGW | 913 | #ifndef MINGW |
914 | (void) params; | ||
906 | if ( (0 != (statbuf.st_mode & S_ISUID)) && | 915 | if ( (0 != (statbuf.st_mode & S_ISUID)) && |
907 | (0 == statbuf.st_uid) ) | 916 | (0 == statbuf.st_uid) ) |
908 | { | 917 | { |
diff --git a/src/util/os_priority.c b/src/util/os_priority.c index 2c4f7ca09..98998b520 100644 --- a/src/util/os_priority.c +++ b/src/util/os_priority.c | |||
@@ -154,6 +154,7 @@ GNUNET_OS_install_parent_control_handler (void *cls) | |||
154 | struct GNUNET_DISK_FileHandle *control_pipe; | 154 | struct GNUNET_DISK_FileHandle *control_pipe; |
155 | uint64_t pipe_fd; | 155 | uint64_t pipe_fd; |
156 | 156 | ||
157 | (void) cls; | ||
157 | if (NULL != pch) | 158 | if (NULL != pch) |
158 | { | 159 | { |
159 | /* already done, we've been called twice... */ | 160 | /* already done, we've been called twice... */ |
diff --git a/src/util/peer.c b/src/util/peer.c index b637dc229..b1c65fbcf 100644 --- a/src/util/peer.c +++ b/src/util/peer.c | |||
@@ -201,7 +201,8 @@ GNUNET_PEER_change_rc (GNUNET_PEER_Id id, int delta) | |||
201 | return; | 201 | return; |
202 | GNUNET_assert (id < size); | 202 | GNUNET_assert (id < size); |
203 | GNUNET_assert (table[id]->rc > 0); | 203 | GNUNET_assert (table[id]->rc > 0); |
204 | GNUNET_assert ((delta >= 0) || (table[id]->rc >= -delta)); | 204 | GNUNET_assert ( (delta >= 0) || |
205 | (table[id]->rc >= (unsigned int) (-delta)) ); | ||
205 | table[id]->rc += delta; | 206 | table[id]->rc += delta; |
206 | if (0 == table[id]->rc) | 207 | if (0 == table[id]->rc) |
207 | { | 208 | { |
diff --git a/src/util/program.c b/src/util/program.c index 233792387..9e3037b8b 100644 --- a/src/util/program.c +++ b/src/util/program.c | |||
@@ -74,6 +74,7 @@ struct CommandContext | |||
74 | static void | 74 | static void |
75 | shutdown_task (void *cls) | 75 | shutdown_task (void *cls) |
76 | { | 76 | { |
77 | (void) cls; | ||
77 | GNUNET_SPEEDUP_stop_ (); | 78 | GNUNET_SPEEDUP_stop_ (); |
78 | } | 79 | } |
79 | 80 | ||
diff --git a/src/util/resolver_api.c b/src/util/resolver_api.c index 84f541ba0..bd46b4fbb 100644 --- a/src/util/resolver_api.c +++ b/src/util/resolver_api.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009-2016 GNUnet e.V. | 3 | Copyright (C) 2009-2018 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 |
@@ -214,7 +214,8 @@ check_config () | |||
214 | for (unsigned int i = 0; | 214 | for (unsigned int i = 0; |
215 | NULL != loopback[i]; | 215 | NULL != loopback[i]; |
216 | i++) | 216 | i++) |
217 | if (0 == strcasecmp (loopback[i], hostname)) | 217 | if (0 == strcasecmp (loopback[i], |
218 | hostname)) | ||
218 | { | 219 | { |
219 | GNUNET_free (hostname); | 220 | GNUNET_free (hostname); |
220 | return GNUNET_OK; | 221 | return GNUNET_OK; |
@@ -285,6 +286,7 @@ GNUNET_RESOLVER_disconnect () | |||
285 | static void | 286 | static void |
286 | shutdown_task (void *cls) | 287 | shutdown_task (void *cls) |
287 | { | 288 | { |
289 | (void) cls; | ||
288 | s_task = NULL; | 290 | s_task = NULL; |
289 | GNUNET_RESOLVER_disconnect (); | 291 | GNUNET_RESOLVER_disconnect (); |
290 | backoff = GNUNET_TIME_UNIT_MILLISECONDS; | 292 | backoff = GNUNET_TIME_UNIT_MILLISECONDS; |
@@ -387,10 +389,12 @@ static void | |||
387 | mq_error_handler (void *cls, | 389 | mq_error_handler (void *cls, |
388 | enum GNUNET_MQ_Error error) | 390 | enum GNUNET_MQ_Error error) |
389 | { | 391 | { |
392 | (void) cls; | ||
390 | GNUNET_MQ_destroy (mq); | 393 | GNUNET_MQ_destroy (mq); |
391 | mq = NULL; | 394 | mq = NULL; |
392 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 395 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
393 | "MQ error, reconnecting\n"); | 396 | "MQ error %d, reconnecting\n", |
397 | error); | ||
394 | reconnect (); | 398 | reconnect (); |
395 | } | 399 | } |
396 | 400 | ||
@@ -449,6 +453,9 @@ static int | |||
449 | check_response (void *cls, | 453 | check_response (void *cls, |
450 | const struct GNUNET_MessageHeader *msg) | 454 | const struct GNUNET_MessageHeader *msg) |
451 | { | 455 | { |
456 | (void) cls; | ||
457 | (void) msg; | ||
458 | |||
452 | /* implemented in #handle_response() for now */ | 459 | /* implemented in #handle_response() for now */ |
453 | return GNUNET_OK; | 460 | return GNUNET_OK; |
454 | } | 461 | } |
@@ -470,6 +477,7 @@ handle_response (void *cls, | |||
470 | uint16_t size; | 477 | uint16_t size; |
471 | char *nret; | 478 | char *nret; |
472 | 479 | ||
480 | (void) cls; | ||
473 | GNUNET_assert (NULL != rh); | 481 | GNUNET_assert (NULL != rh); |
474 | size = ntohs (msg->size); | 482 | size = ntohs (msg->size); |
475 | if (size == sizeof (struct GNUNET_MessageHeader)) | 483 | if (size == sizeof (struct GNUNET_MessageHeader)) |
@@ -743,6 +751,7 @@ reconnect_task (void *cls) | |||
743 | GNUNET_MQ_handler_end () | 751 | GNUNET_MQ_handler_end () |
744 | }; | 752 | }; |
745 | 753 | ||
754 | (void) cls; | ||
746 | r_task = NULL; | 755 | r_task = NULL; |
747 | if (NULL == req_head) | 756 | if (NULL == req_head) |
748 | return; /* no work pending */ | 757 | return; /* no work pending */ |
diff --git a/src/util/scheduler.c b/src/util/scheduler.c index 992f8fdff..2912dd78b 100644 --- a/src/util/scheduler.c +++ b/src/util/scheduler.c | |||
@@ -756,8 +756,8 @@ init_fd_info (struct GNUNET_SCHEDULER_Task *t, | |||
756 | t->fds = fdi; | 756 | t->fds = fdi; |
757 | if (1 == read_nh_len) | 757 | if (1 == read_nh_len) |
758 | { | 758 | { |
759 | GNUNET_assert (NULL != read_nh); | ||
759 | fdi->fd = *read_nh; | 760 | fdi->fd = *read_nh; |
760 | GNUNET_assert (NULL != fdi->fd); | ||
761 | fdi->et = GNUNET_SCHEDULER_ET_IN; | 761 | fdi->et = GNUNET_SCHEDULER_ET_IN; |
762 | fdi->sock = GNUNET_NETWORK_get_fd (*read_nh); | 762 | fdi->sock = GNUNET_NETWORK_get_fd (*read_nh); |
763 | t->read_fd = fdi->sock; | 763 | t->read_fd = fdi->sock; |
@@ -765,8 +765,8 @@ init_fd_info (struct GNUNET_SCHEDULER_Task *t, | |||
765 | } | 765 | } |
766 | else if (1 == write_nh_len) | 766 | else if (1 == write_nh_len) |
767 | { | 767 | { |
768 | GNUNET_assert (NULL != write_nh); | ||
768 | fdi->fd = *write_nh; | 769 | fdi->fd = *write_nh; |
769 | GNUNET_assert (NULL != fdi->fd); | ||
770 | fdi->et = GNUNET_SCHEDULER_ET_OUT; | 770 | fdi->et = GNUNET_SCHEDULER_ET_OUT; |
771 | fdi->sock = GNUNET_NETWORK_get_fd (*write_nh); | 771 | fdi->sock = GNUNET_NETWORK_get_fd (*write_nh); |
772 | t->read_fd = -1; | 772 | t->read_fd = -1; |
@@ -774,8 +774,8 @@ init_fd_info (struct GNUNET_SCHEDULER_Task *t, | |||
774 | } | 774 | } |
775 | else if (1 == read_fh_len) | 775 | else if (1 == read_fh_len) |
776 | { | 776 | { |
777 | GNUNET_assert (NULL != read_fh); | ||
777 | fdi->fh = *read_fh; | 778 | fdi->fh = *read_fh; |
778 | GNUNET_assert (NULL != fdi->fh); | ||
779 | fdi->et = GNUNET_SCHEDULER_ET_IN; | 779 | fdi->et = GNUNET_SCHEDULER_ET_IN; |
780 | fdi->sock = (*read_fh)->fd; // FIXME: does not work under WIN32 | 780 | fdi->sock = (*read_fh)->fd; // FIXME: does not work under WIN32 |
781 | t->read_fd = fdi->sock; | 781 | t->read_fd = fdi->sock; |
@@ -783,8 +783,8 @@ init_fd_info (struct GNUNET_SCHEDULER_Task *t, | |||
783 | } | 783 | } |
784 | else | 784 | else |
785 | { | 785 | { |
786 | GNUNET_assert (NULL != write_fh); | ||
786 | fdi->fh = *write_fh; | 787 | fdi->fh = *write_fh; |
787 | GNUNET_assert (NULL != fdi->fh); | ||
788 | fdi->et = GNUNET_SCHEDULER_ET_OUT; | 788 | fdi->et = GNUNET_SCHEDULER_ET_OUT; |
789 | fdi->sock = (*write_fh)->fd; // FIXME: does not work under WIN32 | 789 | fdi->sock = (*write_fh)->fd; // FIXME: does not work under WIN32 |
790 | t->read_fd = -1; | 790 | t->read_fd = -1; |
@@ -847,20 +847,19 @@ init_fd_info (struct GNUNET_SCHEDULER_Task *t, | |||
847 | * @param et the event type to be set in each FdInfo after calling | 847 | * @param et the event type to be set in each FdInfo after calling |
848 | * @a driver_func on it, or -1 if no updating not desired. | 848 | * @a driver_func on it, or -1 if no updating not desired. |
849 | */ | 849 | */ |
850 | void driver_add_multiple (struct GNUNET_SCHEDULER_Task *t, | 850 | static void |
851 | enum GNUNET_SCHEDULER_EventType et) | 851 | driver_add_multiple (struct GNUNET_SCHEDULER_Task *t) |
852 | { | 852 | { |
853 | struct GNUNET_SCHEDULER_FdInfo *fdi; | 853 | struct GNUNET_SCHEDULER_FdInfo *fdi; |
854 | int success = GNUNET_YES; | 854 | int success = GNUNET_YES; |
855 | 855 | ||
856 | for (int i = 0; i != t->fds_len; ++i) | 856 | for (unsigned int i = 0; i != t->fds_len; ++i) |
857 | { | 857 | { |
858 | fdi = &t->fds[i]; | 858 | fdi = &t->fds[i]; |
859 | success = scheduler_driver->add (scheduler_driver->cls, t, fdi) && success; | 859 | success = scheduler_driver->add (scheduler_driver->cls, |
860 | if (et != -1) | 860 | t, |
861 | { | 861 | fdi) && success; |
862 | fdi->et = et; | 862 | fdi->et = GNUNET_SCHEDULER_ET_NONE; |
863 | } | ||
864 | } | 863 | } |
865 | if (GNUNET_YES != success) | 864 | if (GNUNET_YES != success) |
866 | { | 865 | { |
@@ -870,12 +869,13 @@ void driver_add_multiple (struct GNUNET_SCHEDULER_Task *t, | |||
870 | } | 869 | } |
871 | 870 | ||
872 | 871 | ||
873 | void | 872 | static void |
874 | shutdown_cb (void *cls) | 873 | shutdown_cb (void *cls) |
875 | { | 874 | { |
876 | char c; | 875 | char c; |
877 | const struct GNUNET_DISK_FileHandle *pr; | 876 | const struct GNUNET_DISK_FileHandle *pr; |
878 | 877 | ||
878 | (void) cls; | ||
879 | pr = GNUNET_DISK_pipe_handle (shutdown_pipe_handle, | 879 | pr = GNUNET_DISK_pipe_handle (shutdown_pipe_handle, |
880 | GNUNET_DISK_PIPE_END_READ); | 880 | GNUNET_DISK_PIPE_END_READ); |
881 | GNUNET_assert (! GNUNET_DISK_handle_invalid (pr)); | 881 | GNUNET_assert (! GNUNET_DISK_handle_invalid (pr)); |
@@ -975,6 +975,8 @@ init_backtrace (struct GNUNET_SCHEDULER_Task *t) | |||
975 | backtrace_symbols (backtrace_array, | 975 | backtrace_symbols (backtrace_array, |
976 | t->num_backtrace_strings); | 976 | t->num_backtrace_strings); |
977 | dump_backtrace (t); | 977 | dump_backtrace (t); |
978 | #else | ||
979 | (void) t; | ||
978 | #endif | 980 | #endif |
979 | } | 981 | } |
980 | 982 | ||
@@ -1375,7 +1377,7 @@ add_without_sets (struct GNUNET_TIME_Relative delay, | |||
1375 | GNUNET_CONTAINER_DLL_insert (pending_head, | 1377 | GNUNET_CONTAINER_DLL_insert (pending_head, |
1376 | pending_tail, | 1378 | pending_tail, |
1377 | t); | 1379 | t); |
1378 | driver_add_multiple (t, GNUNET_SCHEDULER_ET_NONE); | 1380 | driver_add_multiple (t); |
1379 | max_priority_added = GNUNET_MAX (max_priority_added, | 1381 | max_priority_added = GNUNET_MAX (max_priority_added, |
1380 | t->priority); | 1382 | t->priority); |
1381 | init_backtrace (t); | 1383 | init_backtrace (t); |
@@ -1664,14 +1666,15 @@ extract_handles (struct GNUNET_SCHEDULER_Task *t, | |||
1664 | // in fdset must be handled separately | 1666 | // in fdset must be handled separately |
1665 | const struct GNUNET_NETWORK_Handle **nhandles; | 1667 | const struct GNUNET_NETWORK_Handle **nhandles; |
1666 | const struct GNUNET_DISK_FileHandle **fhandles; | 1668 | const struct GNUNET_DISK_FileHandle **fhandles; |
1667 | unsigned int nhandles_len, fhandles_len; | 1669 | unsigned int nhandles_len; |
1668 | int sock; | 1670 | unsigned int fhandles_len; |
1669 | 1671 | ||
1672 | (void) t; | ||
1670 | nhandles = NULL; | 1673 | nhandles = NULL; |
1671 | fhandles = NULL; | 1674 | fhandles = NULL; |
1672 | nhandles_len = 0; | 1675 | nhandles_len = 0; |
1673 | fhandles_len = 0; | 1676 | fhandles_len = 0; |
1674 | for (sock = 0; sock != fdset->nsds; ++sock) | 1677 | for (int sock = 0; sock != fdset->nsds; ++sock) |
1675 | { | 1678 | { |
1676 | if (GNUNET_YES == GNUNET_NETWORK_fdset_test_native (fdset, sock)) | 1679 | if (GNUNET_YES == GNUNET_NETWORK_fdset_test_native (fdset, sock)) |
1677 | { | 1680 | { |
@@ -1747,8 +1750,11 @@ GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio, | |||
1747 | const struct GNUNET_DISK_FileHandle **write_fhandles; | 1750 | const struct GNUNET_DISK_FileHandle **write_fhandles; |
1748 | unsigned int read_nhandles_len, write_nhandles_len, | 1751 | unsigned int read_nhandles_len, write_nhandles_len, |
1749 | read_fhandles_len, write_fhandles_len; | 1752 | read_fhandles_len, write_fhandles_len; |
1753 | int no_fdsets = (NULL == rs) && (NULL == ws); | ||
1754 | int no_socket_descriptors = | ||
1755 | ((NULL != rs) && (0 == rs->nsds)) && ((NULL != ws) && (0 == ws->nsds)); | ||
1750 | 1756 | ||
1751 | if (((NULL == rs) && (NULL == ws)) || ((0 == rs->nsds) && (0 == ws->nsds))) | 1757 | if (no_fdsets || no_socket_descriptors) |
1752 | return GNUNET_SCHEDULER_add_delayed_with_priority (delay, | 1758 | return GNUNET_SCHEDULER_add_delayed_with_priority (delay, |
1753 | prio, | 1759 | prio, |
1754 | task, | 1760 | task, |
@@ -1816,7 +1822,7 @@ GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio, | |||
1816 | GNUNET_CONTAINER_DLL_insert (pending_head, | 1822 | GNUNET_CONTAINER_DLL_insert (pending_head, |
1817 | pending_tail, | 1823 | pending_tail, |
1818 | t); | 1824 | t); |
1819 | driver_add_multiple (t, GNUNET_SCHEDULER_ET_NONE); | 1825 | driver_add_multiple (t); |
1820 | max_priority_added = GNUNET_MAX (max_priority_added, | 1826 | max_priority_added = GNUNET_MAX (max_priority_added, |
1821 | t->priority); | 1827 | t->priority); |
1822 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1828 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
@@ -1969,7 +1975,7 @@ GNUNET_SCHEDULER_run_from_driver (struct GNUNET_SCHEDULER_Handle *sh) | |||
1969 | // FIXME: do we have to remove FdInfos from fds if they are not ready? | 1975 | // FIXME: do we have to remove FdInfos from fds if they are not ready? |
1970 | tc.fds_len = pos->fds_len; | 1976 | tc.fds_len = pos->fds_len; |
1971 | tc.fds = pos->fds; | 1977 | tc.fds = pos->fds; |
1972 | for (int i = 0; i != pos->fds_len; ++i) | 1978 | for (unsigned int i = 0; i != pos->fds_len; ++i) |
1973 | { | 1979 | { |
1974 | struct GNUNET_SCHEDULER_FdInfo *fdi = &pos->fds[i]; | 1980 | struct GNUNET_SCHEDULER_FdInfo *fdi = &pos->fds[i]; |
1975 | if (0 != (GNUNET_SCHEDULER_ET_IN & fdi->et)) | 1981 | if (0 != (GNUNET_SCHEDULER_ET_IN & fdi->et)) |
diff --git a/src/util/service.c b/src/util/service.c index b4eb33caa..1156093f4 100644 --- a/src/util/service.c +++ b/src/util/service.c | |||
@@ -1978,7 +1978,7 @@ do_send (void *cls) | |||
1978 | GNUNET_MQ_impl_send_in_flight (client->mq); | 1978 | GNUNET_MQ_impl_send_in_flight (client->mq); |
1979 | } | 1979 | } |
1980 | client->msg_pos += ret; | 1980 | client->msg_pos += ret; |
1981 | if (left > ret) | 1981 | if (left > (size_t) ret) |
1982 | { | 1982 | { |
1983 | GNUNET_assert (NULL == client->drop_task); | 1983 | GNUNET_assert (NULL == client->drop_task); |
1984 | client->send_task | 1984 | client->send_task |
@@ -2007,6 +2007,7 @@ service_mq_send (struct GNUNET_MQ_Handle *mq, | |||
2007 | { | 2007 | { |
2008 | struct GNUNET_SERVICE_Client *client = impl_state; | 2008 | struct GNUNET_SERVICE_Client *client = impl_state; |
2009 | 2009 | ||
2010 | (void) mq; | ||
2010 | if (NULL != client->drop_task) | 2011 | if (NULL != client->drop_task) |
2011 | return; /* we're going down right now, do not try to send */ | 2012 | return; /* we're going down right now, do not try to send */ |
2012 | GNUNET_assert (NULL == client->send_task); | 2013 | GNUNET_assert (NULL == client->send_task); |
@@ -2036,6 +2037,7 @@ service_mq_cancel (struct GNUNET_MQ_Handle *mq, | |||
2036 | { | 2037 | { |
2037 | struct GNUNET_SERVICE_Client *client = impl_state; | 2038 | struct GNUNET_SERVICE_Client *client = impl_state; |
2038 | 2039 | ||
2040 | (void) mq; | ||
2039 | GNUNET_assert (0 == client->msg_pos); | 2041 | GNUNET_assert (0 == client->msg_pos); |
2040 | client->msg = NULL; | 2042 | client->msg = NULL; |
2041 | GNUNET_SCHEDULER_cancel (client->send_task); | 2043 | GNUNET_SCHEDULER_cancel (client->send_task); |
diff --git a/src/util/speedup.c b/src/util/speedup.c index c6a4cf678..f5e81f16b 100644 --- a/src/util/speedup.c +++ b/src/util/speedup.c | |||
@@ -42,6 +42,7 @@ do_speedup (void *cls) | |||
42 | { | 42 | { |
43 | static long long current_offset; | 43 | static long long current_offset; |
44 | 44 | ||
45 | (void) cls; | ||
45 | speedup_task = NULL; | 46 | speedup_task = NULL; |
46 | current_offset += delta.rel_value_us; | 47 | current_offset += delta.rel_value_us; |
47 | GNUNET_TIME_set_offset (current_offset); | 48 | GNUNET_TIME_set_offset (current_offset); |
diff --git a/src/util/strings.c b/src/util/strings.c index f554a9e83..4cfcd63b3 100644 --- a/src/util/strings.c +++ b/src/util/strings.c | |||
@@ -1069,11 +1069,13 @@ GNUNET_STRINGS_string_to_data (const char *enc, size_t enclen, | |||
1069 | * (if they weren't NULL). | 1069 | * (if they weren't NULL). |
1070 | */ | 1070 | */ |
1071 | int | 1071 | int |
1072 | GNUNET_STRINGS_parse_uri (const char *path, char **scheme_part, | 1072 | GNUNET_STRINGS_parse_uri (const char *path, |
1073 | const char **path_part) | 1073 | char **scheme_part, |
1074 | const char **path_part) | ||
1074 | { | 1075 | { |
1075 | size_t len; | 1076 | size_t len; |
1076 | int i, end; | 1077 | size_t i; |
1078 | int end; | ||
1077 | int pp_state = 0; | 1079 | int pp_state = 0; |
1078 | const char *post_scheme_part = NULL; | 1080 | const char *post_scheme_part = NULL; |
1079 | len = strlen (path); | 1081 | len = strlen (path); |
@@ -1082,7 +1084,7 @@ GNUNET_STRINGS_parse_uri (const char *path, char **scheme_part, | |||
1082 | switch (pp_state) | 1084 | switch (pp_state) |
1083 | { | 1085 | { |
1084 | case 0: | 1086 | case 0: |
1085 | if (path[i] == ':' && i > 0) | 1087 | if ( (path[i] == ':') && (i > 0) ) |
1086 | { | 1088 | { |
1087 | pp_state += 1; | 1089 | pp_state += 1; |
1088 | continue; | 1090 | continue; |