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/core_api.c | |
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/core_api.c')
-rw-r--r-- | src/core/core_api.c | 39 |
1 files changed, 20 insertions, 19 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 | ||