diff options
author | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2017-10-05 17:11:17 +0200 |
---|---|---|
committer | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2017-10-05 17:11:17 +0200 |
commit | 2b0c260c3ceab5b2d5a4c3a04f7e2a0a357e9d75 (patch) | |
tree | 1d2c15ff0d1a587c16ce79de5a87b5baf3ba472b /src | |
parent | ca10195d9af33c557b57f16b8bb93df1066ab0ee (diff) | |
parent | 664aca2d29b15dd75967d2bb0298caf750993b6f (diff) | |
download | gnunet-2b0c260c3ceab5b2d5a4c3a04f7e2a0a357e9d75.tar.gz gnunet-2b0c260c3ceab5b2d5a4c3a04f7e2a0a357e9d75.zip |
Merge remote-tracking branch 'origin/master' into identity_abe
Diffstat (limited to 'src')
-rw-r--r-- | src/datastore/plugin_datastore_sqlite.c | 29 | ||||
-rw-r--r-- | src/fs/plugin_block_fs.c | 17 | ||||
-rw-r--r-- | src/include/gnunet_set_service.h | 5 | ||||
-rw-r--r-- | src/multicast/.gitignore | 2 | ||||
-rw-r--r-- | src/peerinfo/peerinfo_api.c | 5 | ||||
-rw-r--r-- | src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c | 8 | ||||
-rw-r--r-- | src/scalarproduct/gnunet-service-scalarproduct_alice.c | 8 | ||||
-rw-r--r-- | src/set/gnunet-service-set.c | 39 | ||||
-rw-r--r-- | src/set/test_set_intersection_result_full.c | 2 | ||||
-rw-r--r-- | src/set/test_set_union_result_symmetric.c | 2 | ||||
-rw-r--r-- | src/social/test_social.c | 166 | ||||
-rw-r--r-- | src/transport/tcp_server_legacy.c | 20 | ||||
-rw-r--r-- | src/util/.gitignore | 1 | ||||
-rw-r--r-- | src/util/network.c | 16 | ||||
-rw-r--r-- | src/util/scheduler.c | 14 |
15 files changed, 194 insertions, 140 deletions
diff --git a/src/datastore/plugin_datastore_sqlite.c b/src/datastore/plugin_datastore_sqlite.c index 77b8409cd..cc56f5959 100644 --- a/src/datastore/plugin_datastore_sqlite.c +++ b/src/datastore/plugin_datastore_sqlite.c | |||
@@ -185,21 +185,22 @@ static void | |||
185 | create_indices (sqlite3 * dbh) | 185 | create_indices (sqlite3 * dbh) |
186 | { | 186 | { |
187 | /* create indices */ | 187 | /* create indices */ |
188 | if ((SQLITE_OK != | 188 | if (0 != |
189 | (SQLITE_OK != | ||
189 | sqlite3_exec (dbh, "CREATE INDEX IF NOT EXISTS idx_hash ON gn091 (hash)", | 190 | sqlite3_exec (dbh, "CREATE INDEX IF NOT EXISTS idx_hash ON gn091 (hash)", |
190 | NULL, NULL, NULL)) || | 191 | NULL, NULL, NULL)) + |
191 | (SQLITE_OK != | 192 | (SQLITE_OK != |
192 | sqlite3_exec (dbh, | 193 | sqlite3_exec (dbh, |
193 | "CREATE INDEX IF NOT EXISTS idx_anon_type ON gn091 (anonLevel ASC,type)", | 194 | "CREATE INDEX IF NOT EXISTS idx_anon_type ON gn091 (anonLevel ASC,type)", |
194 | NULL, NULL, NULL)) || | 195 | NULL, NULL, NULL)) + |
195 | (SQLITE_OK != | 196 | (SQLITE_OK != |
196 | sqlite3_exec (dbh, | 197 | sqlite3_exec (dbh, |
197 | "CREATE INDEX IF NOT EXISTS idx_expire ON gn091 (expire ASC)", | 198 | "CREATE INDEX IF NOT EXISTS idx_expire ON gn091 (expire ASC)", |
198 | NULL, NULL, NULL)) || | 199 | NULL, NULL, NULL)) + |
199 | (SQLITE_OK != | 200 | (SQLITE_OK != |
200 | sqlite3_exec (dbh, | 201 | sqlite3_exec (dbh, |
201 | "CREATE INDEX IF NOT EXISTS idx_repl_rvalue ON gn091 (repl,rvalue)", | 202 | "CREATE INDEX IF NOT EXISTS idx_repl_rvalue ON gn091 (repl,rvalue)", |
202 | NULL, NULL, NULL))) | 203 | NULL, NULL, NULL)) ) |
203 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, "sqlite", | 204 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, "sqlite", |
204 | "Failed to create indices: %s\n", sqlite3_errmsg (dbh)); | 205 | "Failed to create indices: %s\n", sqlite3_errmsg (dbh)); |
205 | } | 206 | } |
@@ -354,40 +355,24 @@ database_setup (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
354 | (SQLITE_OK != | 355 | (SQLITE_OK != |
355 | sq_prepare (plugin->dbh, | 356 | sq_prepare (plugin->dbh, |
356 | "SELECT " RESULT_COLUMNS " FROM gn091 " | 357 | "SELECT " RESULT_COLUMNS " FROM gn091 " |
357 | #if SQLITE_VERSION_NUMBER >= 3007000 | ||
358 | "INDEXED BY idx_repl_rvalue " | ||
359 | #endif | ||
360 | "WHERE repl=?2 AND " " (rvalue>=?1 OR " | 358 | "WHERE repl=?2 AND " " (rvalue>=?1 OR " |
361 | " NOT EXISTS (SELECT 1 FROM gn091 " | 359 | " NOT EXISTS (SELECT 1 FROM gn091 " |
362 | #if SQLITE_VERSION_NUMBER >= 3007000 | ||
363 | "INDEXED BY idx_repl_rvalue " | ||
364 | #endif | ||
365 | "WHERE repl=?2 AND rvalue>=?1 LIMIT 1) ) " | 360 | "WHERE repl=?2 AND rvalue>=?1 LIMIT 1) ) " |
366 | "ORDER BY rvalue ASC LIMIT 1", | 361 | "ORDER BY rvalue ASC LIMIT 1", |
367 | &plugin->selRepl)) || | 362 | &plugin->selRepl)) || |
368 | (SQLITE_OK != | 363 | (SQLITE_OK != |
369 | sq_prepare (plugin->dbh, | 364 | sq_prepare (plugin->dbh, |
370 | "SELECT MAX(repl) FROM gn091" | 365 | "SELECT MAX(repl) FROM gn091", |
371 | #if SQLITE_VERSION_NUMBER >= 3007000 | ||
372 | " INDEXED BY idx_repl_rvalue" | ||
373 | #endif | ||
374 | "", | ||
375 | &plugin->maxRepl)) || | 366 | &plugin->maxRepl)) || |
376 | (SQLITE_OK != | 367 | (SQLITE_OK != |
377 | sq_prepare (plugin->dbh, | 368 | sq_prepare (plugin->dbh, |
378 | "SELECT " RESULT_COLUMNS " FROM gn091 " | 369 | "SELECT " RESULT_COLUMNS " FROM gn091 " |
379 | #if SQLITE_VERSION_NUMBER >= 3007000 | ||
380 | "INDEXED BY idx_expire " | ||
381 | #endif | ||
382 | "WHERE NOT EXISTS (SELECT 1 FROM gn091 WHERE expire < ?1 LIMIT 1) OR (expire < ?1) " | 370 | "WHERE NOT EXISTS (SELECT 1 FROM gn091 WHERE expire < ?1 LIMIT 1) OR (expire < ?1) " |
383 | "ORDER BY expire ASC LIMIT 1", | 371 | "ORDER BY expire ASC LIMIT 1", |
384 | &plugin->selExpi)) || | 372 | &plugin->selExpi)) || |
385 | (SQLITE_OK != | 373 | (SQLITE_OK != |
386 | sq_prepare (plugin->dbh, | 374 | sq_prepare (plugin->dbh, |
387 | "SELECT " RESULT_COLUMNS " FROM gn091 " | 375 | "SELECT " RESULT_COLUMNS " FROM gn091 " |
388 | #if SQLITE_VERSION_NUMBER >= 3007000 | ||
389 | "INDEXED BY idx_anon_type " | ||
390 | #endif | ||
391 | "WHERE _ROWID_ >= ? AND " | 376 | "WHERE _ROWID_ >= ? AND " |
392 | "anonLevel = 0 AND " | 377 | "anonLevel = 0 AND " |
393 | "type = ? " | 378 | "type = ? " |
diff --git a/src/fs/plugin_block_fs.c b/src/fs/plugin_block_fs.c index 902519f15..c762835ce 100644 --- a/src/fs/plugin_block_fs.c +++ b/src/fs/plugin_block_fs.c | |||
@@ -71,17 +71,22 @@ block_plugin_fs_create_group (void *cls, | |||
71 | return NULL; | 71 | return NULL; |
72 | case GNUNET_BLOCK_TYPE_FS_UBLOCK: | 72 | case GNUNET_BLOCK_TYPE_FS_UBLOCK: |
73 | guard = va_arg (va, const char *); | 73 | guard = va_arg (va, const char *); |
74 | if (0 != strcmp (guard, | 74 | if (0 == strcmp (guard, |
75 | "seen-set-size")) | 75 | "seen-set-size")) |
76 | { | 76 | { |
77 | /* va-args invalid! bad bug, complain! */ | 77 | size = GNUNET_BLOCK_GROUP_compute_bloomfilter_size (va_arg (va, unsigned int), |
78 | GNUNET_break (0); | 78 | BLOOMFILTER_K); |
79 | size = 8; | 79 | } |
80 | else if (0 == strcmp (guard, | ||
81 | "filter-size")) | ||
82 | { | ||
83 | size = va_arg (va, unsigned int); | ||
80 | } | 84 | } |
81 | else | 85 | else |
82 | { | 86 | { |
83 | size = GNUNET_BLOCK_GROUP_compute_bloomfilter_size (va_arg (va, unsigned int), | 87 | /* va-args invalid! bad bug, complain! */ |
84 | BLOOMFILTER_K); | 88 | GNUNET_break (0); |
89 | size = 8; | ||
85 | } | 90 | } |
86 | if (0 == size) | 91 | if (0 == size) |
87 | size = raw_data_size; /* not for us to determine, use what we got! */ | 92 | size = raw_data_size; /* not for us to determine, use what we got! */ |
diff --git a/src/include/gnunet_set_service.h b/src/include/gnunet_set_service.h index 6e822d82e..a2999aebc 100644 --- a/src/include/gnunet_set_service.h +++ b/src/include/gnunet_set_service.h | |||
@@ -452,6 +452,8 @@ GNUNET_SET_listen (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
452 | /** | 452 | /** |
453 | * Cancel the given listen operation. After calling cancel, the | 453 | * Cancel the given listen operation. After calling cancel, the |
454 | * listen callback for this listen handle will not be called again. | 454 | * listen callback for this listen handle will not be called again. |
455 | * Note that cancelling a listen operation will automatically reject | ||
456 | * all operations that have not yet been accepted. | ||
455 | * | 457 | * |
456 | * @param lh handle for the listen operation | 458 | * @param lh handle for the listen operation |
457 | */ | 459 | */ |
@@ -556,7 +558,8 @@ GNUNET_SET_element_dup (const struct GNUNET_SET_Element *element); | |||
556 | * should be stored | 558 | * should be stored |
557 | */ | 559 | */ |
558 | void | 560 | void |
559 | GNUNET_SET_element_hash (const struct GNUNET_SET_Element *element, struct GNUNET_HashCode *ret_hash); | 561 | GNUNET_SET_element_hash (const struct GNUNET_SET_Element *element, |
562 | struct GNUNET_HashCode *ret_hash); | ||
560 | 563 | ||
561 | 564 | ||
562 | #if 0 /* keep Emacsens' auto-indent happy */ | 565 | #if 0 /* keep Emacsens' auto-indent happy */ |
diff --git a/src/multicast/.gitignore b/src/multicast/.gitignore index 43752ec4b..a97844e81 100644 --- a/src/multicast/.gitignore +++ b/src/multicast/.gitignore | |||
@@ -3,3 +3,5 @@ gnunet-multicast | |||
3 | test_multicast | 3 | test_multicast |
4 | test_multicast_multipeer | 4 | test_multicast_multipeer |
5 | test_multicast_2peers | 5 | test_multicast_2peers |
6 | test_multicast_multipeer_line | ||
7 | test_multicast_multipeer_star | ||
diff --git a/src/peerinfo/peerinfo_api.c b/src/peerinfo/peerinfo_api.c index b75d4e291..8b47ed444 100644 --- a/src/peerinfo/peerinfo_api.c +++ b/src/peerinfo/peerinfo_api.c | |||
@@ -334,11 +334,12 @@ handle_info (void *cls, | |||
334 | { | 334 | { |
335 | struct GNUNET_PEERINFO_Handle *h = cls; | 335 | struct GNUNET_PEERINFO_Handle *h = cls; |
336 | struct GNUNET_PEERINFO_IteratorContext *ic = h->ic_head; | 336 | struct GNUNET_PEERINFO_IteratorContext *ic = h->ic_head; |
337 | const struct GNUNET_HELLO_Message *hello; | 337 | const struct GNUNET_HELLO_Message *hello = NULL; |
338 | uint16_t ms; | 338 | uint16_t ms; |
339 | 339 | ||
340 | ms = ntohs (im->header.size); | 340 | ms = ntohs (im->header.size); |
341 | hello = (0 == ms) ? NULL : (const struct GNUNET_HELLO_Message *) &im[1]; | 341 | if (ms > sizeof (struct InfoMessage)) |
342 | hello = (const struct GNUNET_HELLO_Message *) &im[1]; | ||
342 | if (NULL != ic->callback) | 343 | if (NULL != ic->callback) |
343 | ic->callback (ic->callback_cls, | 344 | ic->callback (ic->callback_cls, |
344 | &im->peer, | 345 | &im->peer, |
diff --git a/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c b/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c index c0b33f8ef..57f275c81 100644 --- a/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c +++ b/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c | |||
@@ -260,8 +260,6 @@ destroy_service_session (struct AliceServiceSession *s) | |||
260 | } | 260 | } |
261 | if (NULL != s->intersection_listen) | 261 | if (NULL != s->intersection_listen) |
262 | { | 262 | { |
263 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
264 | "Set intersection, listen still up!\n"); | ||
265 | GNUNET_SET_listen_cancel (s->intersection_listen); | 263 | GNUNET_SET_listen_cancel (s->intersection_listen); |
266 | s->intersection_listen = NULL; | 264 | s->intersection_listen = NULL; |
267 | } | 265 | } |
@@ -274,8 +272,6 @@ destroy_service_session (struct AliceServiceSession *s) | |||
274 | } | 272 | } |
275 | if (NULL != s->intersection_set) | 273 | if (NULL != s->intersection_set) |
276 | { | 274 | { |
277 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
278 | "Set intersection, set still there!\n"); | ||
279 | GNUNET_SET_destroy (s->intersection_set); | 275 | GNUNET_SET_destroy (s->intersection_set); |
280 | s->intersection_set = NULL; | 276 | s->intersection_set = NULL; |
281 | } | 277 | } |
@@ -809,10 +805,6 @@ cb_intersection_request_alice (void *cls, | |||
809 | prepare_client_end_notification (s); | 805 | prepare_client_end_notification (s); |
810 | return; | 806 | return; |
811 | } | 807 | } |
812 | GNUNET_SET_destroy (s->intersection_set); | ||
813 | s->intersection_set = NULL; | ||
814 | GNUNET_SET_listen_cancel (s->intersection_listen); | ||
815 | s->intersection_listen = NULL; | ||
816 | } | 808 | } |
817 | 809 | ||
818 | 810 | ||
diff --git a/src/scalarproduct/gnunet-service-scalarproduct_alice.c b/src/scalarproduct/gnunet-service-scalarproduct_alice.c index a55d03900..fcb1ce032 100644 --- a/src/scalarproduct/gnunet-service-scalarproduct_alice.c +++ b/src/scalarproduct/gnunet-service-scalarproduct_alice.c | |||
@@ -243,8 +243,6 @@ free_element_cb (void *cls, | |||
243 | static void | 243 | static void |
244 | destroy_service_session (struct AliceServiceSession *s) | 244 | destroy_service_session (struct AliceServiceSession *s) |
245 | { | 245 | { |
246 | unsigned int i; | ||
247 | |||
248 | if (GNUNET_YES == s->in_destroy) | 246 | if (GNUNET_YES == s->in_destroy) |
249 | return; | 247 | return; |
250 | s->in_destroy = GNUNET_YES; | 248 | s->in_destroy = GNUNET_YES; |
@@ -285,7 +283,7 @@ destroy_service_session (struct AliceServiceSession *s) | |||
285 | } | 283 | } |
286 | if (NULL != s->sorted_elements) | 284 | if (NULL != s->sorted_elements) |
287 | { | 285 | { |
288 | for (i=0;i<s->used_element_count;i++) | 286 | for (unsigned int i=0;i<s->used_element_count;i++) |
289 | gcry_mpi_release (s->sorted_elements[i].value); | 287 | gcry_mpi_release (s->sorted_elements[i].value); |
290 | GNUNET_free (s->sorted_elements); | 288 | GNUNET_free (s->sorted_elements); |
291 | s->sorted_elements = NULL; | 289 | s->sorted_elements = NULL; |
@@ -1043,10 +1041,6 @@ cb_intersection_request_alice (void *cls, | |||
1043 | prepare_client_end_notification (s); | 1041 | prepare_client_end_notification (s); |
1044 | return; | 1042 | return; |
1045 | } | 1043 | } |
1046 | GNUNET_SET_destroy (s->intersection_set); | ||
1047 | s->intersection_set = NULL; | ||
1048 | GNUNET_SET_listen_cancel (s->intersection_listen); | ||
1049 | s->intersection_listen = NULL; | ||
1050 | } | 1044 | } |
1051 | 1045 | ||
1052 | 1046 | ||
diff --git a/src/set/gnunet-service-set.c b/src/set/gnunet-service-set.c index f98d43a7d..42d06b275 100644 --- a/src/set/gnunet-service-set.c +++ b/src/set/gnunet-service-set.c | |||
@@ -155,6 +155,17 @@ static struct Listener *listener_head; | |||
155 | static struct Listener *listener_tail; | 155 | static struct Listener *listener_tail; |
156 | 156 | ||
157 | /** | 157 | /** |
158 | * Number of active clients. | ||
159 | */ | ||
160 | static unsigned int num_clients; | ||
161 | |||
162 | /** | ||
163 | * Are we in shutdown? if #GNUNET_YES and the number of clients | ||
164 | * drops to zero, disconnect from CADET. | ||
165 | */ | ||
166 | static int in_shutdown; | ||
167 | |||
168 | /** | ||
158 | * Counter for allocating unique IDs for clients, used to identify | 169 | * Counter for allocating unique IDs for clients, used to identify |
159 | * incoming operation requests from remote peers, that the client can | 170 | * incoming operation requests from remote peers, that the client can |
160 | * choose to accept or refuse. 0 must not be used (reserved for | 171 | * choose to accept or refuse. 0 must not be used (reserved for |
@@ -485,6 +496,7 @@ client_connect_cb (void *cls, | |||
485 | { | 496 | { |
486 | struct ClientState *cs; | 497 | struct ClientState *cs; |
487 | 498 | ||
499 | num_clients++; | ||
488 | cs = GNUNET_new (struct ClientState); | 500 | cs = GNUNET_new (struct ClientState); |
489 | cs->client = c; | 501 | cs->client = c; |
490 | cs->mq = mq; | 502 | cs->mq = mq; |
@@ -616,13 +628,29 @@ client_disconnect_cb (void *cls, | |||
616 | GNUNET_CADET_close_port (listener->open_port); | 628 | GNUNET_CADET_close_port (listener->open_port); |
617 | listener->open_port = NULL; | 629 | listener->open_port = NULL; |
618 | while (NULL != (op = listener->op_head)) | 630 | while (NULL != (op = listener->op_head)) |
631 | { | ||
632 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
633 | "Destroying incoming operation `%u' from peer `%s'\n", | ||
634 | (unsigned int) op->client_request_id, | ||
635 | GNUNET_i2s (&op->peer)); | ||
619 | incoming_destroy (op); | 636 | incoming_destroy (op); |
637 | } | ||
620 | GNUNET_CONTAINER_DLL_remove (listener_head, | 638 | GNUNET_CONTAINER_DLL_remove (listener_head, |
621 | listener_tail, | 639 | listener_tail, |
622 | listener); | 640 | listener); |
623 | GNUNET_free (listener); | 641 | GNUNET_free (listener); |
624 | } | 642 | } |
625 | GNUNET_free (cs); | 643 | GNUNET_free (cs); |
644 | num_clients--; | ||
645 | if ( (GNUNET_YES == in_shutdown) && | ||
646 | (0 == num_clients) ) | ||
647 | { | ||
648 | if (NULL != cadet) | ||
649 | { | ||
650 | GNUNET_CADET_disconnect (cadet); | ||
651 | cadet = NULL; | ||
652 | } | ||
653 | } | ||
626 | } | 654 | } |
627 | 655 | ||
628 | 656 | ||
@@ -1299,6 +1327,7 @@ handle_client_listen (void *cls, | |||
1299 | } | 1327 | } |
1300 | listener = GNUNET_new (struct Listener); | 1328 | listener = GNUNET_new (struct Listener); |
1301 | listener->cs = cs; | 1329 | listener->cs = cs; |
1330 | cs->listener = listener; | ||
1302 | listener->app_id = msg->app_id; | 1331 | listener->app_id = msg->app_id; |
1303 | listener->operation = (enum GNUNET_SET_OperationType) ntohl (msg->operation); | 1332 | listener->operation = (enum GNUNET_SET_OperationType) ntohl (msg->operation); |
1304 | GNUNET_CONTAINER_DLL_insert (listener_head, | 1333 | GNUNET_CONTAINER_DLL_insert (listener_head, |
@@ -1917,10 +1946,14 @@ static void | |||
1917 | shutdown_task (void *cls) | 1946 | shutdown_task (void *cls) |
1918 | { | 1947 | { |
1919 | /* Delay actual shutdown to allow service to disconnect clients */ | 1948 | /* Delay actual shutdown to allow service to disconnect clients */ |
1920 | if (NULL != cadet) | 1949 | in_shutdown = GNUNET_YES; |
1950 | if (0 == num_clients) | ||
1921 | { | 1951 | { |
1922 | GNUNET_CADET_disconnect (cadet); | 1952 | if (NULL != cadet) |
1923 | cadet = NULL; | 1953 | { |
1954 | GNUNET_CADET_disconnect (cadet); | ||
1955 | cadet = NULL; | ||
1956 | } | ||
1924 | } | 1957 | } |
1925 | GNUNET_STATISTICS_destroy (_GSS_statistics, | 1958 | GNUNET_STATISTICS_destroy (_GSS_statistics, |
1926 | GNUNET_YES); | 1959 | GNUNET_YES); |
diff --git a/src/set/test_set_intersection_result_full.c b/src/set/test_set_intersection_result_full.c index a36aae4d5..16de983cf 100644 --- a/src/set/test_set_intersection_result_full.c +++ b/src/set/test_set_intersection_result_full.c | |||
@@ -131,8 +131,6 @@ listen_cb (void *cls, | |||
131 | "starting intersection by accepting and committing\n"); | 131 | "starting intersection by accepting and committing\n"); |
132 | GNUNET_assert (NULL != context_msg); | 132 | GNUNET_assert (NULL != context_msg); |
133 | GNUNET_assert (ntohs (context_msg->type) == GNUNET_MESSAGE_TYPE_DUMMY); | 133 | GNUNET_assert (ntohs (context_msg->type) == GNUNET_MESSAGE_TYPE_DUMMY); |
134 | GNUNET_SET_listen_cancel (listen_handle); | ||
135 | listen_handle = NULL; | ||
136 | oh2 = GNUNET_SET_accept (request, | 134 | oh2 = GNUNET_SET_accept (request, |
137 | GNUNET_SET_RESULT_FULL, | 135 | GNUNET_SET_RESULT_FULL, |
138 | (struct GNUNET_SET_Option[]) { 0 }, | 136 | (struct GNUNET_SET_Option[]) { 0 }, |
diff --git a/src/set/test_set_union_result_symmetric.c b/src/set/test_set_union_result_symmetric.c index f81c7b8f7..3008e5aac 100644 --- a/src/set/test_set_union_result_symmetric.c +++ b/src/set/test_set_union_result_symmetric.c | |||
@@ -182,8 +182,6 @@ listen_cb (void *cls, | |||
182 | GNUNET_assert (ntohs (context_msg->type) == GNUNET_MESSAGE_TYPE_DUMMY); | 182 | GNUNET_assert (ntohs (context_msg->type) == GNUNET_MESSAGE_TYPE_DUMMY); |
183 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 183 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
184 | "listen cb called\n"); | 184 | "listen cb called\n"); |
185 | GNUNET_SET_listen_cancel (listen_handle); | ||
186 | listen_handle = NULL; | ||
187 | oh2 = GNUNET_SET_accept (request, | 185 | oh2 = GNUNET_SET_accept (request, |
188 | GNUNET_SET_RESULT_SYMMETRIC, | 186 | GNUNET_SET_RESULT_SYMMETRIC, |
189 | (struct GNUNET_SET_Option[]) { 0 }, | 187 | (struct GNUNET_SET_Option[]) { 0 }, |
diff --git a/src/social/test_social.c b/src/social/test_social.c index 0dc2a9d30..64ef10125 100644 --- a/src/social/test_social.c +++ b/src/social/test_social.c | |||
@@ -57,6 +57,9 @@ struct GNUNET_PeerIdentity this_peer; | |||
57 | 57 | ||
58 | struct GNUNET_IDENTITY_Handle *id; | 58 | struct GNUNET_IDENTITY_Handle *id; |
59 | 59 | ||
60 | const struct GNUNET_IDENTITY_Ego *identity_host_ego; | ||
61 | const struct GNUNET_IDENTITY_Ego *identity_guest_ego; | ||
62 | |||
60 | const struct GNUNET_SOCIAL_Ego *host_ego; | 63 | const struct GNUNET_SOCIAL_Ego *host_ego; |
61 | const struct GNUNET_SOCIAL_Ego *guest_ego; | 64 | const struct GNUNET_SOCIAL_Ego *guest_ego; |
62 | 65 | ||
@@ -69,8 +72,8 @@ struct GNUNET_CRYPTO_EcdsaPrivateKey *guest_key; | |||
69 | struct GNUNET_CRYPTO_EddsaPublicKey place_pub_key; | 72 | struct GNUNET_CRYPTO_EddsaPublicKey place_pub_key; |
70 | struct GNUNET_HashCode place_pub_hash; | 73 | struct GNUNET_HashCode place_pub_hash; |
71 | 74 | ||
72 | struct GNUNET_CRYPTO_EcdsaPublicKey guest_pub_key; | 75 | const struct GNUNET_CRYPTO_EcdsaPublicKey *guest_pub_key; |
73 | struct GNUNET_CRYPTO_EcdsaPublicKey host_pub_key; | 76 | const struct GNUNET_CRYPTO_EcdsaPublicKey *host_pub_key; |
74 | 77 | ||
75 | struct GNUNET_PSYC_Slicer *host_slicer; | 78 | struct GNUNET_PSYC_Slicer *host_slicer; |
76 | struct GNUNET_PSYC_Slicer *guest_slicer; | 79 | struct GNUNET_PSYC_Slicer *guest_slicer; |
@@ -120,29 +123,28 @@ uint8_t is_guest_reconnected = GNUNET_NO; | |||
120 | enum | 123 | enum |
121 | { | 124 | { |
122 | TEST_NONE = 0, | 125 | TEST_NONE = 0, |
123 | TEST_HOST_CREATE = 1, | 126 | TEST_IDENTITIES_CREATE = 1, |
124 | TEST_HOST_ENTER = 2, | 127 | TEST_HOST_ENTER = 2, |
125 | TEST_GUEST_CREATE = 3, | 128 | TEST_GUEST_ENTER = 3, |
126 | TEST_GUEST_ENTER = 4, | 129 | TEST_HOST_ANSWER_DOOR_REFUSE = 4, |
127 | TEST_HOST_ANSWER_DOOR_REFUSE = 5, | 130 | TEST_GUEST_RECV_ENTRY_DCSN_REFUSE = 5, |
128 | TEST_GUEST_RECV_ENTRY_DCSN_REFUSE = 6, | 131 | TEST_HOST_ANSWER_DOOR_ADMIT = 6, |
129 | TEST_HOST_ANSWER_DOOR_ADMIT = 7, | 132 | TEST_GUEST_RECV_ENTRY_DCSN_ADMIT = 9, |
130 | TEST_GUEST_RECV_ENTRY_DCSN_ADMIT = 8, | 133 | TEST_HOST_ANNOUNCE = 10, |
131 | TEST_HOST_ANNOUNCE = 9, | 134 | TEST_HOST_ANNOUNCE_END = 11, |
132 | TEST_HOST_ANNOUNCE_END = 10, | 135 | TEST_GUEST_TALK = 12, |
133 | TEST_GUEST_TALK = 11, | 136 | TEST_HOST_ANNOUNCE2 = 13, |
134 | TEST_HOST_ANNOUNCE2 = 12, | 137 | TEST_HOST_ANNOUNCE2_END = 14, |
135 | TEST_HOST_ANNOUNCE2_END = 13, | 138 | TEST_GUEST_HISTORY_REPLAY = 15, |
136 | TEST_GUEST_HISTORY_REPLAY = 14, | 139 | TEST_GUEST_HISTORY_REPLAY_LATEST = 16, |
137 | TEST_GUEST_HISTORY_REPLAY_LATEST = 15, | 140 | TEST_GUEST_LOOK_AT = 17, |
138 | TEST_GUEST_LOOK_AT = 16, | 141 | TEST_GUEST_LOOK_FOR = 18, |
139 | TEST_GUEST_LOOK_FOR = 17, | ||
140 | TEST_GUEST_LEAVE = 18, | 142 | TEST_GUEST_LEAVE = 18, |
141 | TEST_ZONE_ADD_PLACE = 19, | 143 | TEST_ZONE_ADD_PLACE = 20, |
142 | TEST_GUEST_ENTER_BY_NAME = 20, | 144 | TEST_GUEST_ENTER_BY_NAME = 21, |
143 | TEST_RECONNECT = 21, | 145 | TEST_RECONNECT = 22, |
144 | TEST_GUEST_LEAVE2 = 22, | 146 | TEST_GUEST_LEAVE2 = 23, |
145 | TEST_HOST_LEAVE = 23, | 147 | TEST_HOST_LEAVE = 24, |
146 | } test; | 148 | } test; |
147 | 149 | ||
148 | 150 | ||
@@ -458,30 +460,42 @@ app_recv_guest (void *cls, | |||
458 | 460 | ||
459 | 461 | ||
460 | static void | 462 | static void |
463 | enter_if_ready () | ||
464 | { | ||
465 | if (NULL == host_ego || NULL == guest_ego) | ||
466 | { | ||
467 | return; | ||
468 | } | ||
469 | host_enter (); | ||
470 | guest_init (); | ||
471 | } | ||
472 | |||
473 | |||
474 | static void | ||
461 | app_recv_ego (void *cls, | 475 | app_recv_ego (void *cls, |
462 | struct GNUNET_SOCIAL_Ego *ego, | 476 | struct GNUNET_SOCIAL_Ego *ego, |
463 | const struct GNUNET_CRYPTO_EcdsaPublicKey *ego_pub_key, | 477 | const struct GNUNET_CRYPTO_EcdsaPublicKey *ego_pub_key, |
464 | const char *name) | 478 | const char *name) |
465 | { | 479 | { |
466 | char *ego_pub_str = GNUNET_CRYPTO_ecdsa_public_key_to_string (ego_pub_key); | 480 | char *ego_pub_str = GNUNET_CRYPTO_ecdsa_public_key_to_string (ego_pub_key); |
467 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 481 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
468 | "Test #%u: Got app ego notification: %p %s %s\n", | 482 | "Test #%u: Got app ego notification: %p %s %s\n", |
469 | test, ego, name, ego_pub_str); | 483 | test, ego, name, ego_pub_str); |
470 | GNUNET_free (ego_pub_str); | 484 | GNUNET_free (ego_pub_str); |
471 | 485 | ||
472 | if (NULL != strstr (name, host_name) && TEST_HOST_CREATE == test) | 486 | if (NULL != strstr (name, host_name)) |
473 | { | 487 | { |
474 | host_ego = ego; | 488 | host_ego = ego; |
475 | host_pub_key = *(GNUNET_SOCIAL_ego_get_pub_key (host_ego)); | 489 | host_pub_key = ego_pub_key; |
476 | GNUNET_assert (TEST_HOST_CREATE == test); | 490 | GNUNET_assert (TEST_IDENTITIES_CREATE == test); |
477 | host_enter (); | 491 | enter_if_ready (); |
478 | } | 492 | } |
479 | else if (NULL != strstr (name, guest_name)) | 493 | else if (NULL != strstr (name, guest_name)) |
480 | { | 494 | { |
481 | guest_ego = ego; | 495 | guest_ego = ego; |
482 | 496 | guest_pub_key = ego_pub_key; | |
483 | if (TEST_GUEST_CREATE == test) | 497 | GNUNET_assert (TEST_IDENTITIES_CREATE == test); |
484 | guest_init (); | 498 | enter_if_ready (); |
485 | } | 499 | } |
486 | } | 500 | } |
487 | 501 | ||
@@ -548,9 +562,9 @@ host_farewell (void *cls, | |||
548 | test, GNUNET_h2s (GNUNET_SOCIAL_nym_get_pub_key_hash (nym)), str); | 562 | test, GNUNET_h2s (GNUNET_SOCIAL_nym_get_pub_key_hash (nym)), str); |
549 | GNUNET_free (str); | 563 | GNUNET_free (str); |
550 | GNUNET_assert (1 == GNUNET_PSYC_env_get_count (env)); | 564 | GNUNET_assert (1 == GNUNET_PSYC_env_get_count (env)); |
551 | if (0 != memcmp (&guest_pub_key, nym_key, sizeof (*nym_key))) | 565 | if (0 != memcmp (guest_pub_key, nym_key, sizeof (*nym_key))) |
552 | { | 566 | { |
553 | str = GNUNET_CRYPTO_ecdsa_public_key_to_string (&guest_pub_key); | 567 | str = GNUNET_CRYPTO_ecdsa_public_key_to_string (guest_pub_key); |
554 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 568 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
555 | "Test #%u: Farewell: nym does not match guest: %s\n", | 569 | "Test #%u: Farewell: nym does not match guest: %s\n", |
556 | test, str); | 570 | test, str); |
@@ -1029,7 +1043,7 @@ guest_recv_entry_decision (void *cls, | |||
1029 | int is_admitted, | 1043 | int is_admitted, |
1030 | const struct GNUNET_PSYC_Message *entry_msg) | 1044 | const struct GNUNET_PSYC_Message *entry_msg) |
1031 | { | 1045 | { |
1032 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1046 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
1033 | "Test #%u: Guest received entry decision (try %u): %d.\n", | 1047 | "Test #%u: Guest received entry decision (try %u): %d.\n", |
1034 | test, join_req_count, is_admitted); | 1048 | test, join_req_count, is_admitted); |
1035 | 1049 | ||
@@ -1121,7 +1135,7 @@ guest_recv_local_enter (void *cls, int result, | |||
1121 | const struct GNUNET_CRYPTO_EddsaPublicKey *place_pub_key, | 1135 | const struct GNUNET_CRYPTO_EddsaPublicKey *place_pub_key, |
1122 | uint64_t max_message_id) | 1136 | uint64_t max_message_id) |
1123 | { | 1137 | { |
1124 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1138 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
1125 | "Test #%u: Guest entered to local place: %d\n", | 1139 | "Test #%u: Guest entered to local place: %d\n", |
1126 | test, result); | 1140 | test, result); |
1127 | GNUNET_assert (0 <= result); | 1141 | GNUNET_assert (0 <= result); |
@@ -1131,7 +1145,7 @@ guest_recv_local_enter (void *cls, int result, | |||
1131 | static void | 1145 | static void |
1132 | guest_enter () | 1146 | guest_enter () |
1133 | { | 1147 | { |
1134 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1148 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
1135 | "Test #%u: Entering to place as guest.\n", test); | 1149 | "Test #%u: Entering to place as guest.\n", test); |
1136 | 1150 | ||
1137 | struct GuestEnterMessage *emsg = &guest_enter_msg; | 1151 | struct GuestEnterMessage *emsg = &guest_enter_msg; |
@@ -1200,7 +1214,7 @@ app_recv_zone_add_nym_result (void *cls, int64_t result, | |||
1200 | static void | 1214 | static void |
1201 | guest_init () | 1215 | guest_init () |
1202 | { | 1216 | { |
1203 | guest_pub_key = *(GNUNET_SOCIAL_ego_get_pub_key (guest_ego)); | 1217 | guest_pub_key = GNUNET_SOCIAL_ego_get_pub_key (guest_ego); |
1204 | 1218 | ||
1205 | guest_slicer = GNUNET_PSYC_slicer_create (); | 1219 | guest_slicer = GNUNET_PSYC_slicer_create (); |
1206 | GNUNET_PSYC_slicer_method_add (guest_slicer, "", NULL, | 1220 | GNUNET_PSYC_slicer_method_add (guest_slicer, "", NULL, |
@@ -1210,10 +1224,25 @@ guest_init () | |||
1210 | guest_recv_mod_foo_bar, &mod_foo_bar_rcls); | 1224 | guest_recv_mod_foo_bar, &mod_foo_bar_rcls); |
1211 | test = TEST_HOST_ANSWER_DOOR_ADMIT; | 1225 | test = TEST_HOST_ANSWER_DOOR_ADMIT; |
1212 | 1226 | ||
1213 | GNUNET_SOCIAL_zone_add_nym (app, guest_ego, "host", &host_pub_key, | 1227 | GNUNET_SOCIAL_zone_add_nym (app, guest_ego, "host", host_pub_key, |
1214 | GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES), | 1228 | GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES), |
1215 | app_recv_zone_add_nym_result, NULL); | 1229 | app_recv_zone_add_nym_result, NULL); |
1216 | guest_enter (); | 1230 | } |
1231 | |||
1232 | |||
1233 | static void | ||
1234 | id_host_created (void *cls, const char *emsg) | ||
1235 | { | ||
1236 | if (NULL != emsg) | ||
1237 | { | ||
1238 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1239 | "Test #%u: Could not create host identity: %s\n", | ||
1240 | test, emsg); | ||
1241 | #if ! DEBUG_TEST_SOCIAL | ||
1242 | GNUNET_assert (0); | ||
1243 | #endif | ||
1244 | } | ||
1245 | |||
1217 | } | 1246 | } |
1218 | 1247 | ||
1219 | 1248 | ||
@@ -1229,8 +1258,8 @@ id_guest_created (void *cls, const char *emsg) | |||
1229 | GNUNET_assert (0); | 1258 | GNUNET_assert (0); |
1230 | #endif | 1259 | #endif |
1231 | } | 1260 | } |
1232 | if (NULL != guest_ego) | 1261 | //if (NULL != guest_ego) |
1233 | guest_init (); | 1262 | // guest_init (); |
1234 | } | 1263 | } |
1235 | 1264 | ||
1236 | 1265 | ||
@@ -1241,12 +1270,10 @@ host_entered (void *cls, int result, | |||
1241 | { | 1270 | { |
1242 | place_pub_key = *home_pub_key; | 1271 | place_pub_key = *home_pub_key; |
1243 | GNUNET_CRYPTO_hash (&place_pub_key, sizeof (place_pub_key), &place_pub_hash); | 1272 | GNUNET_CRYPTO_hash (&place_pub_key, sizeof (place_pub_key), &place_pub_hash); |
1244 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1273 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
1245 | "Test #%u: Host entered to place %s\n", | 1274 | "Test #%u: Host entered to place %s\n", |
1246 | test, GNUNET_h2s (&place_pub_hash)); | 1275 | test, GNUNET_h2s (&place_pub_hash)); |
1247 | 1276 | guest_enter (); | |
1248 | test = TEST_GUEST_CREATE; | ||
1249 | GNUNET_IDENTITY_create (id, guest_name, &id_guest_created, NULL); | ||
1250 | } | 1277 | } |
1251 | 1278 | ||
1252 | 1279 | ||
@@ -1258,7 +1285,7 @@ host_enter () | |||
1258 | host_recv_method, host_recv_modifier, | 1285 | host_recv_method, host_recv_modifier, |
1259 | host_recv_data, host_recv_eom, NULL); | 1286 | host_recv_data, host_recv_eom, NULL); |
1260 | 1287 | ||
1261 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1288 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
1262 | "Test #%u: Entering to place as host.\n", test); | 1289 | "Test #%u: Entering to place as host.\n", test); |
1263 | test = TEST_HOST_ENTER; | 1290 | test = TEST_HOST_ENTER; |
1264 | hst = GNUNET_SOCIAL_host_enter (app, host_ego, | 1291 | hst = GNUNET_SOCIAL_host_enter (app, host_ego, |
@@ -1273,19 +1300,14 @@ host_enter () | |||
1273 | 1300 | ||
1274 | 1301 | ||
1275 | static void | 1302 | static void |
1276 | id_host_created (void *cls, const char *emsg) | 1303 | start_app_if_ready () |
1277 | { | 1304 | { |
1278 | if (NULL != emsg) | 1305 | if (NULL == identity_host_ego || NULL == identity_guest_ego) |
1279 | { | 1306 | { |
1280 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1307 | return; |
1281 | "Test #%u: Could not create host identity: %s\n", | ||
1282 | test, emsg); | ||
1283 | #if ! DEBUG_TEST_SOCIAL | ||
1284 | GNUNET_assert (0); | ||
1285 | #endif | ||
1286 | } | 1308 | } |
1287 | 1309 | app = GNUNET_SOCIAL_app_connect (cfg, | |
1288 | app = GNUNET_SOCIAL_app_connect (cfg, app_id, | 1310 | app_id, |
1289 | app_recv_ego, | 1311 | app_recv_ego, |
1290 | app_recv_host, | 1312 | app_recv_host, |
1291 | app_recv_guest, | 1313 | app_recv_guest, |
@@ -1298,6 +1320,35 @@ static void | |||
1298 | identity_ego_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego, | 1320 | identity_ego_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego, |
1299 | void **ctx, const char *name) | 1321 | void **ctx, const char *name) |
1300 | { | 1322 | { |
1323 | if (NULL != ego) | ||
1324 | { | ||
1325 | if (ego == identity_host_ego) | ||
1326 | { | ||
1327 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
1328 | "Host ego deleted\n"); | ||
1329 | } | ||
1330 | else if (ego == identity_guest_ego) | ||
1331 | { | ||
1332 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
1333 | "Guest ego deleted\n"); | ||
1334 | } | ||
1335 | else if (0 == strcmp (name, host_name)) | ||
1336 | { | ||
1337 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
1338 | "Created ego %s\n", | ||
1339 | name); | ||
1340 | identity_host_ego = ego; | ||
1341 | start_app_if_ready (); | ||
1342 | } | ||
1343 | else if (0 == strcmp (name, guest_name)) | ||
1344 | { | ||
1345 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
1346 | "Created guest ego %s\n", | ||
1347 | name); | ||
1348 | identity_guest_ego = ego; | ||
1349 | start_app_if_ready (); | ||
1350 | } | ||
1351 | } | ||
1301 | } | 1352 | } |
1302 | 1353 | ||
1303 | 1354 | ||
@@ -1326,8 +1377,9 @@ run (void *cls, | |||
1326 | 1377 | ||
1327 | id = GNUNET_IDENTITY_connect (cfg, &identity_ego_cb, NULL); | 1378 | id = GNUNET_IDENTITY_connect (cfg, &identity_ego_cb, NULL); |
1328 | 1379 | ||
1329 | test = TEST_HOST_CREATE; | 1380 | test = TEST_IDENTITIES_CREATE; |
1330 | GNUNET_IDENTITY_create (id, host_name, &id_host_created, NULL); | 1381 | GNUNET_IDENTITY_create (id, host_name, &id_host_created, NULL); |
1382 | GNUNET_IDENTITY_create (id, guest_name, &id_guest_created, NULL); | ||
1331 | } | 1383 | } |
1332 | 1384 | ||
1333 | 1385 | ||
diff --git a/src/transport/tcp_server_legacy.c b/src/transport/tcp_server_legacy.c index 6b4daa525..d0ce790fc 100644 --- a/src/transport/tcp_server_legacy.c +++ b/src/transport/tcp_server_legacy.c | |||
@@ -1477,23 +1477,6 @@ GNUNET_SERVER_connect_notify_cancel (struct GNUNET_SERVER_Handle *server, | |||
1477 | 1477 | ||
1478 | 1478 | ||
1479 | /** | 1479 | /** |
1480 | * Destroy the connection that is passed in via @a cls. Used | ||
1481 | * as calling #GNUNET_CONNECTION_destroy from within a function | ||
1482 | * that was itself called from within process_notify() of | ||
1483 | * 'connection.c' is not allowed (see #2329). | ||
1484 | * | ||
1485 | * @param cls connection to destroy | ||
1486 | */ | ||
1487 | static void | ||
1488 | destroy_connection (void *cls) | ||
1489 | { | ||
1490 | struct GNUNET_CONNECTION_Handle *connection = cls; | ||
1491 | |||
1492 | GNUNET_CONNECTION_destroy (connection); | ||
1493 | } | ||
1494 | |||
1495 | |||
1496 | /** | ||
1497 | * Ask the server to disconnect from the given client. | 1480 | * Ask the server to disconnect from the given client. |
1498 | * This is the same as returning #GNUNET_SYSERR from a message | 1481 | * This is the same as returning #GNUNET_SYSERR from a message |
1499 | * handler, except that it allows dropping of a client even | 1482 | * handler, except that it allows dropping of a client even |
@@ -1565,8 +1548,7 @@ GNUNET_SERVER_client_disconnect (struct GNUNET_SERVER_Client *client) | |||
1565 | GNUNET_CONNECTION_persist_ (client->connection); | 1548 | GNUNET_CONNECTION_persist_ (client->connection); |
1566 | if (NULL != client->th.cth) | 1549 | if (NULL != client->th.cth) |
1567 | GNUNET_SERVER_notify_transmit_ready_cancel (&client->th); | 1550 | GNUNET_SERVER_notify_transmit_ready_cancel (&client->th); |
1568 | (void) GNUNET_SCHEDULER_add_now (&destroy_connection, | 1551 | GNUNET_CONNECTION_destroy (client->connection); |
1569 | client->connection); | ||
1570 | /* need to cancel again, as it might have been re-added | 1552 | /* need to cancel again, as it might have been re-added |
1571 | in the meantime (i.e. during callbacks) */ | 1553 | in the meantime (i.e. during callbacks) */ |
1572 | if (NULL != client->warn_task) | 1554 | if (NULL != client->warn_task) |
diff --git a/src/util/.gitignore b/src/util/.gitignore index 3576a2134..d32a66833 100644 --- a/src/util/.gitignore +++ b/src/util/.gitignore | |||
@@ -67,3 +67,4 @@ test_socks.nc | |||
67 | perf_crypto_asymmetric | 67 | perf_crypto_asymmetric |
68 | perf_crypto_hash | 68 | perf_crypto_hash |
69 | perf_crypto_symmetric | 69 | perf_crypto_symmetric |
70 | perf_crypto_rsa | ||
diff --git a/src/util/network.c b/src/util/network.c index 66a468e45..942288613 100644 --- a/src/util/network.c +++ b/src/util/network.c | |||
@@ -1793,10 +1793,18 @@ GNUNET_NETWORK_socket_select (struct GNUNET_NETWORK_FDSet *rfds, | |||
1793 | _("Fatal internal logic error, process hangs in `%s' (abort with CTRL-C)!\n"), | 1793 | _("Fatal internal logic error, process hangs in `%s' (abort with CTRL-C)!\n"), |
1794 | "select"); | 1794 | "select"); |
1795 | } | 1795 | } |
1796 | tv.tv_sec = timeout.rel_value_us / GNUNET_TIME_UNIT_SECONDS.rel_value_us; | 1796 | if (timeout.rel_value_us / GNUNET_TIME_UNIT_SECONDS.rel_value_us > (unsigned long long) LONG_MAX) |
1797 | tv.tv_usec = | 1797 | { |
1798 | (timeout.rel_value_us - | 1798 | tv.tv_sec = LONG_MAX; |
1799 | (tv.tv_sec * GNUNET_TIME_UNIT_SECONDS.rel_value_us)); | 1799 | tv.tv_usec = 999999L; |
1800 | } | ||
1801 | else | ||
1802 | { | ||
1803 | tv.tv_sec = (long) (timeout.rel_value_us / GNUNET_TIME_UNIT_SECONDS.rel_value_us); | ||
1804 | tv.tv_usec = | ||
1805 | (timeout.rel_value_us - | ||
1806 | (tv.tv_sec * GNUNET_TIME_UNIT_SECONDS.rel_value_us)); | ||
1807 | } | ||
1800 | return select (nfds, | 1808 | return select (nfds, |
1801 | (NULL != rfds) ? &rfds->sds : NULL, | 1809 | (NULL != rfds) ? &rfds->sds : NULL, |
1802 | (NULL != wfds) ? &wfds->sds : NULL, | 1810 | (NULL != wfds) ? &wfds->sds : NULL, |
diff --git a/src/util/scheduler.c b/src/util/scheduler.c index a7b1d8e2a..e9c25d68a 100644 --- a/src/util/scheduler.c +++ b/src/util/scheduler.c | |||
@@ -73,7 +73,7 @@ | |||
73 | * Argument to be passed from the driver to | 73 | * Argument to be passed from the driver to |
74 | * #GNUNET_SCHEDULER_run_from_driver(). Contains the | 74 | * #GNUNET_SCHEDULER_run_from_driver(). Contains the |
75 | * scheduler's internal state. | 75 | * scheduler's internal state. |
76 | */ | 76 | */ |
77 | struct GNUNET_SCHEDULER_Handle | 77 | struct GNUNET_SCHEDULER_Handle |
78 | { | 78 | { |
79 | /** | 79 | /** |
@@ -94,7 +94,7 @@ struct GNUNET_SCHEDULER_Handle | |||
94 | * Driver we used for the event loop. | 94 | * Driver we used for the event loop. |
95 | */ | 95 | */ |
96 | const struct GNUNET_SCHEDULER_Driver *driver; | 96 | const struct GNUNET_SCHEDULER_Driver *driver; |
97 | 97 | ||
98 | }; | 98 | }; |
99 | 99 | ||
100 | 100 | ||
@@ -127,7 +127,7 @@ struct GNUNET_SCHEDULER_Task | |||
127 | * Handle to the scheduler's state. | 127 | * Handle to the scheduler's state. |
128 | */ | 128 | */ |
129 | const struct GNUNET_SCHEDULER_Handle *sh; | 129 | const struct GNUNET_SCHEDULER_Handle *sh; |
130 | 130 | ||
131 | /** | 131 | /** |
132 | * Set of file descriptors this task is waiting | 132 | * Set of file descriptors this task is waiting |
133 | * for for reading. Once ready, this is updated | 133 | * for for reading. Once ready, this is updated |
@@ -172,7 +172,7 @@ struct GNUNET_SCHEDULER_Task | |||
172 | * Size of the @e fds array. | 172 | * Size of the @e fds array. |
173 | */ | 173 | */ |
174 | unsigned int fds_len; | 174 | unsigned int fds_len; |
175 | 175 | ||
176 | /** | 176 | /** |
177 | * Why is the task ready? Set after task is added to ready queue. | 177 | * Why is the task ready? Set after task is added to ready queue. |
178 | * Initially set to zero. All reasons that have already been | 178 | * Initially set to zero. All reasons that have already been |
@@ -1849,7 +1849,7 @@ GNUNET_SCHEDULER_task_ready (struct GNUNET_SCHEDULER_Task *task, | |||
1849 | * | 1849 | * |
1850 | * @param sh scheduler handle that was given to the `loop` | 1850 | * @param sh scheduler handle that was given to the `loop` |
1851 | * @return #GNUNET_OK if there are more tasks that are ready, | 1851 | * @return #GNUNET_OK if there are more tasks that are ready, |
1852 | * and thus we would like to run more (yield to avoid | 1852 | * and thus we would like to run more (yield to avoid |
1853 | * blocking other activities for too long) | 1853 | * blocking other activities for too long) |
1854 | * #GNUNET_NO if we are done running tasks (yield to block) | 1854 | * #GNUNET_NO if we are done running tasks (yield to block) |
1855 | * #GNUNET_SYSERR on error | 1855 | * #GNUNET_SYSERR on error |
@@ -1876,11 +1876,11 @@ GNUNET_SCHEDULER_run_from_driver (struct GNUNET_SCHEDULER_Handle *sh) | |||
1876 | pending_timeout_last = NULL; | 1876 | pending_timeout_last = NULL; |
1877 | queue_ready_task (pos); | 1877 | queue_ready_task (pos); |
1878 | } | 1878 | } |
1879 | 1879 | ||
1880 | if (0 == ready_count) | 1880 | if (0 == ready_count) |
1881 | return GNUNET_NO; | 1881 | return GNUNET_NO; |
1882 | 1882 | ||
1883 | /* find out which task priority level we are going to | 1883 | /* find out which task priority level we are going to |
1884 | process this time */ | 1884 | process this time */ |
1885 | max_priority_added = GNUNET_SCHEDULER_PRIORITY_KEEP; | 1885 | max_priority_added = GNUNET_SCHEDULER_PRIORITY_KEEP; |
1886 | GNUNET_assert (NULL == ready_head[GNUNET_SCHEDULER_PRIORITY_KEEP]); | 1886 | GNUNET_assert (NULL == ready_head[GNUNET_SCHEDULER_PRIORITY_KEEP]); |