diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-09-24 11:58:31 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-09-24 11:58:31 +0000 |
commit | 3bca0a62abc14e5fe36e1c80ff487e0051dad562 (patch) | |
tree | 25a9dc36162d498910f6e41aa85a0d3863e0c1c0 /src/peerstore/peerstore_api.c | |
parent | d02c15600b668a30e091d2c5c59d918bb1e4fee7 (diff) | |
download | gnunet-3bca0a62abc14e5fe36e1c80ff487e0051dad562.tar.gz gnunet-3bca0a62abc14e5fe36e1c80ff487e0051dad562.zip |
migrate peerstore to new service MQ API
Diffstat (limited to 'src/peerstore/peerstore_api.c')
-rw-r--r-- | src/peerstore/peerstore_api.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/peerstore/peerstore_api.c b/src/peerstore/peerstore_api.c index f6910c017..47bf7775e 100644 --- a/src/peerstore/peerstore_api.c +++ b/src/peerstore/peerstore_api.c | |||
@@ -579,7 +579,7 @@ handle_iterate_end (void *cls, | |||
579 | */ | 579 | */ |
580 | static int | 580 | static int |
581 | check_iterate_result (void *cls, | 581 | check_iterate_result (void *cls, |
582 | const struct GNUNET_MessageHeader *msg) | 582 | const struct StoreRecordMessage *msg) |
583 | { | 583 | { |
584 | /* we defer validation to #handle_iterate_result */ | 584 | /* we defer validation to #handle_iterate_result */ |
585 | return GNUNET_OK; | 585 | return GNUNET_OK; |
@@ -594,7 +594,7 @@ check_iterate_result (void *cls, | |||
594 | */ | 594 | */ |
595 | static void | 595 | static void |
596 | handle_iterate_result (void *cls, | 596 | handle_iterate_result (void *cls, |
597 | const struct GNUNET_MessageHeader *msg) | 597 | const struct StoreRecordMessage *msg) |
598 | { | 598 | { |
599 | struct GNUNET_PEERSTORE_Handle *h = cls; | 599 | struct GNUNET_PEERSTORE_Handle *h = cls; |
600 | struct GNUNET_PEERSTORE_IterateContext *ic; | 600 | struct GNUNET_PEERSTORE_IterateContext *ic; |
@@ -725,7 +725,7 @@ GNUNET_PEERSTORE_iterate (struct GNUNET_PEERSTORE_Handle *h, | |||
725 | */ | 725 | */ |
726 | static int | 726 | static int |
727 | check_watch_record (void *cls, | 727 | check_watch_record (void *cls, |
728 | const struct GNUNET_MessageHeader *msg) | 728 | const struct StoreRecordMessage *msg) |
729 | { | 729 | { |
730 | /* we defer validation to #handle_watch_result */ | 730 | /* we defer validation to #handle_watch_result */ |
731 | return GNUNET_OK; | 731 | return GNUNET_OK; |
@@ -740,7 +740,7 @@ check_watch_record (void *cls, | |||
740 | */ | 740 | */ |
741 | static void | 741 | static void |
742 | handle_watch_record (void *cls, | 742 | handle_watch_record (void *cls, |
743 | const struct GNUNET_MessageHeader *msg) | 743 | const struct StoreRecordMessage *msg) |
744 | { | 744 | { |
745 | struct GNUNET_PEERSTORE_Handle *h = cls; | 745 | struct GNUNET_PEERSTORE_Handle *h = cls; |
746 | struct GNUNET_PEERSTORE_Record *record; | 746 | struct GNUNET_PEERSTORE_Record *record; |
@@ -793,11 +793,11 @@ reconnect (struct GNUNET_PEERSTORE_Handle *h) | |||
793 | h), | 793 | h), |
794 | GNUNET_MQ_hd_var_size (iterate_result, | 794 | GNUNET_MQ_hd_var_size (iterate_result, |
795 | GNUNET_MESSAGE_TYPE_PEERSTORE_ITERATE_RECORD, | 795 | GNUNET_MESSAGE_TYPE_PEERSTORE_ITERATE_RECORD, |
796 | struct GNUNET_MessageHeader, | 796 | struct StoreRecordMessage, |
797 | h), | 797 | h), |
798 | GNUNET_MQ_hd_var_size (watch_record, | 798 | GNUNET_MQ_hd_var_size (watch_record, |
799 | GNUNET_MESSAGE_TYPE_PEERSTORE_WATCH_RECORD, | 799 | GNUNET_MESSAGE_TYPE_PEERSTORE_WATCH_RECORD, |
800 | struct GNUNET_MessageHeader, | 800 | struct StoreRecordMessage, |
801 | h), | 801 | h), |
802 | GNUNET_MQ_handler_end () | 802 | GNUNET_MQ_handler_end () |
803 | }; | 803 | }; |
@@ -936,18 +936,20 @@ GNUNET_PEERSTORE_watch (struct GNUNET_PEERSTORE_Handle *h, | |||
936 | wc->h = h; | 936 | wc->h = h; |
937 | wc->keyhash = hm->keyhash; | 937 | wc->keyhash = hm->keyhash; |
938 | if (NULL == h->watches) | 938 | if (NULL == h->watches) |
939 | h->watches = GNUNET_CONTAINER_multihashmap_create (5, GNUNET_NO); | 939 | h->watches = GNUNET_CONTAINER_multihashmap_create (5, |
940 | GNUNET_NO); | ||
940 | GNUNET_assert (GNUNET_OK == | 941 | GNUNET_assert (GNUNET_OK == |
941 | GNUNET_CONTAINER_multihashmap_put (h->watches, | 942 | GNUNET_CONTAINER_multihashmap_put (h->watches, |
942 | &wc->keyhash, | 943 | &wc->keyhash, |
943 | wc, | 944 | wc, |
944 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE)); | 945 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE)); |
945 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 946 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
946 | "Sending a watch request for ss `%s', peer `%s', key `%s'.\n", | 947 | "Sending a watch request for subsystem `%s', peer `%s', key `%s'.\n", |
947 | sub_system, | 948 | sub_system, |
948 | GNUNET_i2s (peer), | 949 | GNUNET_i2s (peer), |
949 | key); | 950 | key); |
950 | GNUNET_MQ_send (h->mq, ev); | 951 | GNUNET_MQ_send (h->mq, |
952 | ev); | ||
951 | return wc; | 953 | return wc; |
952 | } | 954 | } |
953 | 955 | ||