diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-09-30 21:03:31 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-09-30 21:03:31 +0000 |
commit | 6d5b099541c60303b664547f18f4aaa864e33d68 (patch) | |
tree | 3169f571d3f66ec23ab540d17c012f00103688f2 /src/core | |
parent | a0ba5b741b56036bd35bd9ba88164324b2ff7ada (diff) | |
download | gnunet-6d5b099541c60303b664547f18f4aaa864e33d68.tar.gz gnunet-6d5b099541c60303b664547f18f4aaa864e33d68.zip |
-getting core, nse, testbed, ats-tool and peerinfo-tool to compile again (part of #3047)
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/core_api.c | 39 | ||||
-rw-r--r-- | src/core/gnunet-core.c | 6 | ||||
-rw-r--r-- | src/core/gnunet-service-core_clients.c | 75 | ||||
-rw-r--r-- | src/core/gnunet-service-core_kx.c | 46 | ||||
-rw-r--r-- | src/core/gnunet-service-core_neighbours.c | 28 | ||||
-rw-r--r-- | src/core/gnunet-service-core_sessions.c | 35 |
6 files changed, 114 insertions, 115 deletions
diff --git a/src/core/core_api.c b/src/core/core_api.c index 959eb275a..8b9389bdf 100644 --- a/src/core/core_api.c +++ b/src/core/core_api.c | |||
@@ -277,7 +277,7 @@ struct GNUNET_CORE_Handle | |||
277 | * Hash map listing all of the peers that we are currently | 277 | * Hash map listing all of the peers that we are currently |
278 | * connected to. | 278 | * connected to. |
279 | */ | 279 | */ |
280 | struct GNUNET_CONTAINER_MultiHashMap *peers; | 280 | struct GNUNET_CONTAINER_MultiPeerMap *peers; |
281 | 281 | ||
282 | /** | 282 | /** |
283 | * Identity of this peer. | 283 | * Identity of this peer. |
@@ -357,7 +357,8 @@ reconnect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
357 | * @return #GNUNET_YES (continue) | 357 | * @return #GNUNET_YES (continue) |
358 | */ | 358 | */ |
359 | static int | 359 | static int |
360 | disconnect_and_free_peer_entry (void *cls, const struct GNUNET_HashCode * key, | 360 | disconnect_and_free_peer_entry (void *cls, |
361 | const struct GNUNET_PeerIdentity *key, | ||
361 | void *value) | 362 | void *value) |
362 | { | 363 | { |
363 | struct GNUNET_CORE_Handle *h = cls; | 364 | struct GNUNET_CORE_Handle *h = cls; |
@@ -389,7 +390,7 @@ disconnect_and_free_peer_entry (void *cls, const struct GNUNET_HashCode * key, | |||
389 | } | 390 | } |
390 | /* done with 'voluntary' cleanups, now on to normal freeing */ | 391 | /* done with 'voluntary' cleanups, now on to normal freeing */ |
391 | GNUNET_assert (GNUNET_YES == | 392 | GNUNET_assert (GNUNET_YES == |
392 | GNUNET_CONTAINER_multihashmap_remove (h->peers, key, pr)); | 393 | GNUNET_CONTAINER_multipeermap_remove (h->peers, key, pr)); |
393 | GNUNET_assert (pr->ch == h); | 394 | GNUNET_assert (pr->ch == h); |
394 | GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == pr->timeout_task); | 395 | GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == pr->timeout_task); |
395 | GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == pr->ntr_task); | 396 | GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == pr->ntr_task); |
@@ -435,7 +436,7 @@ reconnect_later (struct GNUNET_CORE_Handle *h) | |||
435 | cm->cont (cm->cont_cls, GNUNET_NO); | 436 | cm->cont (cm->cont_cls, GNUNET_NO); |
436 | GNUNET_free (cm); | 437 | GNUNET_free (cm); |
437 | } | 438 | } |
438 | GNUNET_CONTAINER_multihashmap_iterate (h->peers, | 439 | GNUNET_CONTAINER_multipeermap_iterate (h->peers, |
439 | &disconnect_and_free_peer_entry, h); | 440 | &disconnect_and_free_peer_entry, h); |
440 | while (NULL != (pr = h->ready_peer_head)) | 441 | while (NULL != (pr = h->ready_peer_head)) |
441 | GNUNET_CONTAINER_DLL_remove (h->ready_peer_head, h->ready_peer_tail, pr); | 442 | GNUNET_CONTAINER_DLL_remove (h->ready_peer_head, h->ready_peer_tail, pr); |
@@ -790,14 +791,14 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
790 | "Successfully reconnected to core service.\n"); | 791 | "Successfully reconnected to core service.\n"); |
791 | } | 792 | } |
792 | /* fake 'connect to self' */ | 793 | /* fake 'connect to self' */ |
793 | pr = GNUNET_CONTAINER_multihashmap_get (h->peers, &h->me.hashPubKey); | 794 | pr = GNUNET_CONTAINER_multipeermap_get (h->peers, &h->me); |
794 | GNUNET_assert (NULL == pr); | 795 | GNUNET_assert (NULL == pr); |
795 | pr = GNUNET_new (struct PeerRecord); | 796 | pr = GNUNET_new (struct PeerRecord); |
796 | pr->peer = h->me; | 797 | pr->peer = h->me; |
797 | pr->ch = h; | 798 | pr->ch = h; |
798 | GNUNET_assert (GNUNET_YES == | 799 | GNUNET_assert (GNUNET_YES == |
799 | GNUNET_CONTAINER_multihashmap_put (h->peers, | 800 | GNUNET_CONTAINER_multipeermap_put (h->peers, |
800 | &h->me.hashPubKey, pr, | 801 | &h->me, pr, |
801 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)); | 802 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)); |
802 | if (NULL != h->connects) | 803 | if (NULL != h->connects) |
803 | h->connects (h->cls, &h->me); | 804 | h->connects (h->cls, &h->me); |
@@ -826,7 +827,7 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
826 | GNUNET_break (0); | 827 | GNUNET_break (0); |
827 | return; | 828 | return; |
828 | } | 829 | } |
829 | pr = GNUNET_CONTAINER_multihashmap_get (h->peers, &cnm->peer.hashPubKey); | 830 | pr = GNUNET_CONTAINER_multipeermap_get (h->peers, &cnm->peer); |
830 | if (NULL != pr) | 831 | if (NULL != pr) |
831 | { | 832 | { |
832 | GNUNET_break (0); | 833 | GNUNET_break (0); |
@@ -837,8 +838,8 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
837 | pr->peer = cnm->peer; | 838 | pr->peer = cnm->peer; |
838 | pr->ch = h; | 839 | pr->ch = h; |
839 | GNUNET_assert (GNUNET_YES == | 840 | GNUNET_assert (GNUNET_YES == |
840 | GNUNET_CONTAINER_multihashmap_put (h->peers, | 841 | GNUNET_CONTAINER_multipeermap_put (h->peers, |
841 | &cnm->peer.hashPubKey, pr, | 842 | &cnm->peer, pr, |
842 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)); | 843 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)); |
843 | if (NULL != h->connects) | 844 | if (NULL != h->connects) |
844 | h->connects (h->cls, &cnm->peer); | 845 | h->connects (h->cls, &cnm->peer); |
@@ -861,7 +862,7 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
861 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 862 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
862 | "Received notification about disconnect from `%s'.\n", | 863 | "Received notification about disconnect from `%s'.\n", |
863 | GNUNET_i2s (&dnm->peer)); | 864 | GNUNET_i2s (&dnm->peer)); |
864 | pr = GNUNET_CONTAINER_multihashmap_get (h->peers, &dnm->peer.hashPubKey); | 865 | pr = GNUNET_CONTAINER_multipeermap_get (h->peers, &dnm->peer); |
865 | if (NULL == pr) | 866 | if (NULL == pr) |
866 | { | 867 | { |
867 | GNUNET_break (0); | 868 | GNUNET_break (0); |
@@ -870,7 +871,7 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
870 | } | 871 | } |
871 | trigger = ((pr->prev != NULL) || (pr->next != NULL) || | 872 | trigger = ((pr->prev != NULL) || (pr->next != NULL) || |
872 | (h->ready_peer_head == pr)); | 873 | (h->ready_peer_head == pr)); |
873 | disconnect_and_free_peer_entry (h, &dnm->peer.hashPubKey, pr); | 874 | disconnect_and_free_peer_entry (h, &dnm->peer, pr); |
874 | if (trigger) | 875 | if (trigger) |
875 | trigger_next_request (h, GNUNET_NO); | 876 | trigger_next_request (h, GNUNET_NO); |
876 | break; | 877 | break; |
@@ -916,7 +917,7 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
916 | GNUNET_break_op (0); | 917 | GNUNET_break_op (0); |
917 | continue; | 918 | continue; |
918 | } | 919 | } |
919 | pr = GNUNET_CONTAINER_multihashmap_get (h->peers, &ntm->peer.hashPubKey); | 920 | pr = GNUNET_CONTAINER_multipeermap_get (h->peers, &ntm->peer); |
920 | if (NULL == pr) | 921 | if (NULL == pr) |
921 | { | 922 | { |
922 | GNUNET_break (0); | 923 | GNUNET_break (0); |
@@ -976,7 +977,7 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
976 | return; | 977 | return; |
977 | } | 978 | } |
978 | smr = (const struct SendMessageReady *) msg; | 979 | smr = (const struct SendMessageReady *) msg; |
979 | pr = GNUNET_CONTAINER_multihashmap_get (h->peers, &smr->peer.hashPubKey); | 980 | pr = GNUNET_CONTAINER_multipeermap_get (h->peers, &smr->peer); |
980 | if (NULL == pr) | 981 | if (NULL == pr) |
981 | { | 982 | { |
982 | GNUNET_break (0); | 983 | GNUNET_break (0); |
@@ -1157,7 +1158,7 @@ GNUNET_CORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1157 | h->handlers = handlers; | 1158 | h->handlers = handlers; |
1158 | h->hcnt = 0; | 1159 | h->hcnt = 0; |
1159 | h->currently_down = GNUNET_YES; | 1160 | h->currently_down = GNUNET_YES; |
1160 | h->peers = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_NO); | 1161 | h->peers = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO); |
1161 | if (NULL != handlers) | 1162 | if (NULL != handlers) |
1162 | while (handlers[h->hcnt].callback != NULL) | 1163 | while (handlers[h->hcnt].callback != NULL) |
1163 | h->hcnt++; | 1164 | h->hcnt++; |
@@ -1205,7 +1206,7 @@ GNUNET_CORE_disconnect (struct GNUNET_CORE_Handle *handle) | |||
1205 | GNUNET_CLIENT_disconnect (handle->client); | 1206 | GNUNET_CLIENT_disconnect (handle->client); |
1206 | handle->client = NULL; | 1207 | handle->client = NULL; |
1207 | } | 1208 | } |
1208 | GNUNET_CONTAINER_multihashmap_iterate (handle->peers, | 1209 | GNUNET_CONTAINER_multipeermap_iterate (handle->peers, |
1209 | &disconnect_and_free_peer_entry, | 1210 | &disconnect_and_free_peer_entry, |
1210 | handle); | 1211 | handle); |
1211 | if (handle->reconnect_task != GNUNET_SCHEDULER_NO_TASK) | 1212 | if (handle->reconnect_task != GNUNET_SCHEDULER_NO_TASK) |
@@ -1213,7 +1214,7 @@ GNUNET_CORE_disconnect (struct GNUNET_CORE_Handle *handle) | |||
1213 | GNUNET_SCHEDULER_cancel (handle->reconnect_task); | 1214 | GNUNET_SCHEDULER_cancel (handle->reconnect_task); |
1214 | handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK; | 1215 | handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK; |
1215 | } | 1216 | } |
1216 | GNUNET_CONTAINER_multihashmap_destroy (handle->peers); | 1217 | GNUNET_CONTAINER_multipeermap_destroy (handle->peers); |
1217 | handle->peers = NULL; | 1218 | handle->peers = NULL; |
1218 | GNUNET_break (handle->ready_peer_head == NULL); | 1219 | GNUNET_break (handle->ready_peer_head == NULL); |
1219 | GNUNET_free (handle); | 1220 | GNUNET_free (handle); |
@@ -1287,7 +1288,7 @@ GNUNET_CORE_notify_transmit_ready (struct GNUNET_CORE_Handle *handle, int cork, | |||
1287 | "Asking core for transmission of %u bytes to `%s'\n", | 1288 | "Asking core for transmission of %u bytes to `%s'\n", |
1288 | (unsigned int) notify_size, | 1289 | (unsigned int) notify_size, |
1289 | GNUNET_i2s (target)); | 1290 | GNUNET_i2s (target)); |
1290 | pr = GNUNET_CONTAINER_multihashmap_get (handle->peers, &target->hashPubKey); | 1291 | pr = GNUNET_CONTAINER_multipeermap_get (handle->peers, target); |
1291 | if (NULL == pr) | 1292 | if (NULL == pr) |
1292 | { | 1293 | { |
1293 | /* attempt to send to peer that is not connected */ | 1294 | /* attempt to send to peer that is not connected */ |
@@ -1382,7 +1383,7 @@ GNUNET_CORE_is_peer_connected_sync (const struct GNUNET_CORE_Handle *h, | |||
1382 | { | 1383 | { |
1383 | GNUNET_assert (NULL != h); | 1384 | GNUNET_assert (NULL != h); |
1384 | GNUNET_assert (NULL != pid); | 1385 | GNUNET_assert (NULL != pid); |
1385 | return GNUNET_CONTAINER_multihashmap_contains (h->peers, &pid->hashPubKey); | 1386 | return GNUNET_CONTAINER_multipeermap_contains (h->peers, pid); |
1386 | } | 1387 | } |
1387 | 1388 | ||
1388 | 1389 | ||
diff --git a/src/core/gnunet-core.c b/src/core/gnunet-core.c index 9bfd18ec9..cfdae33bf 100644 --- a/src/core/gnunet-core.c +++ b/src/core/gnunet-core.c | |||
@@ -75,12 +75,10 @@ static void | |||
75 | connected_peer_callback (void *cls, | 75 | connected_peer_callback (void *cls, |
76 | const struct GNUNET_PeerIdentity *peer) | 76 | const struct GNUNET_PeerIdentity *peer) |
77 | { | 77 | { |
78 | struct GNUNET_CRYPTO_HashAsciiEncoded enc; | ||
79 | |||
80 | if (NULL == peer) | 78 | if (NULL == peer) |
81 | return; | 79 | return; |
82 | GNUNET_CRYPTO_hash_to_enc (&peer->hashPubKey, &enc); | 80 | printf (_("Peer `%s'\n"), |
83 | printf (_("Peer `%s'\n"), (const char *) &enc); | 81 | GNUNET_i2s_full (peer)); |
84 | } | 82 | } |
85 | 83 | ||
86 | 84 | ||
diff --git a/src/core/gnunet-service-core_clients.c b/src/core/gnunet-service-core_clients.c index 7514da8a2..bcbb56ef3 100644 --- a/src/core/gnunet-service-core_clients.c +++ b/src/core/gnunet-service-core_clients.c | |||
@@ -73,12 +73,12 @@ struct GSC_Client | |||
73 | * Map of peer identities to active transmission requests of this | 73 | * Map of peer identities to active transmission requests of this |
74 | * client to the peer (of type 'struct GSC_ClientActiveRequest'). | 74 | * client to the peer (of type 'struct GSC_ClientActiveRequest'). |
75 | */ | 75 | */ |
76 | struct GNUNET_CONTAINER_MultiHashMap *requests; | 76 | struct GNUNET_CONTAINER_MultiPeerMap *requests; |
77 | 77 | ||
78 | /** | 78 | /** |
79 | * Map containing all peers that this client knows we're connected to. | 79 | * Map containing all peers that this client knows we're connected to. |
80 | */ | 80 | */ |
81 | struct GNUNET_CONTAINER_MultiHashMap *connectmap; | 81 | struct GNUNET_CONTAINER_MultiPeerMap *connectmap; |
82 | 82 | ||
83 | /** | 83 | /** |
84 | * Options for messages this client cares about, | 84 | * Options for messages this client cares about, |
@@ -247,8 +247,8 @@ send_to_all_clients (const struct GNUNET_PeerIdentity *partner, | |||
247 | GNUNET_assert ( (0 == (c->options & GNUNET_CORE_OPTION_SEND_FULL_INBOUND)) || | 247 | GNUNET_assert ( (0 == (c->options & GNUNET_CORE_OPTION_SEND_FULL_INBOUND)) || |
248 | (GNUNET_YES != tm) || | 248 | (GNUNET_YES != tm) || |
249 | (GNUNET_YES == | 249 | (GNUNET_YES == |
250 | GNUNET_CONTAINER_multihashmap_contains (c->connectmap, | 250 | GNUNET_CONTAINER_multipeermap_contains (c->connectmap, |
251 | &partner->hashPubKey)) ); | 251 | partner)) ); |
252 | send_to_client (c, msg, can_drop); | 252 | send_to_client (c, msg, can_drop); |
253 | } | 253 | } |
254 | } | 254 | } |
@@ -298,10 +298,10 @@ handle_client_init (void *cls, struct GNUNET_SERVER_Client *client, | |||
298 | c->options = ntohl (im->options); | 298 | c->options = ntohl (im->options); |
299 | all_client_options |= c->options; | 299 | all_client_options |= c->options; |
300 | c->types = (const uint16_t *) &c[1]; | 300 | c->types = (const uint16_t *) &c[1]; |
301 | c->connectmap = GNUNET_CONTAINER_multihashmap_create (16, GNUNET_NO); | 301 | c->connectmap = GNUNET_CONTAINER_multipeermap_create (16, GNUNET_NO); |
302 | GNUNET_assert (GNUNET_YES == | 302 | GNUNET_assert (GNUNET_YES == |
303 | GNUNET_CONTAINER_multihashmap_put (c->connectmap, | 303 | GNUNET_CONTAINER_multipeermap_put (c->connectmap, |
304 | &GSC_my_identity.hashPubKey, | 304 | &GSC_my_identity, |
305 | NULL, | 305 | NULL, |
306 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 306 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); |
307 | wtypes = (uint16_t *) & c[1]; | 307 | wtypes = (uint16_t *) & c[1]; |
@@ -349,7 +349,7 @@ handle_client_send_request (void *cls, struct GNUNET_SERVER_Client *client, | |||
349 | return; | 349 | return; |
350 | } | 350 | } |
351 | if (c->requests == NULL) | 351 | if (c->requests == NULL) |
352 | c->requests = GNUNET_CONTAINER_multihashmap_create (16, GNUNET_NO); | 352 | c->requests = GNUNET_CONTAINER_multipeermap_create (16, GNUNET_NO); |
353 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 353 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
354 | "Client asked for transmission to `%s'\n", | 354 | "Client asked for transmission to `%s'\n", |
355 | GNUNET_i2s (&req->peer)); | 355 | GNUNET_i2s (&req->peer)); |
@@ -359,8 +359,8 @@ handle_client_send_request (void *cls, struct GNUNET_SERVER_Client *client, | |||
359 | sizeof (struct GNUNET_PeerIdentity))); | 359 | sizeof (struct GNUNET_PeerIdentity))); |
360 | if ((!is_loopback) && | 360 | if ((!is_loopback) && |
361 | (GNUNET_YES != | 361 | (GNUNET_YES != |
362 | GNUNET_CONTAINER_multihashmap_contains (c->connectmap, | 362 | GNUNET_CONTAINER_multipeermap_contains (c->connectmap, |
363 | &req->peer.hashPubKey))) | 363 | &req->peer))) |
364 | { | 364 | { |
365 | /* neighbour must have disconnected since request was issued, | 365 | /* neighbour must have disconnected since request was issued, |
366 | * ignore (client will realize it once it processes the | 366 | * ignore (client will realize it once it processes the |
@@ -373,14 +373,14 @@ handle_client_send_request (void *cls, struct GNUNET_SERVER_Client *client, | |||
373 | return; | 373 | return; |
374 | } | 374 | } |
375 | 375 | ||
376 | car = GNUNET_CONTAINER_multihashmap_get (c->requests, &req->peer.hashPubKey); | 376 | car = GNUNET_CONTAINER_multipeermap_get (c->requests, &req->peer); |
377 | if (car == NULL) | 377 | if (car == NULL) |
378 | { | 378 | { |
379 | /* create new entry */ | 379 | /* create new entry */ |
380 | car = GNUNET_malloc (sizeof (struct GSC_ClientActiveRequest)); | 380 | car = GNUNET_malloc (sizeof (struct GSC_ClientActiveRequest)); |
381 | GNUNET_assert (GNUNET_OK == | 381 | GNUNET_assert (GNUNET_OK == |
382 | GNUNET_CONTAINER_multihashmap_put (c->requests, | 382 | GNUNET_CONTAINER_multipeermap_put (c->requests, |
383 | &req->peer.hashPubKey, | 383 | &req->peer, |
384 | car, | 384 | car, |
385 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)); | 385 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)); |
386 | car->client_handle = c; | 386 | car->client_handle = c; |
@@ -462,7 +462,7 @@ handle_client_send (void *cls, struct GNUNET_SERVER_Client *client, | |||
462 | return; | 462 | return; |
463 | } | 463 | } |
464 | tc.car = | 464 | tc.car = |
465 | GNUNET_CONTAINER_multihashmap_get (c->requests, &sm->peer.hashPubKey); | 465 | GNUNET_CONTAINER_multipeermap_get (c->requests, &sm->peer); |
466 | if (NULL == tc.car) | 466 | if (NULL == tc.car) |
467 | { | 467 | { |
468 | /* Must have been that we first approved the request, then got disconnected | 468 | /* Must have been that we first approved the request, then got disconnected |
@@ -478,8 +478,8 @@ handle_client_send (void *cls, struct GNUNET_SERVER_Client *client, | |||
478 | return; | 478 | return; |
479 | } | 479 | } |
480 | GNUNET_assert (GNUNET_YES == | 480 | GNUNET_assert (GNUNET_YES == |
481 | GNUNET_CONTAINER_multihashmap_remove (c->requests, | 481 | GNUNET_CONTAINER_multipeermap_remove (c->requests, |
482 | &sm->peer.hashPubKey, | 482 | &sm->peer, |
483 | tc.car)); | 483 | tc.car)); |
484 | tc.cork = ntohl (sm->cork); | 484 | tc.cork = ntohl (sm->cork); |
485 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 485 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -561,18 +561,19 @@ client_tokenizer_callback (void *cls, void *client, | |||
561 | * @param cls NULL | 561 | * @param cls NULL |
562 | * @param key identity of peer for which this is an active request | 562 | * @param key identity of peer for which this is an active request |
563 | * @param value the 'struct GSC_ClientActiveRequest' to free | 563 | * @param value the 'struct GSC_ClientActiveRequest' to free |
564 | * @return GNUNET_YES (continue iteration) | 564 | * @return #GNUNET_YES (continue iteration) |
565 | */ | 565 | */ |
566 | static int | 566 | static int |
567 | destroy_active_client_request (void *cls, const struct GNUNET_HashCode * key, | 567 | destroy_active_client_request (void *cls, |
568 | const struct GNUNET_PeerIdentity *key, | ||
568 | void *value) | 569 | void *value) |
569 | { | 570 | { |
570 | struct GSC_ClientActiveRequest *car = value; | 571 | struct GSC_ClientActiveRequest *car = value; |
571 | 572 | ||
572 | GNUNET_assert (GNUNET_YES == | 573 | GNUNET_assert (GNUNET_YES == |
573 | GNUNET_CONTAINER_multihashmap_remove (car-> | 574 | GNUNET_CONTAINER_multipeermap_remove (car-> |
574 | client_handle->requests, | 575 | client_handle->requests, |
575 | &car->target.hashPubKey, | 576 | &car->target, |
576 | car)); | 577 | car)); |
577 | GSC_SESSIONS_dequeue_request (car); | 578 | GSC_SESSIONS_dequeue_request (car); |
578 | GNUNET_free (car); | 579 | GNUNET_free (car); |
@@ -601,12 +602,12 @@ handle_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client) | |||
601 | GNUNET_CONTAINER_DLL_remove (client_head, client_tail, c); | 602 | GNUNET_CONTAINER_DLL_remove (client_head, client_tail, c); |
602 | if (c->requests != NULL) | 603 | if (c->requests != NULL) |
603 | { | 604 | { |
604 | GNUNET_CONTAINER_multihashmap_iterate (c->requests, | 605 | GNUNET_CONTAINER_multipeermap_iterate (c->requests, |
605 | &destroy_active_client_request, | 606 | &destroy_active_client_request, |
606 | NULL); | 607 | NULL); |
607 | GNUNET_CONTAINER_multihashmap_destroy (c->requests); | 608 | GNUNET_CONTAINER_multipeermap_destroy (c->requests); |
608 | } | 609 | } |
609 | GNUNET_CONTAINER_multihashmap_destroy (c->connectmap); | 610 | GNUNET_CONTAINER_multipeermap_destroy (c->connectmap); |
610 | c->connectmap = NULL; | 611 | c->connectmap = NULL; |
611 | GSC_TYPEMAP_remove (c->types, c->tcnt); | 612 | GSC_TYPEMAP_remove (c->types, c->tcnt); |
612 | GNUNET_free (c); | 613 | GNUNET_free (c); |
@@ -633,8 +634,8 @@ GSC_CLIENTS_solicit_request (struct GSC_ClientActiveRequest *car) | |||
633 | 634 | ||
634 | c = car->client_handle; | 635 | c = car->client_handle; |
635 | if (GNUNET_YES != | 636 | if (GNUNET_YES != |
636 | GNUNET_CONTAINER_multihashmap_contains (c->connectmap, | 637 | GNUNET_CONTAINER_multipeermap_contains (c->connectmap, |
637 | &car->target.hashPubKey)) | 638 | &car->target)) |
638 | { | 639 | { |
639 | /* connection has gone down since, drop request */ | 640 | /* connection has gone down since, drop request */ |
640 | GNUNET_assert (0 != | 641 | GNUNET_assert (0 != |
@@ -665,9 +666,9 @@ void | |||
665 | GSC_CLIENTS_reject_request (struct GSC_ClientActiveRequest *car) | 666 | GSC_CLIENTS_reject_request (struct GSC_ClientActiveRequest *car) |
666 | { | 667 | { |
667 | GNUNET_assert (GNUNET_YES == | 668 | GNUNET_assert (GNUNET_YES == |
668 | GNUNET_CONTAINER_multihashmap_remove (car-> | 669 | GNUNET_CONTAINER_multipeermap_remove (car-> |
669 | client_handle->requests, | 670 | client_handle->requests, |
670 | &car->target.hashPubKey, | 671 | &car->target, |
671 | car)); | 672 | car)); |
672 | GNUNET_free (car); | 673 | GNUNET_free (car); |
673 | } | 674 | } |
@@ -702,19 +703,19 @@ GSC_CLIENTS_notify_client_about_neighbour (struct GSC_Client *client, | |||
702 | if (old_match == new_match) | 703 | if (old_match == new_match) |
703 | { | 704 | { |
704 | GNUNET_assert (old_match == | 705 | GNUNET_assert (old_match == |
705 | GNUNET_CONTAINER_multihashmap_contains (client->connectmap, | 706 | GNUNET_CONTAINER_multipeermap_contains (client->connectmap, |
706 | &neighbour->hashPubKey)); | 707 | neighbour)); |
707 | return; /* no change */ | 708 | return; /* no change */ |
708 | } | 709 | } |
709 | if (old_match == GNUNET_NO) | 710 | if (old_match == GNUNET_NO) |
710 | { | 711 | { |
711 | /* send connect */ | 712 | /* send connect */ |
712 | GNUNET_assert (GNUNET_NO == | 713 | GNUNET_assert (GNUNET_NO == |
713 | GNUNET_CONTAINER_multihashmap_contains (client->connectmap, | 714 | GNUNET_CONTAINER_multipeermap_contains (client->connectmap, |
714 | &neighbour->hashPubKey)); | 715 | neighbour)); |
715 | GNUNET_assert (GNUNET_YES == | 716 | GNUNET_assert (GNUNET_YES == |
716 | GNUNET_CONTAINER_multihashmap_put (client->connectmap, | 717 | GNUNET_CONTAINER_multipeermap_put (client->connectmap, |
717 | &neighbour->hashPubKey, | 718 | neighbour, |
718 | NULL, | 719 | NULL, |
719 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 720 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); |
720 | size = sizeof (struct ConnectNotifyMessage); | 721 | size = sizeof (struct ConnectNotifyMessage); |
@@ -731,11 +732,11 @@ GSC_CLIENTS_notify_client_about_neighbour (struct GSC_Client *client, | |||
731 | { | 732 | { |
732 | /* send disconnect */ | 733 | /* send disconnect */ |
733 | GNUNET_assert (GNUNET_YES == | 734 | GNUNET_assert (GNUNET_YES == |
734 | GNUNET_CONTAINER_multihashmap_contains (client->connectmap, | 735 | GNUNET_CONTAINER_multipeermap_contains (client->connectmap, |
735 | &neighbour->hashPubKey)); | 736 | neighbour)); |
736 | GNUNET_assert (GNUNET_YES == | 737 | GNUNET_assert (GNUNET_YES == |
737 | GNUNET_CONTAINER_multihashmap_remove (client->connectmap, | 738 | GNUNET_CONTAINER_multipeermap_remove (client->connectmap, |
738 | &neighbour->hashPubKey, | 739 | neighbour, |
739 | NULL)); | 740 | NULL)); |
740 | dcm.header.size = htons (sizeof (struct DisconnectNotifyMessage)); | 741 | dcm.header.size = htons (sizeof (struct DisconnectNotifyMessage)); |
741 | dcm.header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_DISCONNECT); | 742 | dcm.header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_DISCONNECT); |
diff --git a/src/core/gnunet-service-core_kx.c b/src/core/gnunet-service-core_kx.c index 675ac83a6..bf3c5cdaf 100644 --- a/src/core/gnunet-service-core_kx.c +++ b/src/core/gnunet-service-core_kx.c | |||
@@ -116,7 +116,7 @@ struct EphemeralKeyMessage | |||
116 | /** | 116 | /** |
117 | * Public key of the signing peer (persistent version, not the ephemeral public key). | 117 | * Public key of the signing peer (persistent version, not the ephemeral public key). |
118 | */ | 118 | */ |
119 | struct GNUNET_CRYPTO_EccPublicSignKey origin_public_key; | 119 | struct GNUNET_PeerIdentity origin_identity; |
120 | 120 | ||
121 | }; | 121 | }; |
122 | 122 | ||
@@ -390,11 +390,6 @@ static struct GNUNET_CRYPTO_EccPrivateKey *my_ephemeral_key; | |||
390 | static struct EphemeralKeyMessage current_ekm; | 390 | static struct EphemeralKeyMessage current_ekm; |
391 | 391 | ||
392 | /** | 392 | /** |
393 | * Our public key. | ||
394 | */ | ||
395 | static struct GNUNET_CRYPTO_EccPublicSignKey my_public_key; | ||
396 | |||
397 | /** | ||
398 | * Our message stream tokenizer (for encrypted payload). | 393 | * Our message stream tokenizer (for encrypted payload). |
399 | */ | 394 | */ |
400 | static struct GNUNET_SERVER_MessageStreamTokenizer *mst; | 395 | static struct GNUNET_SERVER_MessageStreamTokenizer *mst; |
@@ -453,9 +448,9 @@ derive_iv (struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, | |||
453 | static const char ctx[] = "initialization vector"; | 448 | static const char ctx[] = "initialization vector"; |
454 | 449 | ||
455 | GNUNET_CRYPTO_symmetric_derive_iv (iv, skey, &seed, sizeof (seed), | 450 | GNUNET_CRYPTO_symmetric_derive_iv (iv, skey, &seed, sizeof (seed), |
456 | &identity->hashPubKey.bits, | 451 | identity, |
457 | sizeof (identity->hashPubKey.bits), ctx, | 452 | sizeof (struct GNUNET_PeerIdentity), ctx, |
458 | sizeof (ctx), NULL); | 453 | sizeof (ctx), NULL); |
459 | } | 454 | } |
460 | 455 | ||
461 | 456 | ||
@@ -476,9 +471,11 @@ derive_pong_iv (struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, | |||
476 | static const char ctx[] = "pong initialization vector"; | 471 | static const char ctx[] = "pong initialization vector"; |
477 | 472 | ||
478 | GNUNET_CRYPTO_symmetric_derive_iv (iv, skey, &seed, sizeof (seed), | 473 | GNUNET_CRYPTO_symmetric_derive_iv (iv, skey, &seed, sizeof (seed), |
479 | &identity->hashPubKey.bits, | 474 | identity, |
480 | sizeof (identity->hashPubKey.bits), &challenge, | 475 | sizeof (struct GNUNET_PeerIdentity), |
481 | sizeof (challenge), ctx, sizeof (ctx), NULL); | 476 | &challenge, sizeof (challenge), |
477 | ctx, sizeof (ctx), | ||
478 | NULL); | ||
482 | } | 479 | } |
483 | 480 | ||
484 | 481 | ||
@@ -661,6 +658,8 @@ struct GSC_KeyExchangeInfo * | |||
661 | GSC_KX_start (const struct GNUNET_PeerIdentity *pid) | 658 | GSC_KX_start (const struct GNUNET_PeerIdentity *pid) |
662 | { | 659 | { |
663 | struct GSC_KeyExchangeInfo *kx; | 660 | struct GSC_KeyExchangeInfo *kx; |
661 | struct GNUNET_HashCode h1; | ||
662 | struct GNUNET_HashCode h2; | ||
664 | 663 | ||
665 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 664 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
666 | "Initiating key exchange with `%s'\n", | 665 | "Initiating key exchange with `%s'\n", |
@@ -674,8 +673,11 @@ GSC_KX_start (const struct GNUNET_PeerIdentity *pid) | |||
674 | GNUNET_CONTAINER_DLL_insert (kx_head, | 673 | GNUNET_CONTAINER_DLL_insert (kx_head, |
675 | kx_tail, | 674 | kx_tail, |
676 | kx); | 675 | kx); |
677 | if (0 < GNUNET_CRYPTO_hash_cmp (&pid->hashPubKey, | 676 | GNUNET_CRYPTO_hash (pid, sizeof (struct GNUNET_PeerIdentity), &h1); |
678 | &GSC_my_identity.hashPubKey)) | 677 | GNUNET_CRYPTO_hash (&GSC_my_identity, sizeof (struct GNUNET_PeerIdentity), &h2); |
678 | |||
679 | if (0 < GNUNET_CRYPTO_hash_cmp (&h1, | ||
680 | &h2)) | ||
679 | { | 681 | { |
680 | /* peer with "lower" identity starts KX, otherwise we typically end up | 682 | /* peer with "lower" identity starts KX, otherwise we typically end up |
681 | with both peers starting the exchange and transmit the 'set key' | 683 | with both peers starting the exchange and transmit the 'set key' |
@@ -742,7 +744,6 @@ GSC_KX_handle_ephemeral_key (struct GSC_KeyExchangeInfo *kx, | |||
742 | struct GNUNET_TIME_Absolute start_t; | 744 | struct GNUNET_TIME_Absolute start_t; |
743 | struct GNUNET_TIME_Absolute end_t; | 745 | struct GNUNET_TIME_Absolute end_t; |
744 | struct GNUNET_TIME_Absolute now; | 746 | struct GNUNET_TIME_Absolute now; |
745 | struct GNUNET_PeerIdentity signer_id; | ||
746 | enum KxStateMachine sender_status; | 747 | enum KxStateMachine sender_status; |
747 | uint16_t size; | 748 | uint16_t size; |
748 | struct GNUNET_HashCode key_material; | 749 | struct GNUNET_HashCode key_material; |
@@ -772,11 +773,9 @@ GSC_KX_handle_ephemeral_key (struct GSC_KeyExchangeInfo *kx, | |||
772 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 773 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
773 | "Core service receives `%s' request from `%4s'.\n", "EPHEMERAL_KEY", | 774 | "Core service receives `%s' request from `%4s'.\n", "EPHEMERAL_KEY", |
774 | GNUNET_i2s (&kx->peer)); | 775 | GNUNET_i2s (&kx->peer)); |
775 | GNUNET_CRYPTO_hash (&m->origin_public_key, | ||
776 | sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), | ||
777 | &signer_id.hashPubKey); | ||
778 | if (0 != | 776 | if (0 != |
779 | memcmp (&signer_id, &kx->peer, | 777 | memcmp (&m->origin_identity, |
778 | &kx->peer.public_key, | ||
780 | sizeof (struct GNUNET_PeerIdentity))) | 779 | sizeof (struct GNUNET_PeerIdentity))) |
781 | { | 780 | { |
782 | GNUNET_break_op (0); | 781 | GNUNET_break_op (0); |
@@ -791,7 +790,7 @@ GSC_KX_handle_ephemeral_key (struct GSC_KeyExchangeInfo *kx, | |||
791 | (GNUNET_OK != | 790 | (GNUNET_OK != |
792 | GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_SET_ECC_KEY, | 791 | GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_SET_ECC_KEY, |
793 | &m->purpose, | 792 | &m->purpose, |
794 | &m->signature, &m->origin_public_key))) | 793 | &m->signature, &m->origin_identity.public_key))) |
795 | { | 794 | { |
796 | /* invalid signature */ | 795 | /* invalid signature */ |
797 | GNUNET_break_op (0); | 796 | GNUNET_break_op (0); |
@@ -1496,7 +1495,7 @@ sign_ephemeral_key () | |||
1496 | } | 1495 | } |
1497 | GNUNET_CRYPTO_ecc_key_get_public_for_encryption (my_ephemeral_key, | 1496 | GNUNET_CRYPTO_ecc_key_get_public_for_encryption (my_ephemeral_key, |
1498 | ¤t_ekm.ephemeral_key); | 1497 | ¤t_ekm.ephemeral_key); |
1499 | current_ekm.origin_public_key = my_public_key; | 1498 | current_ekm.origin_identity = GSC_my_identity; |
1500 | GNUNET_assert (GNUNET_OK == | 1499 | GNUNET_assert (GNUNET_OK == |
1501 | GNUNET_CRYPTO_ecc_sign (my_private_key, | 1500 | GNUNET_CRYPTO_ecc_sign (my_private_key, |
1502 | ¤t_ekm.purpose, | 1501 | ¤t_ekm.purpose, |
@@ -1543,9 +1542,8 @@ GSC_KX_init (struct GNUNET_CRYPTO_EccPrivateKey *pk) | |||
1543 | { | 1542 | { |
1544 | GNUNET_assert (NULL != pk); | 1543 | GNUNET_assert (NULL != pk); |
1545 | my_private_key = pk; | 1544 | my_private_key = pk; |
1546 | GNUNET_CRYPTO_ecc_key_get_public_for_signature (my_private_key, &my_public_key); | 1545 | GNUNET_CRYPTO_ecc_key_get_public_for_signature (my_private_key, |
1547 | GNUNET_CRYPTO_hash (&my_public_key, sizeof (my_public_key), | 1546 | &GSC_my_identity.public_key); |
1548 | &GSC_my_identity.hashPubKey); | ||
1549 | if (GNUNET_YES == | 1547 | if (GNUNET_YES == |
1550 | GNUNET_CONFIGURATION_get_value_yesno (GSC_cfg, | 1548 | GNUNET_CONFIGURATION_get_value_yesno (GSC_cfg, |
1551 | "core", | 1549 | "core", |
diff --git a/src/core/gnunet-service-core_neighbours.c b/src/core/gnunet-service-core_neighbours.c index 3841986ac..d82d119d7 100644 --- a/src/core/gnunet-service-core_neighbours.c +++ b/src/core/gnunet-service-core_neighbours.c | |||
@@ -111,7 +111,7 @@ struct Neighbour | |||
111 | /** | 111 | /** |
112 | * Map of peer identities to 'struct Neighbour'. | 112 | * Map of peer identities to 'struct Neighbour'. |
113 | */ | 113 | */ |
114 | static struct GNUNET_CONTAINER_MultiHashMap *neighbours; | 114 | static struct GNUNET_CONTAINER_MultiPeerMap *neighbours; |
115 | 115 | ||
116 | /** | 116 | /** |
117 | * Transport service. | 117 | * Transport service. |
@@ -131,7 +131,7 @@ find_neighbour (const struct GNUNET_PeerIdentity *peer) | |||
131 | { | 131 | { |
132 | if (NULL == neighbours) | 132 | if (NULL == neighbours) |
133 | return NULL; | 133 | return NULL; |
134 | return GNUNET_CONTAINER_multihashmap_get (neighbours, &peer->hashPubKey); | 134 | return GNUNET_CONTAINER_multipeermap_get (neighbours, peer); |
135 | } | 135 | } |
136 | 136 | ||
137 | 137 | ||
@@ -173,11 +173,11 @@ free_neighbour (struct Neighbour *n) | |||
173 | n->retry_plaintext_task = GNUNET_SCHEDULER_NO_TASK; | 173 | n->retry_plaintext_task = GNUNET_SCHEDULER_NO_TASK; |
174 | } | 174 | } |
175 | GNUNET_assert (GNUNET_OK == | 175 | GNUNET_assert (GNUNET_OK == |
176 | GNUNET_CONTAINER_multihashmap_remove (neighbours, | 176 | GNUNET_CONTAINER_multipeermap_remove (neighbours, |
177 | &n->peer.hashPubKey, n)); | 177 | &n->peer, n)); |
178 | GNUNET_STATISTICS_set (GSC_stats, | 178 | GNUNET_STATISTICS_set (GSC_stats, |
179 | gettext_noop ("# neighbour entries allocated"), | 179 | gettext_noop ("# neighbour entries allocated"), |
180 | GNUNET_CONTAINER_multihashmap_size (neighbours), | 180 | GNUNET_CONTAINER_multipeermap_size (neighbours), |
181 | GNUNET_NO); | 181 | GNUNET_NO); |
182 | GNUNET_free (n); | 182 | GNUNET_free (n); |
183 | } | 183 | } |
@@ -321,12 +321,12 @@ handle_transport_notify_connect (void *cls, | |||
321 | n = GNUNET_malloc (sizeof (struct Neighbour)); | 321 | n = GNUNET_malloc (sizeof (struct Neighbour)); |
322 | n->peer = *peer; | 322 | n->peer = *peer; |
323 | GNUNET_assert (GNUNET_OK == | 323 | GNUNET_assert (GNUNET_OK == |
324 | GNUNET_CONTAINER_multihashmap_put (neighbours, | 324 | GNUNET_CONTAINER_multipeermap_put (neighbours, |
325 | &n->peer.hashPubKey, n, | 325 | &n->peer, n, |
326 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 326 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); |
327 | GNUNET_STATISTICS_set (GSC_stats, | 327 | GNUNET_STATISTICS_set (GSC_stats, |
328 | gettext_noop ("# neighbour entries allocated"), | 328 | gettext_noop ("# neighbour entries allocated"), |
329 | GNUNET_CONTAINER_multihashmap_size (neighbours), | 329 | GNUNET_CONTAINER_multipeermap_size (neighbours), |
330 | GNUNET_NO); | 330 | GNUNET_NO); |
331 | n->kxinfo = GSC_KX_start (peer); | 331 | n->kxinfo = GSC_KX_start (peer); |
332 | } | 332 | } |
@@ -454,7 +454,7 @@ GSC_NEIGHBOURS_transmit (const struct GNUNET_PeerIdentity *target, | |||
454 | int | 454 | int |
455 | GSC_NEIGHBOURS_init () | 455 | GSC_NEIGHBOURS_init () |
456 | { | 456 | { |
457 | neighbours = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_NO); | 457 | neighbours = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO); |
458 | transport = | 458 | transport = |
459 | GNUNET_TRANSPORT_connect (GSC_cfg, &GSC_my_identity, NULL, | 459 | GNUNET_TRANSPORT_connect (GSC_cfg, &GSC_my_identity, NULL, |
460 | &handle_transport_receive, | 460 | &handle_transport_receive, |
@@ -462,7 +462,7 @@ GSC_NEIGHBOURS_init () | |||
462 | &handle_transport_notify_disconnect); | 462 | &handle_transport_notify_disconnect); |
463 | if (NULL == transport) | 463 | if (NULL == transport) |
464 | { | 464 | { |
465 | GNUNET_CONTAINER_multihashmap_destroy (neighbours); | 465 | GNUNET_CONTAINER_multipeermap_destroy (neighbours); |
466 | neighbours = NULL; | 466 | neighbours = NULL; |
467 | return GNUNET_SYSERR; | 467 | return GNUNET_SYSERR; |
468 | } | 468 | } |
@@ -479,7 +479,9 @@ GSC_NEIGHBOURS_init () | |||
479 | * @return GNUNET_OK (continue to iterate) | 479 | * @return GNUNET_OK (continue to iterate) |
480 | */ | 480 | */ |
481 | static int | 481 | static int |
482 | free_neighbour_helper (void *cls, const struct GNUNET_HashCode * key, void *value) | 482 | free_neighbour_helper (void *cls, |
483 | const struct GNUNET_PeerIdentity * key, | ||
484 | void *value) | ||
483 | { | 485 | { |
484 | struct Neighbour *n = value; | 486 | struct Neighbour *n = value; |
485 | 487 | ||
@@ -503,9 +505,9 @@ GSC_NEIGHBOURS_done () | |||
503 | } | 505 | } |
504 | if (NULL != neighbours) | 506 | if (NULL != neighbours) |
505 | { | 507 | { |
506 | GNUNET_CONTAINER_multihashmap_iterate (neighbours, &free_neighbour_helper, | 508 | GNUNET_CONTAINER_multipeermap_iterate (neighbours, &free_neighbour_helper, |
507 | NULL); | 509 | NULL); |
508 | GNUNET_CONTAINER_multihashmap_destroy (neighbours); | 510 | GNUNET_CONTAINER_multipeermap_destroy (neighbours); |
509 | neighbours = NULL; | 511 | neighbours = NULL; |
510 | } | 512 | } |
511 | } | 513 | } |
diff --git a/src/core/gnunet-service-core_sessions.c b/src/core/gnunet-service-core_sessions.c index f1a53bee8..6c66086bd 100644 --- a/src/core/gnunet-service-core_sessions.c +++ b/src/core/gnunet-service-core_sessions.c | |||
@@ -147,7 +147,7 @@ struct Session | |||
147 | /** | 147 | /** |
148 | * Map of peer identities to 'struct Session'. | 148 | * Map of peer identities to 'struct Session'. |
149 | */ | 149 | */ |
150 | static struct GNUNET_CONTAINER_MultiHashMap *sessions; | 150 | static struct GNUNET_CONTAINER_MultiPeerMap *sessions; |
151 | 151 | ||
152 | 152 | ||
153 | /** | 153 | /** |
@@ -160,7 +160,7 @@ static struct GNUNET_CONTAINER_MultiHashMap *sessions; | |||
160 | static struct Session * | 160 | static struct Session * |
161 | find_session (const struct GNUNET_PeerIdentity *peer) | 161 | find_session (const struct GNUNET_PeerIdentity *peer) |
162 | { | 162 | { |
163 | return GNUNET_CONTAINER_multihashmap_get (sessions, &peer->hashPubKey); | 163 | return GNUNET_CONTAINER_multipeermap_get (sessions, peer); |
164 | } | 164 | } |
165 | 165 | ||
166 | 166 | ||
@@ -202,12 +202,11 @@ GSC_SESSIONS_end (const struct GNUNET_PeerIdentity *pid) | |||
202 | GSC_CLIENTS_notify_clients_about_neighbour (&session->peer, | 202 | GSC_CLIENTS_notify_clients_about_neighbour (&session->peer, |
203 | session->tmap, NULL); | 203 | session->tmap, NULL); |
204 | GNUNET_assert (GNUNET_YES == | 204 | GNUNET_assert (GNUNET_YES == |
205 | GNUNET_CONTAINER_multihashmap_remove (sessions, | 205 | GNUNET_CONTAINER_multipeermap_remove (sessions, |
206 | &session-> | 206 | &session->peer, |
207 | peer.hashPubKey, | ||
208 | session)); | 207 | session)); |
209 | GNUNET_STATISTICS_set (GSC_stats, gettext_noop ("# peers connected"), | 208 | GNUNET_STATISTICS_set (GSC_stats, gettext_noop ("# peers connected"), |
210 | GNUNET_CONTAINER_multihashmap_size (sessions), | 209 | GNUNET_CONTAINER_multipeermap_size (sessions), |
211 | GNUNET_NO); | 210 | GNUNET_NO); |
212 | GSC_TYPEMAP_destroy (session->tmap); | 211 | GSC_TYPEMAP_destroy (session->tmap); |
213 | session->tmap = NULL; | 212 | session->tmap = NULL; |
@@ -273,11 +272,11 @@ GSC_SESSIONS_create (const struct GNUNET_PeerIdentity *peer, | |||
273 | session->typemap_task = | 272 | session->typemap_task = |
274 | GNUNET_SCHEDULER_add_now (&transmit_typemap_task, session); | 273 | GNUNET_SCHEDULER_add_now (&transmit_typemap_task, session); |
275 | GNUNET_assert (GNUNET_OK == | 274 | GNUNET_assert (GNUNET_OK == |
276 | GNUNET_CONTAINER_multihashmap_put (sessions, &peer->hashPubKey, | 275 | GNUNET_CONTAINER_multipeermap_put (sessions, peer, |
277 | session, | 276 | session, |
278 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 277 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); |
279 | GNUNET_STATISTICS_set (GSC_stats, gettext_noop ("# peers connected"), | 278 | GNUNET_STATISTICS_set (GSC_stats, gettext_noop ("# peers connected"), |
280 | GNUNET_CONTAINER_multihashmap_size (sessions), | 279 | GNUNET_CONTAINER_multipeermap_size (sessions), |
281 | GNUNET_NO); | 280 | GNUNET_NO); |
282 | GSC_CLIENTS_notify_clients_about_neighbour (peer, | 281 | GSC_CLIENTS_notify_clients_about_neighbour (peer, |
283 | NULL, session->tmap); | 282 | NULL, session->tmap); |
@@ -293,7 +292,7 @@ GSC_SESSIONS_create (const struct GNUNET_PeerIdentity *peer, | |||
293 | * @return GNUNET_OK (continue to iterate) | 292 | * @return GNUNET_OK (continue to iterate) |
294 | */ | 293 | */ |
295 | static int | 294 | static int |
296 | notify_client_about_session (void *cls, const struct GNUNET_HashCode * key, | 295 | notify_client_about_session (void *cls, const struct GNUNET_PeerIdentity * key, |
297 | void *value) | 296 | void *value) |
298 | { | 297 | { |
299 | struct GSC_Client *client = cls; | 298 | struct GSC_Client *client = cls; |
@@ -315,7 +314,7 @@ void | |||
315 | GSC_SESSIONS_notify_client_about_sessions (struct GSC_Client *client) | 314 | GSC_SESSIONS_notify_client_about_sessions (struct GSC_Client *client) |
316 | { | 315 | { |
317 | /* notify new client about existing sessions */ | 316 | /* notify new client about existing sessions */ |
318 | GNUNET_CONTAINER_multihashmap_iterate (sessions, ¬ify_client_about_session, | 317 | GNUNET_CONTAINER_multipeermap_iterate (sessions, ¬ify_client_about_session, |
319 | client); | 318 | client); |
320 | } | 319 | } |
321 | 320 | ||
@@ -559,7 +558,7 @@ try_transmission (struct Session *session) | |||
559 | * @return always GNUNET_OK | 558 | * @return always GNUNET_OK |
560 | */ | 559 | */ |
561 | static int | 560 | static int |
562 | do_send_message (void *cls, const struct GNUNET_HashCode * key, void *value) | 561 | do_send_message (void *cls, const struct GNUNET_PeerIdentity * key, void *value) |
563 | { | 562 | { |
564 | const struct GNUNET_MessageHeader *hdr = cls; | 563 | const struct GNUNET_MessageHeader *hdr = cls; |
565 | struct Session *session = value; | 564 | struct Session *session = value; |
@@ -586,7 +585,7 @@ GSC_SESSIONS_broadcast (const struct GNUNET_MessageHeader *msg) | |||
586 | { | 585 | { |
587 | if (NULL == sessions) | 586 | if (NULL == sessions) |
588 | return; | 587 | return; |
589 | GNUNET_CONTAINER_multihashmap_iterate (sessions, &do_send_message, | 588 | GNUNET_CONTAINER_multipeermap_iterate (sessions, &do_send_message, |
590 | (void *) msg); | 589 | (void *) msg); |
591 | } | 590 | } |
592 | 591 | ||
@@ -652,7 +651,7 @@ GSC_SESSIONS_transmit (struct GSC_ClientActiveRequest *car, | |||
652 | */ | 651 | */ |
653 | #include "core.h" | 652 | #include "core.h" |
654 | static int | 653 | static int |
655 | queue_connect_message (void *cls, const struct GNUNET_HashCode * key, void *value) | 654 | queue_connect_message (void *cls, const struct GNUNET_PeerIdentity * key, void *value) |
656 | { | 655 | { |
657 | struct GNUNET_SERVER_TransmitContext *tc = cls; | 656 | struct GNUNET_SERVER_TransmitContext *tc = cls; |
658 | struct Session *session = value; | 657 | struct Session *session = value; |
@@ -687,7 +686,7 @@ GSC_SESSIONS_handle_client_iterate_peers (void *cls, | |||
687 | struct GNUNET_SERVER_TransmitContext *tc; | 686 | struct GNUNET_SERVER_TransmitContext *tc; |
688 | 687 | ||
689 | tc = GNUNET_SERVER_transmit_context_create (client); | 688 | tc = GNUNET_SERVER_transmit_context_create (client); |
690 | GNUNET_CONTAINER_multihashmap_iterate (sessions, &queue_connect_message, tc); | 689 | GNUNET_CONTAINER_multipeermap_iterate (sessions, &queue_connect_message, tc); |
691 | done_msg.size = htons (sizeof (struct GNUNET_MessageHeader)); | 690 | done_msg.size = htons (sizeof (struct GNUNET_MessageHeader)); |
692 | done_msg.type = htons (GNUNET_MESSAGE_TYPE_CORE_ITERATE_PEERS_END); | 691 | done_msg.type = htons (GNUNET_MESSAGE_TYPE_CORE_ITERATE_PEERS_END); |
693 | GNUNET_SERVER_transmit_context_append_message (tc, &done_msg); | 692 | GNUNET_SERVER_transmit_context_append_message (tc, &done_msg); |
@@ -760,7 +759,7 @@ GSC_SESSIONS_add_to_typemap (const struct GNUNET_PeerIdentity *peer, | |||
760 | void | 759 | void |
761 | GSC_SESSIONS_init () | 760 | GSC_SESSIONS_init () |
762 | { | 761 | { |
763 | sessions = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_NO); | 762 | sessions = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO); |
764 | } | 763 | } |
765 | 764 | ||
766 | 765 | ||
@@ -773,7 +772,7 @@ GSC_SESSIONS_init () | |||
773 | * @return GNUNET_OK (continue to iterate) | 772 | * @return GNUNET_OK (continue to iterate) |
774 | */ | 773 | */ |
775 | static int | 774 | static int |
776 | free_session_helper (void *cls, const struct GNUNET_HashCode * key, void *value) | 775 | free_session_helper (void *cls, const struct GNUNET_PeerIdentity * key, void *value) |
777 | { | 776 | { |
778 | struct Session *session = value; | 777 | struct Session *session = value; |
779 | 778 | ||
@@ -790,8 +789,8 @@ GSC_SESSIONS_done () | |||
790 | { | 789 | { |
791 | if (NULL != sessions) | 790 | if (NULL != sessions) |
792 | { | 791 | { |
793 | GNUNET_CONTAINER_multihashmap_iterate (sessions, &free_session_helper, NULL); | 792 | GNUNET_CONTAINER_multipeermap_iterate (sessions, &free_session_helper, NULL); |
794 | GNUNET_CONTAINER_multihashmap_destroy (sessions); | 793 | GNUNET_CONTAINER_multipeermap_destroy (sessions); |
795 | sessions = NULL; | 794 | sessions = NULL; |
796 | } | 795 | } |
797 | } | 796 | } |