aboutsummaryrefslogtreecommitdiff
path: root/src/dht
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-09-26 21:35:46 +0000
committerChristian Grothoff <christian@grothoff.org>2016-09-26 21:35:46 +0000
commit0bf8817f025818c83d31eea23203a2c99ba83f7e (patch)
tree1ebcdb5e84cc321b3104bfe318420f9eda291126 /src/dht
parent7b00dd51218edbd9182caa664cfce185edc2cc45 (diff)
downloadgnunet-0bf8817f025818c83d31eea23203a2c99ba83f7e.tar.gz
gnunet-0bf8817f025818c83d31eea23203a2c99ba83f7e.zip
-migrating wdht to new service API
Diffstat (limited to 'src/dht')
-rw-r--r--src/dht/Makefile.am3
-rw-r--r--src/dht/gnunet-service-dht.h2
-rw-r--r--src/dht/gnunet-service-wdht.c66
-rw-r--r--src/dht/gnunet-service-wdht_clients.h149
-rw-r--r--src/dht/gnunet-service-wdht_neighbours.c81
-rw-r--r--src/dht/gnunet-service-wdht_neighbours.h121
-rw-r--r--src/dht/gnunet-service-xdht.c6
7 files changed, 77 insertions, 351 deletions
diff --git a/src/dht/Makefile.am b/src/dht/Makefile.am
index 10aeae175..f91917768 100644
--- a/src/dht/Makefile.am
+++ b/src/dht/Makefile.am
@@ -103,10 +103,9 @@ gnunet_service_dht_xvine_LDADD = \
103 103
104gnunet_service_dht_whanau_SOURCES = \ 104gnunet_service_dht_whanau_SOURCES = \
105 gnunet-service-wdht.c gnunet-service-wdht.h \ 105 gnunet-service-wdht.c gnunet-service-wdht.h \
106 gnunet-service-wdht_clients.c gnunet-service-wdht_clients.h \
107 gnunet-service-dht_datacache.c gnunet-service-dht_datacache.h \ 106 gnunet-service-dht_datacache.c gnunet-service-dht_datacache.h \
108 gnunet-service-dht_nse.c gnunet-service-dht_nse.h \ 107 gnunet-service-dht_nse.c gnunet-service-dht_nse.h \
109 gnunet-service-wdht_neighbours.c gnunet-service-wdht_neighbours.h 108 gnunet-service-wdht_neighbours.c gnunet-service-dht_neighbours.h
110gnunet_service_dht_whanau_LDADD = \ 109gnunet_service_dht_whanau_LDADD = \
111 $(top_builddir)/src/statistics/libgnunetstatistics.la \ 110 $(top_builddir)/src/statistics/libgnunetstatistics.la \
112 $(top_builddir)/src/core/libgnunetcore.la \ 111 $(top_builddir)/src/core/libgnunetcore.la \
diff --git a/src/dht/gnunet-service-dht.h b/src/dht/gnunet-service-dht.h
index 493c3b961..8b0602104 100644
--- a/src/dht/gnunet-service-dht.h
+++ b/src/dht/gnunet-service-dht.h
@@ -158,7 +158,7 @@ GDS_CLIENTS_process_put (uint32_t options,
158 unsigned int path_length, 158 unsigned int path_length,
159 const struct GNUNET_PeerIdentity *path, 159 const struct GNUNET_PeerIdentity *path,
160 struct GNUNET_TIME_Absolute exp, 160 struct GNUNET_TIME_Absolute exp,
161 const struct GNUNET_HashCode * key, 161 const struct GNUNET_HashCode *key,
162 const void *data, 162 const void *data,
163 size_t size); 163 size_t size);
164 164
diff --git a/src/dht/gnunet-service-wdht.c b/src/dht/gnunet-service-wdht.c
index 8be25ad5e..e1ca1c968 100644
--- a/src/dht/gnunet-service-wdht.c
+++ b/src/dht/gnunet-service-wdht.c
@@ -24,7 +24,6 @@
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 * @author Nathan Evans 25 * @author Nathan Evans
26 */ 26 */
27
28#include "platform.h" 27#include "platform.h"
29#include "gnunet_block_lib.h" 28#include "gnunet_block_lib.h"
30#include "gnunet_util_lib.h" 29#include "gnunet_util_lib.h"
@@ -33,27 +32,13 @@
33#include "gnunet_dht_service.h" 32#include "gnunet_dht_service.h"
34#include "gnunet_statistics_service.h" 33#include "gnunet_statistics_service.h"
35#include "gnunet-service-wdht.h" 34#include "gnunet-service-wdht.h"
36#include "gnunet-service-wdht_clients.h"
37#include "gnunet-service-dht_datacache.h" 35#include "gnunet-service-dht_datacache.h"
38#include "gnunet-service-wdht_neighbours.h" 36#include "gnunet-service-dht_neighbours.h"
39#include "gnunet-service-dht_nse.h" 37#include "gnunet-service-dht_nse.h"
40 38
41 39
42 40/* Code shared between different DHT implementations */
43/** 41#include "gnunet-service-dht_clients.c"
44 * Handle for the statistics service.
45 */
46struct GNUNET_STATISTICS_Handle *GDS_stats;
47
48/**
49 * Our handle to the BLOCK library.
50 */
51struct GNUNET_BLOCK_Context *GDS_block_context;
52
53/**
54 * The configuration the DHT service is running with
55 */
56const struct GNUNET_CONFIGURATION_Handle *GDS_cfg;
57 42
58 43
59/** 44/**
@@ -67,16 +52,17 @@ shutdown_task (void *cls)
67 GDS_NEIGHBOURS_done (); 52 GDS_NEIGHBOURS_done ();
68 GDS_DATACACHE_done (); 53 GDS_DATACACHE_done ();
69 GDS_NSE_done (); 54 GDS_NSE_done ();
70 if (GDS_block_context != NULL) 55 if (NULL != GDS_block_context)
71 { 56 {
72 GNUNET_BLOCK_context_destroy (GDS_block_context); 57 GNUNET_BLOCK_context_destroy (GDS_block_context);
73 GDS_block_context = NULL; 58 GDS_block_context = NULL;
74 } 59 }
75 if (GDS_stats != NULL) 60 if (NULL != GDS_stats)
76 { 61 {
77 GNUNET_STATISTICS_destroy (GDS_stats, GNUNET_YES); 62 GNUNET_STATISTICS_destroy (GDS_stats, GNUNET_YES);
78 GDS_stats = NULL; 63 GDS_stats = NULL;
79 } 64 }
65 GDS_CLIENTS_stop ();
80} 66}
81 67
82 68
@@ -84,48 +70,34 @@ shutdown_task (void *cls)
84 * Process dht requests. 70 * Process dht requests.
85 * 71 *
86 * @param cls closure 72 * @param cls closure
87 * @param server the initialized server
88 * @param c configuration to use 73 * @param c configuration to use
74 * @param service the initialized service
89 */ 75 */
90static void 76static void
91run (void *cls, struct GNUNET_SERVER_Handle *server, 77run (void *cls,
92 const struct GNUNET_CONFIGURATION_Handle *c) 78 const struct GNUNET_CONFIGURATION_Handle *c,
79 struct GNUNET_SERVICE_Handle *service)
93{ 80{
94 GDS_cfg = c; 81 GDS_cfg = c;
82 GDS_service = service;
95 GDS_block_context = GNUNET_BLOCK_context_create (GDS_cfg); 83 GDS_block_context = GNUNET_BLOCK_context_create (GDS_cfg);
96 GDS_stats = GNUNET_STATISTICS_create ("dht", GDS_cfg); 84 GDS_stats = GNUNET_STATISTICS_create ("dht",
85 GDS_cfg);
97 GDS_NSE_init (); 86 GDS_NSE_init ();
98 GDS_DATACACHE_init (); 87 GDS_DATACACHE_init ();
99 GDS_CLIENTS_init (server); 88 GDS_CLIENTS_init ();
89 GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
90 NULL);
100 if (GNUNET_OK != GDS_NEIGHBOURS_init ()) 91 if (GNUNET_OK != GDS_NEIGHBOURS_init ())
101 { 92 {
102 shutdown_task (NULL); 93 GNUNET_SCHEDULER_shutdown ();
103 return; 94 return;
104 } 95 }
105 GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
106 NULL);
107} 96}
108 97
109 98
110/** 99/* Finally, define the main method */
111 * The main function for the dht service. 100GDS_DHT_SERVICE_INIT("wdht", &run);
112 *
113 * @param argc number of arguments from the command line
114 * @param argv command line arguments
115 * @return 0 ok, 1 on error
116 */
117int
118main (int argc, char *const *argv)
119{
120 int ret;
121 101
122 ret =
123 (GNUNET_OK ==
124 GNUNET_SERVICE_run (argc, argv, "wdht",
125 GNUNET_SERVICE_OPTION_NONE, &run,
126 NULL)) ? 0 : 1;
127 GDS_CLIENTS_done ();
128 return ret;
129}
130 102
131/* end of gnunet-service-wdht.c */ 103/* end of gnunet-service-wdht.c */
diff --git a/src/dht/gnunet-service-wdht_clients.h b/src/dht/gnunet-service-wdht_clients.h
deleted file mode 100644
index f51564136..000000000
--- a/src/dht/gnunet-service-wdht_clients.h
+++ /dev/null
@@ -1,149 +0,0 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2009, 2010, 2011 GNUnet e.V.
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21/**
22 * @file dht/gnunet-service-xdht_clients.h
23 * @brief GNUnet DHT service's client management code
24 * @author Christian Grothoff
25 * @author Nathan Evans
26 */
27#ifndef GNUNET_SERVICE_DHT_CLIENT_H
28#define GNUNET_SERVICE_DHT_CLIENT_H
29
30#include "gnunet_util_lib.h"
31#include "gnunet_block_lib.h"
32
33/**
34 * Handle a reply we've received from another peer. If the reply
35 * matches any of our pending queries, forward it to the respective
36 * client(s).
37 *
38 * @param expiration when will the reply expire
39 * @param key the query this reply is for
40 * @param get_path_length number of peers in @a get_path
41 * @param get_path path the reply took on get
42 * @param put_path_length number of peers in @a put_path
43 * @param put_path path the reply took on put
44 * @param type type of the reply
45 * @param data_size number of bytes in @a data
46 * @param data application payload data
47 */
48void
49GDS_CLIENTS_handle_reply (struct GNUNET_TIME_Absolute expiration,
50 const struct GNUNET_HashCode *key,
51 unsigned int get_path_length,
52 const struct GNUNET_PeerIdentity *get_path,
53 unsigned int put_path_length,
54 const struct GNUNET_PeerIdentity *put_path,
55 enum GNUNET_BLOCK_Type type, size_t data_size,
56 const void *data);
57
58
59/**
60 * Check if some client is monitoring GET messages and notify
61 * them in that case.
62 *
63 * @param options Options, for instance RecordRoute, DemultiplexEverywhere.
64 * @param type The type of data in the request.
65 * @param hop_count Hop count so far.
66 * @param path_length number of entries in path (or 0 if not recorded).
67 * @param path peers on the GET path (or NULL if not recorded).
68 * @param desired_replication_level Desired replication level.
69 * @param key Key of the requested data.
70 */
71void
72GDS_CLIENTS_process_get (uint32_t options,
73 enum GNUNET_BLOCK_Type type,
74 uint32_t hop_count,
75 uint32_t desired_replication_level,
76 unsigned int path_length,
77 const struct GNUNET_PeerIdentity *path,
78 const struct GNUNET_HashCode *key);
79
80
81/**
82 * Check if some client is monitoring GET RESP messages and notify
83 * them in that case.
84 *
85 * @param type The type of data in the result.
86 * @param get_path Peers on GET path (or NULL if not recorded).
87 * @param get_path_length number of entries in @a get_path.
88 * @param put_path peers on the PUT path (or NULL if not recorded).
89 * @param put_path_length number of entries in @a get_path.
90 * @param exp Expiration time of the data.
91 * @param key Key of the @a data.
92 * @param data Pointer to the result data.
93 * @param size Number of bytes in @a data.
94 */
95void
96GDS_CLIENTS_process_get_resp (enum GNUNET_BLOCK_Type type,
97 const struct GNUNET_PeerIdentity *get_path,
98 unsigned int get_path_length,
99 const struct GNUNET_PeerIdentity *put_path,
100 unsigned int put_path_length,
101 struct GNUNET_TIME_Absolute exp,
102 const struct GNUNET_HashCode * key,
103 const void *data,
104 size_t size);
105
106
107/**
108 * Check if some client is monitoring PUT messages and notify
109 * them in that case.
110 *
111 * @param options Options, for instance RecordRoute, DemultiplexEverywhere.
112 * @param type The type of data in the request.
113 * @param hop_count Hop count so far.
114 * @param path_length number of entries in path (or 0 if not recorded).
115 * @param path peers on the PUT path (or NULL if not recorded).
116 * @param desired_replication_level Desired replication level.
117 * @param exp Expiration time of the data.
118 * @param key Key under which data is to be stored.
119 * @param data Pointer to the data carried.
120 * @param size Number of bytes in data.
121 */
122void
123GDS_CLIENTS_process_put (uint32_t options,
124 enum GNUNET_BLOCK_Type type,
125 uint32_t hop_count,
126 uint32_t desired_replication_level,
127 unsigned int path_length,
128 const struct GNUNET_PeerIdentity *path,
129 struct GNUNET_TIME_Absolute exp,
130 const struct GNUNET_HashCode * key,
131 const void *data,
132 size_t size);
133
134/**
135 * Initialize client subsystem.
136 *
137 * @param server the initialized server
138 */
139void
140GDS_CLIENTS_init (struct GNUNET_SERVER_Handle *server);
141
142
143/**
144 * Shutdown client subsystem.
145 */
146void
147GDS_CLIENTS_done (void);
148
149#endif
diff --git a/src/dht/gnunet-service-wdht_neighbours.c b/src/dht/gnunet-service-wdht_neighbours.c
index 2a88ffa09..d3b92585b 100644
--- a/src/dht/gnunet-service-wdht_neighbours.c
+++ b/src/dht/gnunet-service-wdht_neighbours.c
@@ -39,10 +39,9 @@
39#include "gnunet_transport_service.h" 39#include "gnunet_transport_service.h"
40#include "gnunet_dht_service.h" 40#include "gnunet_dht_service.h"
41#include "gnunet_statistics_service.h" 41#include "gnunet_statistics_service.h"
42#include "gnunet-service-wdht.h" 42#include "gnunet-service-dht.h"
43#include "gnunet-service-wdht_clients.h"
44#include "gnunet-service-dht_datacache.h" 43#include "gnunet-service-dht_datacache.h"
45#include "gnunet-service-wdht_neighbours.h" 44#include "gnunet-service-dht_neighbours.h"
46#include "gnunet-service-dht_nse.h" 45#include "gnunet-service-dht_nse.h"
47#include "dht.h" 46#include "dht.h"
48 47
@@ -585,20 +584,29 @@ static struct GNUNET_CORE_Handle *core_api;
585/** 584/**
586 * Handle the put request from the client. 585 * Handle the put request from the client.
587 * 586 *
588 * @param key Key for the content
589 * @param block_type Type of the block 587 * @param block_type Type of the block
590 * @param options Routing options 588 * @param options routing options
591 * @param desired_replication_level Desired replication count 589 * @param desired_replication_level desired replication level
592 * @param expiration_time When does the content expire 590 * @param expiration_time when does the content expire
593 * @param data Content to store 591 * @param hop_count how many hops has this message traversed so far
594 * @param data_size Size of content @a data in bytes 592 * @param bf Bloom filter of peers this PUT has already traversed
593 * @param key key for the content
594 * @param put_path_length number of entries in put_path
595 * @param put_path peers this request has traversed so far (if tracked)
596 * @param data payload to store
597 * @param data_size number of bytes in data
598 * @return #GNUNET_OK if the request was forwarded, #GNUNET_NO if not
595 */ 599 */
596void 600int
597GDS_NEIGHBOURS_handle_put (const struct GNUNET_HashCode *key, 601GDS_NEIGHBOURS_handle_put (enum GNUNET_BLOCK_Type block_type,
598 enum GNUNET_BLOCK_Type block_type,
599 enum GNUNET_DHT_RouteOption options, 602 enum GNUNET_DHT_RouteOption options,
600 uint32_t desired_replication_level, 603 uint32_t desired_replication_level,
601 struct GNUNET_TIME_Absolute expiration_time, 604 struct GNUNET_TIME_Absolute expiration_time,
605 uint32_t hop_count,
606 struct GNUNET_CONTAINER_BloomFilter *bf,
607 const struct GNUNET_HashCode *key,
608 unsigned int put_path_length,
609 struct GNUNET_PeerIdentity *put_path,
602 const void *data, 610 const void *data,
603 size_t data_size) 611 size_t data_size)
604{ 612{
@@ -610,34 +618,51 @@ GDS_NEIGHBOURS_handle_put (const struct GNUNET_HashCode *key,
610 data); 618 data);
611 GDS_CLIENTS_process_put (options, 619 GDS_CLIENTS_process_put (options,
612 block_type, 620 block_type,
613 0, 0, 621 hop_count,
614 0, NULL, 622 desired_replication_level,
623 put_path_length, put_path,
615 expiration_time, 624 expiration_time,
616 key, 625 key,
617 data, 626 data,
618 data_size); 627 data_size);
628 return GNUNET_OK; /* FIXME... */
619} 629}
620 630
621 631
622/** 632/**
623 * Handle the get request from the client file. If I am destination do 633 * Perform a GET operation. Forwards the given request to other
624 * datacache put and return. Else find the target friend and forward message 634 * peers. Does not lookup the key locally. May do nothing if this is
625 * to it. 635 * the only peer in the network (or if we are the closest peer in the
636 * network).
626 * 637 *
627 * @param key Key for the content 638 * @param type type of the block
628 * @param block_type Type of the block 639 * @param options routing options
629 * @param options Routing options 640 * @param desired_replication_level desired replication count
630 * @param desired_replication_level Desired replication count 641 * @param hop_count how many hops did this request traverse so far?
642 * @param key key for the content
643 * @param xquery extended query
644 * @param xquery_size number of bytes in @a xquery
645 * @param reply_bf bloomfilter to filter duplicates
646 * @param reply_bf_mutator mutator for @a reply_bf
647 * @param peer_bf filter for peers not to select (again, updated)
648 * @return #GNUNET_OK if the request was forwarded, #GNUNET_NO if not
631 */ 649 */
632void 650int
633GDS_NEIGHBOURS_handle_get (const struct GNUNET_HashCode *key, 651GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type,
634 enum GNUNET_BLOCK_Type block_type,
635 enum GNUNET_DHT_RouteOption options, 652 enum GNUNET_DHT_RouteOption options,
636 uint32_t desired_replication_level) 653 uint32_t desired_replication_level,
654 uint32_t hop_count,
655 const struct GNUNET_HashCode *key,
656 const void *xquery, size_t xquery_size,
657 const struct GNUNET_CONTAINER_BloomFilter *reply_bf,
658 uint32_t reply_bf_mutator,
659 struct GNUNET_CONTAINER_BloomFilter *peer_bf)
637{ 660{
638 // find closest finger(s) on all layers 661 // find closest finger(s) on all layers
639 // use TrailRoute with PeerGetMessage embedded to contact peer 662 // use TrailRoute with PeerGetMessage embedded to contact peer
640 // NOTE: actually more complicated, see paper! 663 // NOTE: actually more complicated, see paper!
664 GNUNET_break (0); // not implemented!
665 return GNUNET_SYSERR;
641} 666}
642 667
643 668
@@ -1734,10 +1759,10 @@ GDS_NEIGHBOURS_done (void)
1734 * 1759 *
1735 * @return my identity 1760 * @return my identity
1736 */ 1761 */
1737struct GNUNET_PeerIdentity 1762struct GNUNET_PeerIdentity *
1738GDS_NEIGHBOURS_get_my_id (void) 1763GDS_NEIGHBOURS_get_id (void)
1739{ 1764{
1740 return my_identity; 1765 return &my_identity;
1741} 1766}
1742 1767
1743/* end of gnunet-service-wdht_neighbours.c */ 1768/* end of gnunet-service-wdht_neighbours.c */
diff --git a/src/dht/gnunet-service-wdht_neighbours.h b/src/dht/gnunet-service-wdht_neighbours.h
deleted file mode 100644
index 8461d16e8..000000000
--- a/src/dht/gnunet-service-wdht_neighbours.h
+++ /dev/null
@@ -1,121 +0,0 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2009, 2010, 2011, 2015 GNUnet e.V.
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21/**
22 * @file dht/gnunet-service-wdht_neighbours.h
23 * @brief GNUnet DHT routing code
24 * @author Supriti Singh
25 */
26
27#ifndef GNUNET_SERVICE_WDHT_NEIGHBOURS_H
28#define GNUNET_SERVICE_WDHT_NEIGHBOURS_H
29
30#include "gnunet_util_lib.h"
31#include "gnunet_block_lib.h"
32#include "gnunet_dht_service.h"
33
34
35/**
36 * Handle the put request from the client.
37 *
38 * @param key Key for the content
39 * @param block_type Type of the block
40 * @param options Routing options
41 * @param desired_replication_level Desired replication count
42 * @param expiration_time When does the content expire
43 * @param data Content to store
44 * @param data_size Size of content @a data in bytes
45 */
46void
47GDS_NEIGHBOURS_handle_put (const struct GNUNET_HashCode *key,
48 enum GNUNET_BLOCK_Type block_type,
49 enum GNUNET_DHT_RouteOption options,
50 uint32_t desired_replication_level,
51 struct GNUNET_TIME_Absolute expiration_time,
52 const void *data, size_t data_size);
53
54/**
55 * Handle the get request from the client file. If I am destination do
56 * datacache put and return. Else find the target friend and forward message
57 * to it.
58 *
59 * @param key Key for the content
60 * @param block_type Type of the block
61 * @param options Routing options
62 * @param desired_replication_level Desired replication count
63 */
64void
65GDS_NEIGHBOURS_handle_get (const struct GNUNET_HashCode *key,
66 enum GNUNET_BLOCK_Type block_type,
67 enum GNUNET_DHT_RouteOption options,
68 uint32_t desired_replication_level);
69
70
71/**
72 * Send the get result to requesting client.
73 *
74 * @param cls a `const struct GNUNET_HashCode *` trail identifying where to send the result to, NULL for us
75 * @param options routing options (from GET request)
76 * @param key key of the requested data.
77 * @param type block type
78 * @param put_path_length number of peers in @a put_path
79 * @param put_path path taken to put the data at its stored location.
80 * @param expiration when will this result expire?
81 * @param data payload to store
82 * @param data_size size of the @a data
83 */
84void
85GDS_NEIGHBOURS_send_get_result (void *cls,
86 enum GNUNET_DHT_RouteOption options,
87 const struct GNUNET_HashCode *key,
88 enum GNUNET_BLOCK_Type type,
89 unsigned int put_path_length,
90 const struct GNUNET_PeerIdentity *put_path,
91 struct GNUNET_TIME_Absolute expiration,
92 const void *data,
93 size_t data_size);
94
95
96/**
97 * Initialize neighbours subsystem.
98 *
99 * @return #GNUNET_OK on success,
100 * #GNUNET_SYSERR on error
101 */
102int
103GDS_NEIGHBOURS_init (void);
104
105
106/**
107 * Shutdown neighbours subsystem.
108 */
109void
110GDS_NEIGHBOURS_done (void);
111
112
113/**
114 * Get my identity
115 *
116 * @return my identity
117 */
118struct GNUNET_PeerIdentity
119GDS_NEIGHBOURS_get_my_id (void);
120
121#endif
diff --git a/src/dht/gnunet-service-xdht.c b/src/dht/gnunet-service-xdht.c
index 382a3b7c3..7d0cb8a3a 100644
--- a/src/dht/gnunet-service-xdht.c
+++ b/src/dht/gnunet-service-xdht.c
@@ -104,13 +104,13 @@ run (void *cls,
104 { 104 {
105 track_topology = (unsigned int) _track_topology; 105 track_topology = (unsigned int) _track_topology;
106 } 106 }
107 GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
108 NULL);
107 if (GNUNET_OK != GDS_NEIGHBOURS_init ()) 109 if (GNUNET_OK != GDS_NEIGHBOURS_init ())
108 { 110 {
109 shutdown_task (NULL); 111 GNUNET_SCHEDULER_shutdown ();
110 return; 112 return;
111 } 113 }
112 GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
113 NULL);
114} 114}
115 115
116 116