diff options
Diffstat (limited to 'src/namecache/gnunet-service-namecache.c')
-rw-r--r-- | src/namecache/gnunet-service-namecache.c | 338 |
1 files changed, 167 insertions, 171 deletions
diff --git a/src/namecache/gnunet-service-namecache.c b/src/namecache/gnunet-service-namecache.c index 00d9d81b5..e9f45a4fc 100644 --- a/src/namecache/gnunet-service-namecache.c +++ b/src/namecache/gnunet-service-namecache.c | |||
@@ -11,12 +11,12 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file namecache/gnunet-service-namecache.c | 22 | * @file namecache/gnunet-service-namecache.c |
@@ -33,15 +33,13 @@ | |||
33 | #include "gnunet_signatures.h" | 33 | #include "gnunet_signatures.h" |
34 | #include "namecache.h" | 34 | #include "namecache.h" |
35 | 35 | ||
36 | #define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename) | 36 | #define LOG_STRERROR_FILE(kind, syscall, filename) GNUNET_log_from_strerror_file(kind, "util", syscall, filename) |
37 | 37 | ||
38 | 38 | ||
39 | /** | 39 | /** |
40 | * A namecache client | 40 | * A namecache client |
41 | */ | 41 | */ |
42 | struct NamecacheClient | 42 | struct NamecacheClient { |
43 | { | ||
44 | |||
45 | /** | 43 | /** |
46 | * The client | 44 | * The client |
47 | */ | 45 | */ |
@@ -51,7 +49,6 @@ struct NamecacheClient | |||
51 | * The message queue to talk to @e client. | 49 | * The message queue to talk to @e client. |
52 | */ | 50 | */ |
53 | struct GNUNET_MQ_Handle *mq; | 51 | struct GNUNET_MQ_Handle *mq; |
54 | |||
55 | }; | 52 | }; |
56 | 53 | ||
57 | 54 | ||
@@ -82,21 +79,21 @@ static char *db_lib_name; | |||
82 | * @param cls unused | 79 | * @param cls unused |
83 | */ | 80 | */ |
84 | static void | 81 | static void |
85 | cleanup_task (void *cls) | 82 | cleanup_task(void *cls) |
86 | { | 83 | { |
87 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 84 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
88 | "Stopping namecache service\n"); | 85 | "Stopping namecache service\n"); |
89 | GNUNET_break (NULL == | 86 | GNUNET_break(NULL == |
90 | GNUNET_PLUGIN_unload (db_lib_name, | 87 | GNUNET_PLUGIN_unload(db_lib_name, |
91 | GSN_database)); | 88 | GSN_database)); |
92 | GNUNET_free (db_lib_name); | 89 | GNUNET_free(db_lib_name); |
93 | db_lib_name = NULL; | 90 | db_lib_name = NULL; |
94 | if (NULL != statistics) | 91 | if (NULL != statistics) |
95 | { | 92 | { |
96 | GNUNET_STATISTICS_destroy (statistics, | 93 | GNUNET_STATISTICS_destroy(statistics, |
97 | GNUNET_NO); | 94 | GNUNET_NO); |
98 | statistics = NULL; | 95 | statistics = NULL; |
99 | } | 96 | } |
100 | } | 97 | } |
101 | 98 | ||
102 | 99 | ||
@@ -109,16 +106,16 @@ cleanup_task (void *cls) | |||
109 | * @param app_ctx the `struct NamecacheClient` for this @a client | 106 | * @param app_ctx the `struct NamecacheClient` for this @a client |
110 | */ | 107 | */ |
111 | static void | 108 | static void |
112 | client_disconnect_cb (void *cls, | 109 | client_disconnect_cb(void *cls, |
113 | struct GNUNET_SERVICE_Client *client, | 110 | struct GNUNET_SERVICE_Client *client, |
114 | void *app_ctx) | 111 | void *app_ctx) |
115 | { | 112 | { |
116 | struct NamecacheClient *nc = app_ctx; | 113 | struct NamecacheClient *nc = app_ctx; |
117 | 114 | ||
118 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 115 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
119 | "Client %p disconnected\n", | 116 | "Client %p disconnected\n", |
120 | client); | 117 | client); |
121 | GNUNET_free (nc); | 118 | GNUNET_free(nc); |
122 | } | 119 | } |
123 | 120 | ||
124 | 121 | ||
@@ -131,16 +128,16 @@ client_disconnect_cb (void *cls, | |||
131 | * @return internal namecache client structure for this client | 128 | * @return internal namecache client structure for this client |
132 | */ | 129 | */ |
133 | static void * | 130 | static void * |
134 | client_connect_cb (void *cls, | 131 | client_connect_cb(void *cls, |
135 | struct GNUNET_SERVICE_Client *client, | 132 | struct GNUNET_SERVICE_Client *client, |
136 | struct GNUNET_MQ_Handle *mq) | 133 | struct GNUNET_MQ_Handle *mq) |
137 | { | 134 | { |
138 | struct NamecacheClient *nc; | 135 | struct NamecacheClient *nc; |
139 | 136 | ||
140 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 137 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
141 | "Client %p connected\n", | 138 | "Client %p connected\n", |
142 | client); | 139 | client); |
143 | nc = GNUNET_new (struct NamecacheClient); | 140 | nc = GNUNET_new(struct NamecacheClient); |
144 | nc->client = client; | 141 | nc->client = client; |
145 | nc->mq = mq; | 142 | nc->mq = mq; |
146 | return nc; | 143 | return nc; |
@@ -151,8 +148,7 @@ client_connect_cb (void *cls, | |||
151 | * Context for name lookups passed from #handle_lookup_block to | 148 | * Context for name lookups passed from #handle_lookup_block to |
152 | * #handle_lookup_block_it as closure | 149 | * #handle_lookup_block_it as closure |
153 | */ | 150 | */ |
154 | struct LookupBlockContext | 151 | struct LookupBlockContext { |
155 | { | ||
156 | /** | 152 | /** |
157 | * The client to send the response to | 153 | * The client to send the response to |
158 | */ | 154 | */ |
@@ -162,7 +158,7 @@ struct LookupBlockContext | |||
162 | * Operation id for the name lookup | 158 | * Operation id for the name lookup |
163 | */ | 159 | */ |
164 | uint32_t request_id; | 160 | uint32_t request_id; |
165 | 161 | ||
166 | /** | 162 | /** |
167 | * Lookup status | 163 | * Lookup status |
168 | */ | 164 | */ |
@@ -177,8 +173,8 @@ struct LookupBlockContext | |||
177 | * @param block the block | 173 | * @param block the block |
178 | */ | 174 | */ |
179 | static void | 175 | static void |
180 | handle_lookup_block_it (void *cls, | 176 | handle_lookup_block_it(void *cls, |
181 | const struct GNUNET_GNSRECORD_Block *block) | 177 | const struct GNUNET_GNSRECORD_Block *block) |
182 | { | 178 | { |
183 | struct LookupBlockContext *lnc = cls; | 179 | struct LookupBlockContext *lnc = cls; |
184 | struct GNUNET_MQ_Envelope *env; | 180 | struct GNUNET_MQ_Envelope *env; |
@@ -186,37 +182,37 @@ handle_lookup_block_it (void *cls, | |||
186 | size_t esize; | 182 | size_t esize; |
187 | size_t bsize; | 183 | size_t bsize; |
188 | 184 | ||
189 | bsize = ntohl (block->purpose.size); | 185 | bsize = ntohl(block->purpose.size); |
190 | if (bsize < | 186 | if (bsize < |
191 | (sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + sizeof (struct GNUNET_TIME_AbsoluteNBO))) | 187 | (sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose) + sizeof(struct GNUNET_TIME_AbsoluteNBO))) |
192 | { | 188 | { |
193 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 189 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, |
194 | "Malformed block."); | 190 | "Malformed block."); |
195 | lnc->status = GNUNET_SYSERR; | 191 | lnc->status = GNUNET_SYSERR; |
196 | return; | 192 | return; |
197 | } | 193 | } |
198 | esize = ntohl (block->purpose.size) | 194 | esize = ntohl(block->purpose.size) |
199 | - sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) | 195 | - sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose) |
200 | - sizeof (struct GNUNET_TIME_AbsoluteNBO); | 196 | - sizeof(struct GNUNET_TIME_AbsoluteNBO); |
201 | env = GNUNET_MQ_msg_extra (r, | 197 | env = GNUNET_MQ_msg_extra(r, |
202 | esize, | 198 | esize, |
203 | GNUNET_MESSAGE_TYPE_NAMECACHE_LOOKUP_BLOCK_RESPONSE); | 199 | GNUNET_MESSAGE_TYPE_NAMECACHE_LOOKUP_BLOCK_RESPONSE); |
204 | r->gns_header.r_id = htonl (lnc->request_id); | 200 | r->gns_header.r_id = htonl(lnc->request_id); |
205 | r->expire = block->expiration_time; | 201 | r->expire = block->expiration_time; |
206 | r->signature = block->signature; | 202 | r->signature = block->signature; |
207 | r->derived_key = block->derived_key; | 203 | r->derived_key = block->derived_key; |
208 | GNUNET_memcpy (&r[1], | 204 | GNUNET_memcpy(&r[1], |
209 | &block[1], | 205 | &block[1], |
210 | esize); | 206 | esize); |
211 | GNUNET_STATISTICS_update (statistics, | 207 | GNUNET_STATISTICS_update(statistics, |
212 | "blocks found in cache", | 208 | "blocks found in cache", |
213 | 1, | 209 | 1, |
214 | GNUNET_NO); | 210 | GNUNET_NO); |
215 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 211 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
216 | "Sending NAMECACHE_LOOKUP_BLOCK_RESPONSE message with expiration time %s\n", | 212 | "Sending NAMECACHE_LOOKUP_BLOCK_RESPONSE message with expiration time %s\n", |
217 | GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (r->expire))); | 213 | GNUNET_STRINGS_absolute_time_to_string(GNUNET_TIME_absolute_ntoh(r->expire))); |
218 | GNUNET_MQ_send (lnc->nc->mq, | 214 | GNUNET_MQ_send(lnc->nc->mq, |
219 | env); | 215 | env); |
220 | } | 216 | } |
221 | 217 | ||
222 | 218 | ||
@@ -227,8 +223,8 @@ handle_lookup_block_it (void *cls, | |||
227 | * @param the inbound message | 223 | * @param the inbound message |
228 | */ | 224 | */ |
229 | static void | 225 | static void |
230 | handle_lookup_block (void *cls, | 226 | handle_lookup_block(void *cls, |
231 | const struct LookupBlockMessage *ln_msg) | 227 | const struct LookupBlockMessage *ln_msg) |
232 | { | 228 | { |
233 | struct NamecacheClient *nc = cls; | 229 | struct NamecacheClient *nc = cls; |
234 | struct GNUNET_MQ_Envelope *env; | 230 | struct GNUNET_MQ_Envelope *env; |
@@ -236,40 +232,40 @@ handle_lookup_block (void *cls, | |||
236 | struct LookupBlockResponseMessage *zir_end; | 232 | struct LookupBlockResponseMessage *zir_end; |
237 | int ret; | 233 | int ret; |
238 | 234 | ||
239 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 235 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
240 | "Received NAMECACHE_LOOKUP_BLOCK message\n"); | 236 | "Received NAMECACHE_LOOKUP_BLOCK message\n"); |
241 | GNUNET_STATISTICS_update (statistics, | 237 | GNUNET_STATISTICS_update(statistics, |
242 | "blocks looked up", | 238 | "blocks looked up", |
243 | 1, | 239 | 1, |
244 | GNUNET_NO); | 240 | GNUNET_NO); |
245 | lnc.request_id = ntohl (ln_msg->gns_header.r_id); | 241 | lnc.request_id = ntohl(ln_msg->gns_header.r_id); |
246 | lnc.nc = nc; | 242 | lnc.nc = nc; |
247 | lnc.status = GNUNET_OK; | 243 | lnc.status = GNUNET_OK; |
248 | if (GNUNET_SYSERR == | 244 | if (GNUNET_SYSERR == |
249 | (ret = GSN_database->lookup_block (GSN_database->cls, | 245 | (ret = GSN_database->lookup_block(GSN_database->cls, |
250 | &ln_msg->query, | 246 | &ln_msg->query, |
251 | &handle_lookup_block_it, | 247 | &handle_lookup_block_it, |
252 | &lnc))) | 248 | &lnc))) |
253 | { | 249 | { |
254 | /* internal error (in database plugin); might be best to just hang up on | 250 | /* internal error (in database plugin); might be best to just hang up on |
255 | plugin rather than to signal that there are 'no' results, which | 251 | plugin rather than to signal that there are 'no' results, which |
256 | might also be false... */ | 252 | might also be false... */ |
257 | GNUNET_break (0); | 253 | GNUNET_break(0); |
258 | GNUNET_SERVICE_client_drop (nc->client); | 254 | GNUNET_SERVICE_client_drop(nc->client); |
259 | return; | 255 | return; |
260 | } | 256 | } |
261 | if ((0 == ret) || (GNUNET_SYSERR == lnc.status)) | 257 | if ((0 == ret) || (GNUNET_SYSERR == lnc.status)) |
262 | { | 258 | { |
263 | /* no records match at all, generate empty response */ | 259 | /* no records match at all, generate empty response */ |
264 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 260 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
265 | "Sending empty NAMECACHE_LOOKUP_BLOCK_RESPONSE message\n"); | 261 | "Sending empty NAMECACHE_LOOKUP_BLOCK_RESPONSE message\n"); |
266 | env = GNUNET_MQ_msg (zir_end, | 262 | env = GNUNET_MQ_msg(zir_end, |
267 | GNUNET_MESSAGE_TYPE_NAMECACHE_LOOKUP_BLOCK_RESPONSE); | 263 | GNUNET_MESSAGE_TYPE_NAMECACHE_LOOKUP_BLOCK_RESPONSE); |
268 | zir_end->gns_header.r_id = ln_msg->gns_header.r_id; | 264 | zir_end->gns_header.r_id = ln_msg->gns_header.r_id; |
269 | GNUNET_MQ_send (nc->mq, | 265 | GNUNET_MQ_send(nc->mq, |
270 | env); | 266 | env); |
271 | } | 267 | } |
272 | GNUNET_SERVICE_client_continue (nc->client); | 268 | GNUNET_SERVICE_client_continue(nc->client); |
273 | } | 269 | } |
274 | 270 | ||
275 | 271 | ||
@@ -281,8 +277,8 @@ handle_lookup_block (void *cls, | |||
281 | * @return #GNUNET_OK (always fine) | 277 | * @return #GNUNET_OK (always fine) |
282 | */ | 278 | */ |
283 | static int | 279 | static int |
284 | check_block_cache (void *cls, | 280 | check_block_cache(void *cls, |
285 | const struct BlockCacheMessage *rp_msg) | 281 | const struct BlockCacheMessage *rp_msg) |
286 | { | 282 | { |
287 | return GNUNET_OK; | 283 | return GNUNET_OK; |
288 | } | 284 | } |
@@ -295,8 +291,8 @@ check_block_cache (void *cls, | |||
295 | * @param rp_msg message to process | 291 | * @param rp_msg message to process |
296 | */ | 292 | */ |
297 | static void | 293 | static void |
298 | handle_block_cache (void *cls, | 294 | handle_block_cache(void *cls, |
299 | const struct BlockCacheMessage *rp_msg) | 295 | const struct BlockCacheMessage *rp_msg) |
300 | { | 296 | { |
301 | struct NamecacheClient *nc = cls; | 297 | struct NamecacheClient *nc = cls; |
302 | struct GNUNET_MQ_Envelope *env; | 298 | struct GNUNET_MQ_Envelope *env; |
@@ -305,34 +301,34 @@ handle_block_cache (void *cls, | |||
305 | size_t esize; | 301 | size_t esize; |
306 | int res; | 302 | int res; |
307 | 303 | ||
308 | GNUNET_STATISTICS_update (statistics, | 304 | GNUNET_STATISTICS_update(statistics, |
309 | "blocks cached", | 305 | "blocks cached", |
310 | 1, | 306 | 1, |
311 | GNUNET_NO); | 307 | GNUNET_NO); |
312 | esize = ntohs (rp_msg->gns_header.header.size) - sizeof (struct BlockCacheMessage); | 308 | esize = ntohs(rp_msg->gns_header.header.size) - sizeof(struct BlockCacheMessage); |
313 | block = GNUNET_malloc (sizeof (struct GNUNET_GNSRECORD_Block) + esize); | 309 | block = GNUNET_malloc(sizeof(struct GNUNET_GNSRECORD_Block) + esize); |
314 | block->signature = rp_msg->signature; | 310 | block->signature = rp_msg->signature; |
315 | block->derived_key = rp_msg->derived_key; | 311 | block->derived_key = rp_msg->derived_key; |
316 | block->purpose.size = htonl (sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + | 312 | block->purpose.size = htonl(sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose) + |
317 | sizeof (struct GNUNET_TIME_AbsoluteNBO) + | 313 | sizeof(struct GNUNET_TIME_AbsoluteNBO) + |
318 | esize); | 314 | esize); |
319 | block->expiration_time = rp_msg->expire; | 315 | block->expiration_time = rp_msg->expire; |
320 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 316 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
321 | "Received NAMECACHE_BLOCK_CACHE message with expiration time %s\n", | 317 | "Received NAMECACHE_BLOCK_CACHE message with expiration time %s\n", |
322 | GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (block->expiration_time))); | 318 | GNUNET_STRINGS_absolute_time_to_string(GNUNET_TIME_absolute_ntoh(block->expiration_time))); |
323 | GNUNET_memcpy (&block[1], | 319 | GNUNET_memcpy(&block[1], |
324 | &rp_msg[1], | 320 | &rp_msg[1], |
325 | esize); | 321 | esize); |
326 | res = GSN_database->cache_block (GSN_database->cls, | 322 | res = GSN_database->cache_block(GSN_database->cls, |
327 | block); | 323 | block); |
328 | GNUNET_free (block); | 324 | GNUNET_free(block); |
329 | env = GNUNET_MQ_msg (rpr_msg, | 325 | env = GNUNET_MQ_msg(rpr_msg, |
330 | GNUNET_MESSAGE_TYPE_NAMECACHE_BLOCK_CACHE_RESPONSE); | 326 | GNUNET_MESSAGE_TYPE_NAMECACHE_BLOCK_CACHE_RESPONSE); |
331 | rpr_msg->gns_header.r_id = rp_msg->gns_header.r_id; | 327 | rpr_msg->gns_header.r_id = rp_msg->gns_header.r_id; |
332 | rpr_msg->op_result = htonl (res); | 328 | rpr_msg->op_result = htonl(res); |
333 | GNUNET_MQ_send (nc->mq, | 329 | GNUNET_MQ_send(nc->mq, |
334 | env); | 330 | env); |
335 | GNUNET_SERVICE_client_continue (nc->client); | 331 | GNUNET_SERVICE_client_continue(nc->client); |
336 | } | 332 | } |
337 | 333 | ||
338 | 334 | ||
@@ -344,46 +340,46 @@ handle_block_cache (void *cls, | |||
344 | * @param service the initialized service | 340 | * @param service the initialized service |
345 | */ | 341 | */ |
346 | static void | 342 | static void |
347 | run (void *cls, | 343 | run(void *cls, |
348 | const struct GNUNET_CONFIGURATION_Handle *cfg, | 344 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
349 | struct GNUNET_SERVICE_Handle *service) | 345 | struct GNUNET_SERVICE_Handle *service) |
350 | { | 346 | { |
351 | char *database; | 347 | char *database; |
352 | 348 | ||
353 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 349 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
354 | "Starting namecache service\n"); | 350 | "Starting namecache service\n"); |
355 | GSN_cfg = cfg; | 351 | GSN_cfg = cfg; |
356 | 352 | ||
357 | /* Loading database plugin */ | 353 | /* Loading database plugin */ |
358 | if (GNUNET_OK != | 354 | if (GNUNET_OK != |
359 | GNUNET_CONFIGURATION_get_value_string (cfg, | 355 | GNUNET_CONFIGURATION_get_value_string(cfg, |
360 | "namecache", | 356 | "namecache", |
361 | "database", | 357 | "database", |
362 | &database)) | 358 | &database)) |
363 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 359 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, |
364 | "No database backend configured\n"); | 360 | "No database backend configured\n"); |
365 | 361 | ||
366 | GNUNET_asprintf (&db_lib_name, | 362 | GNUNET_asprintf(&db_lib_name, |
367 | "libgnunet_plugin_namecache_%s", | 363 | "libgnunet_plugin_namecache_%s", |
368 | database); | 364 | database); |
369 | GSN_database = GNUNET_PLUGIN_load (db_lib_name, | 365 | GSN_database = GNUNET_PLUGIN_load(db_lib_name, |
370 | (void *) GSN_cfg); | 366 | (void *)GSN_cfg); |
371 | GNUNET_free (database); | 367 | GNUNET_free(database); |
372 | if (NULL == GSN_database) | 368 | if (NULL == GSN_database) |
373 | { | 369 | { |
374 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 370 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, |
375 | "Could not load database backend `%s'\n", | 371 | "Could not load database backend `%s'\n", |
376 | db_lib_name); | 372 | db_lib_name); |
377 | GNUNET_SCHEDULER_add_now (&cleanup_task, | 373 | GNUNET_SCHEDULER_add_now(&cleanup_task, |
378 | NULL); | 374 | NULL); |
379 | return; | 375 | return; |
380 | } | 376 | } |
381 | statistics = GNUNET_STATISTICS_create ("namecache", | 377 | statistics = GNUNET_STATISTICS_create("namecache", |
382 | cfg); | 378 | cfg); |
383 | 379 | ||
384 | /* Configuring server handles */ | 380 | /* Configuring server handles */ |
385 | GNUNET_SCHEDULER_add_shutdown (&cleanup_task, | 381 | GNUNET_SCHEDULER_add_shutdown(&cleanup_task, |
386 | NULL); | 382 | NULL); |
387 | } | 383 | } |
388 | 384 | ||
389 | 385 | ||
@@ -391,21 +387,21 @@ run (void *cls, | |||
391 | * Define "main" method using service macro. | 387 | * Define "main" method using service macro. |
392 | */ | 388 | */ |
393 | GNUNET_SERVICE_MAIN | 389 | GNUNET_SERVICE_MAIN |
394 | ("namecache", | 390 | ("namecache", |
395 | GNUNET_SERVICE_OPTION_NONE, | 391 | GNUNET_SERVICE_OPTION_NONE, |
396 | &run, | 392 | &run, |
397 | &client_connect_cb, | 393 | &client_connect_cb, |
398 | &client_disconnect_cb, | 394 | &client_disconnect_cb, |
399 | NULL, | 395 | NULL, |
400 | GNUNET_MQ_hd_fixed_size (lookup_block, | 396 | GNUNET_MQ_hd_fixed_size(lookup_block, |
401 | GNUNET_MESSAGE_TYPE_NAMECACHE_LOOKUP_BLOCK, | 397 | GNUNET_MESSAGE_TYPE_NAMECACHE_LOOKUP_BLOCK, |
402 | struct LookupBlockMessage, | 398 | struct LookupBlockMessage, |
403 | NULL), | 399 | NULL), |
404 | GNUNET_MQ_hd_var_size (block_cache, | 400 | GNUNET_MQ_hd_var_size(block_cache, |
405 | GNUNET_MESSAGE_TYPE_NAMECACHE_BLOCK_CACHE, | 401 | GNUNET_MESSAGE_TYPE_NAMECACHE_BLOCK_CACHE, |
406 | struct BlockCacheMessage, | 402 | struct BlockCacheMessage, |
407 | NULL), | 403 | NULL), |
408 | GNUNET_MQ_handler_end ()); | 404 | GNUNET_MQ_handler_end()); |
409 | 405 | ||
410 | 406 | ||
411 | /* end of gnunet-service-namecache.c */ | 407 | /* end of gnunet-service-namecache.c */ |