aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Schanzenbach <schanzen@gnunet.org>2024-02-23 20:30:12 +0100
committerMartin Schanzenbach <schanzen@gnunet.org>2024-02-23 20:30:12 +0100
commitbc7352773263092fb0c448024e00c3769d6ccb78 (patch)
tree2f9fd1dac247ade11fcc3685eb2a8acb50f06247 /src
parentb4df071fcec052619c408b1e6488fe98b652e9c6 (diff)
downloadgnunet-bc7352773263092fb0c448024e00c3769d6ccb78.tar.gz
gnunet-bc7352773263092fb0c448024e00c3769d6ccb78.zip
RPS: ftbfs with new api
Diffstat (limited to 'src')
-rw-r--r--src/contrib/service/rps/gnunet-service-rps.c61
-rw-r--r--src/lib/util/gnunet_error_codes.c1
-rw-r--r--src/service/peerstore/peerstore_api.c2
3 files changed, 42 insertions, 22 deletions
diff --git a/src/contrib/service/rps/gnunet-service-rps.c b/src/contrib/service/rps/gnunet-service-rps.c
index 8ca25257a..1ea59104b 100644
--- a/src/contrib/service/rps/gnunet-service-rps.c
+++ b/src/contrib/service/rps/gnunet-service-rps.c
@@ -67,7 +67,7 @@
67 * Get peer flag of given peer context. 67 * Get peer flag of given peer context.
68 */ 68 */
69#define check_peer_flag_set(peer_ctx, mask) \ 69#define check_peer_flag_set(peer_ctx, mask) \
70 ((peer_ctx->peer_flags) & (mask) ? GNUNET_YES : GNUNET_NO) 70 ((peer_ctx->peer_flags) & (mask) ? GNUNET_YES : GNUNET_NO)
71 71
72/** 72/**
73 * Unset flag of given peer context. 73 * Unset flag of given peer context.
@@ -78,7 +78,7 @@
78 * Get channel flag of given channel context. 78 * Get channel flag of given channel context.
79 */ 79 */
80#define check_channel_flag_set(channel_flags, mask) \ 80#define check_channel_flag_set(channel_flags, mask) \
81 ((*channel_flags) & (mask) ? GNUNET_YES : GNUNET_NO) 81 ((*channel_flags) & (mask) ? GNUNET_YES : GNUNET_NO)
82 82
83/** 83/**
84 * Unset flag of given channel context. 84 * Unset flag of given channel context.
@@ -507,7 +507,7 @@ static struct GNUNET_PEERSTORE_Handle *peerstore;
507 * Our peerstore notification context. We use notification 507 * Our peerstore notification context. We use notification
508 * to instantly learn about new peers as they are discovered. 508 * to instantly learn about new peers as they are discovered.
509 */ 509 */
510static struct GNUNET_PEERSTORE_NotifyContext *peerstore_notify; 510static struct GNUNET_PEERSTORE_Monitor *peerstore_notify;
511 511
512 512
513#if ENABLE_MALICIOUS 513#if ENABLE_MALICIOUS
@@ -4431,7 +4431,7 @@ do_round (void *cls)
4431 "+%s\t(push list)", 4431 "+%s\t(push list)",
4432 GNUNET_i2s_full (&view_array[i])); 4432 GNUNET_i2s_full (&view_array[i]));
4433#endif /* TO_FILE_FULL */ 4433#endif /* TO_FILE_FULL */
4434 // TODO change the peer_flags accordingly 4434 // TODO change the peer_flags accordingly
4435 } 4435 }
4436 GNUNET_free (permut); 4436 GNUNET_free (permut);
4437 permut = NULL; 4437 permut = NULL;
@@ -4462,7 +4462,7 @@ do_round (void *cls)
4462 "+%s\t(pull list)", 4462 "+%s\t(pull list)",
4463 GNUNET_i2s_full (&view_array[i])); 4463 GNUNET_i2s_full (&view_array[i]));
4464#endif /* TO_FILE_FULL */ 4464#endif /* TO_FILE_FULL */
4465 // TODO change the peer_flags accordingly 4465 // TODO change the peer_flags accordingly
4466 } 4466 }
4467 GNUNET_free (permut); 4467 GNUNET_free (permut);
4468 permut = NULL; 4468 permut = NULL;
@@ -4697,22 +4697,17 @@ valid_peers_iterator (void *cls,
4697 */ 4697 */
4698void 4698void
4699process_peerinfo_peers (void *cls, 4699process_peerinfo_peers (void *cls,
4700 const struct GNUNET_PeerIdentity *peer, 4700 const struct GNUNET_PEERSTORE_Record *record,
4701 const struct GNUNET_MessageHeader *hello,
4702 const char *emsg) 4701 const char *emsg)
4703{ 4702{
4704 struct Sub *sub = cls; 4703 struct Sub *sub = cls;
4705
4706 (void) hello;
4707 (void) emsg; 4704 (void) emsg;
4708 4705
4709 if (NULL != peer) 4706 LOG (GNUNET_ERROR_TYPE_DEBUG,
4710 { 4707 "Got peer_id %s from peerinfo\n",
4711 LOG (GNUNET_ERROR_TYPE_DEBUG, 4708 GNUNET_i2s (&record->peer));
4712 "Got peer_id %s from peerinfo\n", 4709 got_peer (sub, &record->peer);
4713 GNUNET_i2s (peer)); 4710 GNUNET_PEERSTORE_monitor_next(peerstore_notify, 1);
4714 got_peer (sub, peer);
4715 }
4716} 4711}
4717 4712
4718 4713
@@ -4744,7 +4739,7 @@ shutdown_task (void *cls)
4744 } 4739 }
4745 4740
4746 /* Disconnect from other services */ 4741 /* Disconnect from other services */
4747 GNUNET_PEERSTORE_hello_changed_notify_cancel (peerstore_notify); 4742 GNUNET_PEERSTORE_monitor_stop (peerstore_notify);
4748 GNUNET_PEERSTORE_disconnect (peerstore); 4743 GNUNET_PEERSTORE_disconnect (peerstore);
4749 peerstore = NULL; 4744 peerstore = NULL;
4750 GNUNET_NSE_disconnect (nse); 4745 GNUNET_NSE_disconnect (nse);
@@ -4851,6 +4846,22 @@ client_disconnect_cb (void *cls,
4851} 4846}
4852 4847
4853 4848
4849static void
4850error_cb (void *cls)
4851{
4852 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
4853 "Error in PEERSTORE monitoring\n");
4854}
4855
4856
4857static void
4858sync_cb (void *cls)
4859{
4860 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
4861 "Done with initial PEERSTORE iteration during monitoring\n");
4862}
4863
4864
4854/** 4865/**
4855 * Handle random peer sampling clients. 4866 * Handle random peer sampling clients.
4856 * 4867 *
@@ -4948,10 +4959,18 @@ run (void *cls,
4948 restore_valid_peers (msub); 4959 restore_valid_peers (msub);
4949 get_valid_peers (msub->valid_peers, valid_peers_iterator, msub); 4960 get_valid_peers (msub->valid_peers, valid_peers_iterator, msub);
4950 4961
4951 peerstore_notify = GNUNET_PEERSTORE_hello_changed_notify (peerstore, 4962 peerstore_notify =
4952 GNUNET_NO, 4963 GNUNET_PEERSTORE_monitor_start (c,
4953 process_peerinfo_peers, 4964 GNUNET_YES,
4954 msub); 4965 "peerstore",
4966 NULL,
4967 GNUNET_PEERSTORE_HELLO_KEY,
4968 &error_cb,
4969 NULL,
4970 &sync_cb,
4971 NULL,
4972 &process_peerinfo_peers,
4973 msub);
4955 4974
4956 LOG (GNUNET_ERROR_TYPE_INFO, "Ready to receive requests from clients\n"); 4975 LOG (GNUNET_ERROR_TYPE_INFO, "Ready to receive requests from clients\n");
4957 4976
diff --git a/src/lib/util/gnunet_error_codes.c b/src/lib/util/gnunet_error_codes.c
index 11ce2d0c8..c286f2e52 100644
--- a/src/lib/util/gnunet_error_codes.c
+++ b/src/lib/util/gnunet_error_codes.c
@@ -17,6 +17,7 @@
17 17
18 SPDX-License-Identifier: AGPL3.0-or-later 18 SPDX-License-Identifier: AGPL3.0-or-later
19 */ 19 */
20#include "platform.h"
20#include "gnunet_error_codes.h" 21#include "gnunet_error_codes.h"
21#include <stddef.h> 22#include <stddef.h>
22#include <microhttpd.h> 23#include <microhttpd.h>
diff --git a/src/service/peerstore/peerstore_api.c b/src/service/peerstore/peerstore_api.c
index f52879b5c..6272ebdff 100644
--- a/src/service/peerstore/peerstore_api.c
+++ b/src/service/peerstore/peerstore_api.c
@@ -23,9 +23,9 @@
23 * @author Omar Tarabai 23 * @author Omar Tarabai
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 */ 25 */
26#include "platform.h"
26#include "gnunet_common.h" 27#include "gnunet_common.h"
27#include "gnunet_protocols.h" 28#include "gnunet_protocols.h"
28#include "platform.h"
29#include "gnunet_util_lib.h" 29#include "gnunet_util_lib.h"
30#include "gnunet_hello_uri_lib.h" 30#include "gnunet_hello_uri_lib.h"
31#include "peerstore.h" 31#include "peerstore.h"