gnunet

Main GNUnet Logic
Log | Files | Refs | Submodules | README | LICENSE

commit c8f6e6c5361816c0736bd1e13cf54975134338ac
parent b0aabe22477ddf51ac379e9d86120aec13204404
Author: Martin Schanzenbach <schanzen@gnunet.org>
Date:   Sat,  4 Nov 2023 14:50:38 +0100

meson: add topology for build

also, fix use of builder_iterate and multiple related warnings.

Diffstat:
Msrc/service/dht/gnunet-service-dht_neighbours.c | 1-
Msrc/service/hostlist/gnunet-daemon-hostlist_server.c | 4+---
Msrc/service/meson.build | 1+
Msrc/service/topology/gnunet-daemon-topology.c | 42+++++++++++++++++++++++-------------------
Msrc/service/topology/meson.build | 23+++++------------------
5 files changed, 30 insertions(+), 41 deletions(-)

diff --git a/src/service/dht/gnunet-service-dht_neighbours.c b/src/service/dht/gnunet-service-dht_neighbours.c @@ -1300,7 +1300,6 @@ get_target_peers (const struct GNUNET_HashCode *key, static void hello_check (const struct GNUNET_DATACACHE_Block *bd) { - const struct GNUNET_PeerIdentity *pid; struct GNUNET_HELLO_Builder *b; if (GNUNET_BLOCK_TYPE_DHT_HELLO != bd->type) diff --git a/src/service/hostlist/gnunet-daemon-hostlist_server.c b/src/service/hostlist/gnunet-daemon-hostlist_server.c @@ -198,12 +198,10 @@ host_processor (void *cls, const struct GNUNET_PeerIdentity *peer, void *value) { - (void *) cls; + (void) cls; size_t old; size_t s; struct GNUNET_MessageHeader *hello = value; - struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); - struct GNUNET_TIME_Absolute hello_exp; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "host_processor\n"); diff --git a/src/service/meson.build b/src/service/meson.build @@ -19,6 +19,7 @@ subdir('nse') subdir('dhtu') subdir('dht') subdir('hostlist') +subdir('topology') subdir('regex') subdir('dns') subdir('identity') diff --git a/src/service/topology/gnunet-daemon-topology.c b/src/service/topology/gnunet-daemon-topology.c @@ -42,13 +42,13 @@ * At what frequency do we sent HELLOs to a peer? */ #define HELLO_ADVERTISEMENT_MIN_FREQUENCY \ - GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5) + GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5) /** * After what time period do we expire the HELLO Bloom filter? */ #define HELLO_ADVERTISEMENT_MIN_REPEAT_FREQUENCY \ - GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 4) + GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 4) /** @@ -630,12 +630,14 @@ disconnect_notify (void *cls, */ static void address_iterator (void *cls, + const struct GNUNET_PeerIdentity *pid, const char *uri) { + (void) pid; int *flag = cls; *flag = *flag + 1; - //*flag = GNUNET_YES; + // *flag = GNUNET_YES; } @@ -651,26 +653,25 @@ consider_for_advertising (const struct GNUNET_MessageHeader *hello) int num_addresses_old = 0; int num_addresses_new = 0; struct GNUNET_HELLO_Builder *builder = GNUNET_HELLO_builder_from_msg (hello); - struct GNUNET_PeerIdentity pid; + const struct GNUNET_PeerIdentity *pid; struct Peer *peer; uint16_t size; - GNUNET_HELLO_builder_iterate (builder, - &pid, - &address_iterator, - &num_addresses_new); + pid = GNUNET_HELLO_builder_iterate (builder, + &address_iterator, + &num_addresses_new); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "consider 0 for %s\n", - GNUNET_i2s (&pid)); + GNUNET_i2s (pid)); if (0 == num_addresses_new) { GNUNET_HELLO_builder_free (builder); return; /* no point in advertising this one... */ } - peer = GNUNET_CONTAINER_multipeermap_get (peers, &pid); + peer = GNUNET_CONTAINER_multipeermap_get (peers, pid); if (NULL == peer) { - peer = make_peer (&pid, hello); + peer = make_peer (pid, hello); } else if (NULL != peer->hello) { @@ -679,11 +680,10 @@ consider_for_advertising (const struct GNUNET_MessageHeader *hello) GNUNET_HELLO_builder_get_expiration_time (hello); struct GNUNET_TIME_Absolute old_hello_exp = GNUNET_HELLO_builder_get_expiration_time (peer->hello); - struct GNUNET_HELLO_Builder *builder_old = GNUNET_HELLO_builder_from_msg (peer->hello); - struct GNUNET_PeerIdentity pid_old; + struct GNUNET_HELLO_Builder *builder_old = GNUNET_HELLO_builder_from_msg ( + peer->hello); GNUNET_HELLO_builder_iterate (builder_old, - &pid_old, &address_iterator, &num_addresses_old); if (GNUNET_TIME_absolute_cmp (new_hello_exp, >, now) && @@ -711,7 +711,7 @@ consider_for_advertising (const struct GNUNET_MessageHeader *hello) } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found HELLO from peer `%s' for advertising\n", - GNUNET_i2s (&pid)); + GNUNET_i2s (pid)); if (NULL != peer->filter) { GNUNET_CONTAINER_bloomfilter_free (peer->filter); @@ -779,16 +779,19 @@ process_peer (void *cls, attempt_connect (pos); } + static void start_notify (void *cls) { (void) cls; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting to process new hellos for gossiping.\n"); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Starting to process new hellos for gossiping.\n"); peerstore_notify = GNUNET_PEERSTORE_hello_changed_notify (ps, GNUNET_NO, &process_peer, NULL); } + /** * Function called after #GNUNET_CORE_connect has succeeded * (or failed for good). @@ -809,9 +812,10 @@ core_init (void *cls, const struct GNUNET_PeerIdentity *my_id) } my_identity = *my_id; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "I am peer `%s'\n", GNUNET_i2s (my_id)); - peerstore_notify_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, - start_notify, - NULL); + peerstore_notify_task = GNUNET_SCHEDULER_add_delayed ( + GNUNET_TIME_UNIT_MINUTES, + start_notify, + NULL); } diff --git a/src/service/topology/meson.build b/src/service/topology/meson.build @@ -1,5 +1,3 @@ -libgnunetfriends_src = ['friends.c'] - gnunetdaemontopology_src = ['gnunet-daemon-topology.c'] configure_file(input : 'topology.conf', @@ -10,26 +8,15 @@ configure_file(input : 'topology.conf', if get_option('monolith') - foreach p : libgnunetfriends_src - gnunet_src += 'topology/' + p - endforeach + # FIXME add daemon when new daemon macro is ported/ready for it. + #foreach p : libgnunetfriends_src + # gnunet_src += 'topology/' + p + #endforeach endif -libgnunetfriends = library('gnunetfriends', - libgnunetfriends_src, - soversion: '0', - version: '0.0.0', - dependencies: libgnunetutil_dep, - include_directories: [incdir, configuration_inc], - install: true, - install_dir: get_option('libdir')) -pkg.generate(libgnunetfriends, url: 'https://www.gnunet.org', - description : 'Provides API for accessing the friends service') -libgnunetfriends_dep = declare_dependency(link_with : libgnunetfriends) - executable ('gnunet-daemon-topology', gnunetdaemontopology_src, - dependencies: [libgnunetfriends_dep, + dependencies: [ libgnunetutil_dep, libgnunetcore_dep, libgnunetpeerstore_dep,