aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schanzenbach <schanzen@gnunet.org>2023-11-04 14:50:38 +0100
committerMartin Schanzenbach <schanzen@gnunet.org>2023-11-04 14:50:38 +0100
commitc8f6e6c5361816c0736bd1e13cf54975134338ac (patch)
tree438424ec6bfd369ed99c5d2759d8d8391ff12a43
parentb0aabe22477ddf51ac379e9d86120aec13204404 (diff)
downloadgnunet-c8f6e6c5361816c0736bd1e13cf54975134338ac.tar.gz
gnunet-c8f6e6c5361816c0736bd1e13cf54975134338ac.zip
meson: add topology for build
also, fix use of builder_iterate and multiple related warnings.
-rw-r--r--src/service/dht/gnunet-service-dht_neighbours.c1
-rw-r--r--src/service/hostlist/gnunet-daemon-hostlist_server.c4
-rw-r--r--src/service/meson.build1
-rw-r--r--src/service/topology/gnunet-daemon-topology.c42
-rw-r--r--src/service/topology/meson.build23
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
index 836b57a23..15a4b21f7 100644
--- 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,
1300static void 1300static void
1301hello_check (const struct GNUNET_DATACACHE_Block *bd) 1301hello_check (const struct GNUNET_DATACACHE_Block *bd)
1302{ 1302{
1303 const struct GNUNET_PeerIdentity *pid;
1304 struct GNUNET_HELLO_Builder *b; 1303 struct GNUNET_HELLO_Builder *b;
1305 1304
1306 if (GNUNET_BLOCK_TYPE_DHT_HELLO != bd->type) 1305 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
index c4a7aab03..dd4f435a1 100644
--- 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,
198 const struct GNUNET_PeerIdentity *peer, 198 const struct GNUNET_PeerIdentity *peer,
199 void *value) 199 void *value)
200{ 200{
201 (void *) cls; 201 (void) cls;
202 size_t old; 202 size_t old;
203 size_t s; 203 size_t s;
204 struct GNUNET_MessageHeader *hello = value; 204 struct GNUNET_MessageHeader *hello = value;
205 struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
206 struct GNUNET_TIME_Absolute hello_exp;
207 205
208 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 206 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
209 "host_processor\n"); 207 "host_processor\n");
diff --git a/src/service/meson.build b/src/service/meson.build
index ad2dad394..e899fc630 100644
--- a/src/service/meson.build
+++ b/src/service/meson.build
@@ -19,6 +19,7 @@ subdir('nse')
19subdir('dhtu') 19subdir('dhtu')
20subdir('dht') 20subdir('dht')
21subdir('hostlist') 21subdir('hostlist')
22subdir('topology')
22subdir('regex') 23subdir('regex')
23subdir('dns') 24subdir('dns')
24subdir('identity') 25subdir('identity')
diff --git a/src/service/topology/gnunet-daemon-topology.c b/src/service/topology/gnunet-daemon-topology.c
index 453ac9661..a1875eb38 100644
--- a/src/service/topology/gnunet-daemon-topology.c
+++ b/src/service/topology/gnunet-daemon-topology.c
@@ -42,13 +42,13 @@
42 * At what frequency do we sent HELLOs to a peer? 42 * At what frequency do we sent HELLOs to a peer?
43 */ 43 */
44#define HELLO_ADVERTISEMENT_MIN_FREQUENCY \ 44#define HELLO_ADVERTISEMENT_MIN_FREQUENCY \
45 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5) 45 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5)
46 46
47/** 47/**
48 * After what time period do we expire the HELLO Bloom filter? 48 * After what time period do we expire the HELLO Bloom filter?
49 */ 49 */
50#define HELLO_ADVERTISEMENT_MIN_REPEAT_FREQUENCY \ 50#define HELLO_ADVERTISEMENT_MIN_REPEAT_FREQUENCY \
51 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 4) 51 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 4)
52 52
53 53
54/** 54/**
@@ -630,12 +630,14 @@ disconnect_notify (void *cls,
630 */ 630 */
631static void 631static void
632address_iterator (void *cls, 632address_iterator (void *cls,
633 const struct GNUNET_PeerIdentity *pid,
633 const char *uri) 634 const char *uri)
634{ 635{
636 (void) pid;
635 int *flag = cls; 637 int *flag = cls;
636 638
637 *flag = *flag + 1; 639 *flag = *flag + 1;
638 //*flag = GNUNET_YES; 640 // *flag = GNUNET_YES;
639} 641}
640 642
641 643
@@ -651,26 +653,25 @@ consider_for_advertising (const struct GNUNET_MessageHeader *hello)
651 int num_addresses_old = 0; 653 int num_addresses_old = 0;
652 int num_addresses_new = 0; 654 int num_addresses_new = 0;
653 struct GNUNET_HELLO_Builder *builder = GNUNET_HELLO_builder_from_msg (hello); 655 struct GNUNET_HELLO_Builder *builder = GNUNET_HELLO_builder_from_msg (hello);
654 struct GNUNET_PeerIdentity pid; 656 const struct GNUNET_PeerIdentity *pid;
655 struct Peer *peer; 657 struct Peer *peer;
656 uint16_t size; 658 uint16_t size;
657 659
658 GNUNET_HELLO_builder_iterate (builder, 660 pid = GNUNET_HELLO_builder_iterate (builder,
659 &pid, 661 &address_iterator,
660 &address_iterator, 662 &num_addresses_new);
661 &num_addresses_new);
662 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 663 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
663 "consider 0 for %s\n", 664 "consider 0 for %s\n",
664 GNUNET_i2s (&pid)); 665 GNUNET_i2s (pid));
665 if (0 == num_addresses_new) 666 if (0 == num_addresses_new)
666 { 667 {
667 GNUNET_HELLO_builder_free (builder); 668 GNUNET_HELLO_builder_free (builder);
668 return; /* no point in advertising this one... */ 669 return; /* no point in advertising this one... */
669 } 670 }
670 peer = GNUNET_CONTAINER_multipeermap_get (peers, &pid); 671 peer = GNUNET_CONTAINER_multipeermap_get (peers, pid);
671 if (NULL == peer) 672 if (NULL == peer)
672 { 673 {
673 peer = make_peer (&pid, hello); 674 peer = make_peer (pid, hello);
674 } 675 }
675 else if (NULL != peer->hello) 676 else if (NULL != peer->hello)
676 { 677 {
@@ -679,11 +680,10 @@ consider_for_advertising (const struct GNUNET_MessageHeader *hello)
679 GNUNET_HELLO_builder_get_expiration_time (hello); 680 GNUNET_HELLO_builder_get_expiration_time (hello);
680 struct GNUNET_TIME_Absolute old_hello_exp = 681 struct GNUNET_TIME_Absolute old_hello_exp =
681 GNUNET_HELLO_builder_get_expiration_time (peer->hello); 682 GNUNET_HELLO_builder_get_expiration_time (peer->hello);
682 struct GNUNET_HELLO_Builder *builder_old = GNUNET_HELLO_builder_from_msg (peer->hello); 683 struct GNUNET_HELLO_Builder *builder_old = GNUNET_HELLO_builder_from_msg (
683 struct GNUNET_PeerIdentity pid_old; 684 peer->hello);
684 685
685 GNUNET_HELLO_builder_iterate (builder_old, 686 GNUNET_HELLO_builder_iterate (builder_old,
686 &pid_old,
687 &address_iterator, 687 &address_iterator,
688 &num_addresses_old); 688 &num_addresses_old);
689 if (GNUNET_TIME_absolute_cmp (new_hello_exp, >, now) && 689 if (GNUNET_TIME_absolute_cmp (new_hello_exp, >, now) &&
@@ -711,7 +711,7 @@ consider_for_advertising (const struct GNUNET_MessageHeader *hello)
711 } 711 }
712 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 712 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
713 "Found HELLO from peer `%s' for advertising\n", 713 "Found HELLO from peer `%s' for advertising\n",
714 GNUNET_i2s (&pid)); 714 GNUNET_i2s (pid));
715 if (NULL != peer->filter) 715 if (NULL != peer->filter)
716 { 716 {
717 GNUNET_CONTAINER_bloomfilter_free (peer->filter); 717 GNUNET_CONTAINER_bloomfilter_free (peer->filter);
@@ -779,16 +779,19 @@ process_peer (void *cls,
779 attempt_connect (pos); 779 attempt_connect (pos);
780} 780}
781 781
782
782static void 783static void
783start_notify (void *cls) 784start_notify (void *cls)
784{ 785{
785 (void) cls; 786 (void) cls;
786 787
787 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting to process new hellos for gossiping.\n"); 788 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
789 "Starting to process new hellos for gossiping.\n");
788 peerstore_notify = 790 peerstore_notify =
789 GNUNET_PEERSTORE_hello_changed_notify (ps, GNUNET_NO, &process_peer, NULL); 791 GNUNET_PEERSTORE_hello_changed_notify (ps, GNUNET_NO, &process_peer, NULL);
790} 792}
791 793
794
792/** 795/**
793 * Function called after #GNUNET_CORE_connect has succeeded 796 * Function called after #GNUNET_CORE_connect has succeeded
794 * (or failed for good). 797 * (or failed for good).
@@ -809,9 +812,10 @@ core_init (void *cls, const struct GNUNET_PeerIdentity *my_id)
809 } 812 }
810 my_identity = *my_id; 813 my_identity = *my_id;
811 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "I am peer `%s'\n", GNUNET_i2s (my_id)); 814 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "I am peer `%s'\n", GNUNET_i2s (my_id));
812 peerstore_notify_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, 815 peerstore_notify_task = GNUNET_SCHEDULER_add_delayed (
813 start_notify, 816 GNUNET_TIME_UNIT_MINUTES,
814 NULL); 817 start_notify,
818 NULL);
815} 819}
816 820
817 821
diff --git a/src/service/topology/meson.build b/src/service/topology/meson.build
index 33b704b41..ca3cc6935 100644
--- a/src/service/topology/meson.build
+++ b/src/service/topology/meson.build
@@ -1,5 +1,3 @@
1libgnunetfriends_src = ['friends.c']
2
3gnunetdaemontopology_src = ['gnunet-daemon-topology.c'] 1gnunetdaemontopology_src = ['gnunet-daemon-topology.c']
4 2
5configure_file(input : 'topology.conf', 3configure_file(input : 'topology.conf',
@@ -10,26 +8,15 @@ configure_file(input : 'topology.conf',
10 8
11 9
12if get_option('monolith') 10if get_option('monolith')
13 foreach p : libgnunetfriends_src 11 # FIXME add daemon when new daemon macro is ported/ready for it.
14 gnunet_src += 'topology/' + p 12 #foreach p : libgnunetfriends_src
15 endforeach 13 # gnunet_src += 'topology/' + p
14 #endforeach
16endif 15endif
17 16
18libgnunetfriends = library('gnunetfriends',
19 libgnunetfriends_src,
20 soversion: '0',
21 version: '0.0.0',
22 dependencies: libgnunetutil_dep,
23 include_directories: [incdir, configuration_inc],
24 install: true,
25 install_dir: get_option('libdir'))
26pkg.generate(libgnunetfriends, url: 'https://www.gnunet.org',
27 description : 'Provides API for accessing the friends service')
28libgnunetfriends_dep = declare_dependency(link_with : libgnunetfriends)
29
30executable ('gnunet-daemon-topology', 17executable ('gnunet-daemon-topology',
31 gnunetdaemontopology_src, 18 gnunetdaemontopology_src,
32 dependencies: [libgnunetfriends_dep, 19 dependencies: [
33 libgnunetutil_dep, 20 libgnunetutil_dep,
34 libgnunetcore_dep, 21 libgnunetcore_dep,
35 libgnunetpeerstore_dep, 22 libgnunetpeerstore_dep,