diff options
-rw-r--r-- | src/fs/fs_api.c | 2 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs.c | 10 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_mesh.c | 210 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_mesh.h | 12 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_pr.c | 54 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_pr.h | 4 | ||||
-rw-r--r-- | src/fs/test_gnunet_service_fs_p2p.c | 4 |
7 files changed, 148 insertions, 148 deletions
diff --git a/src/fs/fs_api.c b/src/fs/fs_api.c index f35839d5b..3ccb67105 100644 --- a/src/fs/fs_api.c +++ b/src/fs/fs_api.c | |||
@@ -1751,7 +1751,7 @@ write_download_request (struct GNUNET_BIO_WriteHandle *wh, | |||
1751 | /** | 1751 | /** |
1752 | * Read a download request tree. | 1752 | * Read a download request tree. |
1753 | * | 1753 | * |
1754 | * @param rh stream to read from | 1754 | * @param rh mesh to read from |
1755 | * @return value the 'struct DownloadRequest', NULL on error | 1755 | * @return value the 'struct DownloadRequest', NULL on error |
1756 | */ | 1756 | */ |
1757 | static struct DownloadRequest * | 1757 | static struct DownloadRequest * |
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index 2041103a1..72fa662c1 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c | |||
@@ -412,10 +412,10 @@ start_p2p_processing (void *cls, struct GSF_PendingRequest *pr, | |||
412 | { | 412 | { |
413 | case GNUNET_BLOCK_TYPE_FS_DBLOCK: | 413 | case GNUNET_BLOCK_TYPE_FS_DBLOCK: |
414 | case GNUNET_BLOCK_TYPE_FS_IBLOCK: | 414 | case GNUNET_BLOCK_TYPE_FS_IBLOCK: |
415 | /* the above block types MAY be available via 'stream' */ | 415 | /* the above block types MAY be available via 'mesh' */ |
416 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 416 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
417 | "Considering stream-based download for block\n"); | 417 | "Considering mesh-based download for block\n"); |
418 | GSF_stream_lookup_ (pr); | 418 | GSF_mesh_lookup_ (pr); |
419 | break; | 419 | break; |
420 | case GNUNET_BLOCK_TYPE_FS_UBLOCK: | 420 | case GNUNET_BLOCK_TYPE_FS_UBLOCK: |
421 | /* the above block types are in the DHT */ | 421 | /* the above block types are in the DHT */ |
@@ -475,7 +475,7 @@ handle_start_search (void *cls, struct GNUNET_SERVER_Client *client, | |||
475 | static void | 475 | static void |
476 | shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 476 | shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
477 | { | 477 | { |
478 | GSF_stream_stop (); | 478 | GSF_mesh_stop (); |
479 | if (NULL != GSF_core) | 479 | if (NULL != GSF_core) |
480 | { | 480 | { |
481 | GNUNET_CORE_disconnect (GSF_core); | 481 | GNUNET_CORE_disconnect (GSF_core); |
@@ -646,7 +646,7 @@ main_init (struct GNUNET_SERVER_Handle *server, | |||
646 | GNUNET_SCHEDULER_add_delayed (COVER_AGE_FREQUENCY, &age_cover_counters, | 646 | GNUNET_SCHEDULER_add_delayed (COVER_AGE_FREQUENCY, &age_cover_counters, |
647 | NULL); | 647 | NULL); |
648 | datastore_get_load = GNUNET_LOAD_value_init (DATASTORE_LOAD_AUTODECLINE); | 648 | datastore_get_load = GNUNET_LOAD_value_init (DATASTORE_LOAD_AUTODECLINE); |
649 | GSF_stream_start (); | 649 | GSF_mesh_start (); |
650 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, | 650 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, |
651 | NULL); | 651 | NULL); |
652 | return GNUNET_OK; | 652 | return GNUNET_OK; |
diff --git a/src/fs/gnunet-service-fs_mesh.c b/src/fs/gnunet-service-fs_mesh.c index 80d53ab8c..e25f011ea 100644 --- a/src/fs/gnunet-service-fs_mesh.c +++ b/src/fs/gnunet-service-fs_mesh.c | |||
@@ -24,7 +24,7 @@ | |||
24 | * @author Christian Grothoff | 24 | * @author Christian Grothoff |
25 | * | 25 | * |
26 | * TODO: | 26 | * TODO: |
27 | * - update comments on functions (still matches 'stream') | 27 | * - update comments on functions (still matches 'mesh') |
28 | * - MESH2 API doesn't allow flow control for server yet (needed!) | 28 | * - MESH2 API doesn't allow flow control for server yet (needed!) |
29 | * - likely need to register clean up handler with mesh to handle | 29 | * - likely need to register clean up handler with mesh to handle |
30 | * client disconnect (likely leaky right now) | 30 | * client disconnect (likely leaky right now) |
@@ -60,7 +60,7 @@ | |||
60 | 60 | ||
61 | 61 | ||
62 | /** | 62 | /** |
63 | * A message in the queue to be written to the stream. | 63 | * A message in the queue to be written to the mesh. |
64 | */ | 64 | */ |
65 | struct WriteQueueItem | 65 | struct WriteQueueItem |
66 | { | 66 | { |
@@ -82,7 +82,7 @@ struct WriteQueueItem | |||
82 | 82 | ||
83 | 83 | ||
84 | /** | 84 | /** |
85 | * Information we keep around for each active streaming client. | 85 | * Information we keep around for each active meshing client. |
86 | */ | 86 | */ |
87 | struct StreamClient | 87 | struct StreamClient |
88 | { | 88 | { |
@@ -190,13 +190,13 @@ struct StreamReplyMessage | |||
190 | 190 | ||
191 | 191 | ||
192 | /** | 192 | /** |
193 | * Handle for a stream to another peer. | 193 | * Handle for a mesh to another peer. |
194 | */ | 194 | */ |
195 | struct StreamHandle; | 195 | struct StreamHandle; |
196 | 196 | ||
197 | 197 | ||
198 | /** | 198 | /** |
199 | * Handle for a request that is going out via stream API. | 199 | * Handle for a request that is going out via mesh API. |
200 | */ | 200 | */ |
201 | struct GSF_StreamRequest | 201 | struct GSF_StreamRequest |
202 | { | 202 | { |
@@ -212,7 +212,7 @@ struct GSF_StreamRequest | |||
212 | struct GSF_StreamRequest *prev; | 212 | struct GSF_StreamRequest *prev; |
213 | 213 | ||
214 | /** | 214 | /** |
215 | * Which stream is this request associated with? | 215 | * Which mesh is this request associated with? |
216 | */ | 216 | */ |
217 | struct StreamHandle *sh; | 217 | struct StreamHandle *sh; |
218 | 218 | ||
@@ -245,17 +245,17 @@ struct GSF_StreamRequest | |||
245 | 245 | ||
246 | 246 | ||
247 | /** | 247 | /** |
248 | * Handle for a stream to another peer. | 248 | * Handle for a mesh to another peer. |
249 | */ | 249 | */ |
250 | struct StreamHandle | 250 | struct StreamHandle |
251 | { | 251 | { |
252 | /** | 252 | /** |
253 | * Head of DLL of pending requests on this stream. | 253 | * Head of DLL of pending requests on this mesh. |
254 | */ | 254 | */ |
255 | struct GSF_StreamRequest *pending_head; | 255 | struct GSF_StreamRequest *pending_head; |
256 | 256 | ||
257 | /** | 257 | /** |
258 | * Tail of DLL of pending requests on this stream. | 258 | * Tail of DLL of pending requests on this mesh. |
259 | */ | 259 | */ |
260 | struct GSF_StreamRequest *pending_tail; | 260 | struct GSF_StreamRequest *pending_tail; |
261 | 261 | ||
@@ -268,7 +268,7 @@ struct StreamHandle | |||
268 | /** | 268 | /** |
269 | * Connection to the other peer. | 269 | * Connection to the other peer. |
270 | */ | 270 | */ |
271 | struct GNUNET_MESH_Tunnel *stream; | 271 | struct GNUNET_MESH_Tunnel *mesh; |
272 | 272 | ||
273 | /** | 273 | /** |
274 | * Handle for active write operation, or NULL. | 274 | * Handle for active write operation, or NULL. |
@@ -276,26 +276,26 @@ struct StreamHandle | |||
276 | struct GNUNET_MESH_TransmitHandle *wh; | 276 | struct GNUNET_MESH_TransmitHandle *wh; |
277 | 277 | ||
278 | /** | 278 | /** |
279 | * Which peer does this stream go to? | 279 | * Which peer does this mesh go to? |
280 | */ | 280 | */ |
281 | struct GNUNET_PeerIdentity target; | 281 | struct GNUNET_PeerIdentity target; |
282 | 282 | ||
283 | /** | 283 | /** |
284 | * Task to kill inactive streams (we keep them around for | 284 | * Task to kill inactive meshs (we keep them around for |
285 | * a few seconds to give the application a chance to give | 285 | * a few seconds to give the application a chance to give |
286 | * us another query). | 286 | * us another query). |
287 | */ | 287 | */ |
288 | GNUNET_SCHEDULER_TaskIdentifier timeout_task; | 288 | GNUNET_SCHEDULER_TaskIdentifier timeout_task; |
289 | 289 | ||
290 | /** | 290 | /** |
291 | * Task to reset streams that had errors (asynchronously, | 291 | * Task to reset meshs that had errors (asynchronously, |
292 | * as we may not be able to do it immediately during a | 292 | * as we may not be able to do it immediately during a |
293 | * callback from the stream API). | 293 | * callback from the mesh API). |
294 | */ | 294 | */ |
295 | GNUNET_SCHEDULER_TaskIdentifier reset_task; | 295 | GNUNET_SCHEDULER_TaskIdentifier reset_task; |
296 | 296 | ||
297 | /** | 297 | /** |
298 | * Is this stream ready for transmission? | 298 | * Is this mesh ready for transmission? |
299 | */ | 299 | */ |
300 | int is_ready; | 300 | int is_ready; |
301 | 301 | ||
@@ -308,30 +308,30 @@ struct StreamHandle | |||
308 | static struct GNUNET_MESH_Handle *listen_socket; | 308 | static struct GNUNET_MESH_Handle *listen_socket; |
309 | 309 | ||
310 | /** | 310 | /** |
311 | * Head of DLL of stream clients. | 311 | * Head of DLL of mesh clients. |
312 | */ | 312 | */ |
313 | static struct StreamClient *sc_head; | 313 | static struct StreamClient *sc_head; |
314 | 314 | ||
315 | /** | 315 | /** |
316 | * Tail of DLL of stream clients. | 316 | * Tail of DLL of mesh clients. |
317 | */ | 317 | */ |
318 | static struct StreamClient *sc_tail; | 318 | static struct StreamClient *sc_tail; |
319 | 319 | ||
320 | /** | 320 | /** |
321 | * Number of active stream clients in the 'sc_*'-DLL. | 321 | * Number of active mesh clients in the 'sc_*'-DLL. |
322 | */ | 322 | */ |
323 | static unsigned int sc_count; | 323 | static unsigned int sc_count; |
324 | 324 | ||
325 | /** | 325 | /** |
326 | * Maximum allowed number of stream clients. | 326 | * Maximum allowed number of mesh clients. |
327 | */ | 327 | */ |
328 | static unsigned long long sc_count_max; | 328 | static unsigned long long sc_count_max; |
329 | 329 | ||
330 | /** | 330 | /** |
331 | * Map from peer identities to 'struct StreamHandles' with streams to | 331 | * Map from peer identities to 'struct StreamHandles' with meshs to |
332 | * those peers. | 332 | * those peers. |
333 | */ | 333 | */ |
334 | static struct GNUNET_CONTAINER_MultiHashMap *stream_map; | 334 | static struct GNUNET_CONTAINER_MultiHashMap *mesh_map; |
335 | 335 | ||
336 | 336 | ||
337 | /* ********************* client-side code ************************* */ | 337 | /* ********************* client-side code ************************* */ |
@@ -356,18 +356,18 @@ free_waiting_entry (void *cls, | |||
356 | sr->proc (sr->proc_cls, GNUNET_BLOCK_TYPE_ANY, | 356 | sr->proc (sr->proc_cls, GNUNET_BLOCK_TYPE_ANY, |
357 | GNUNET_TIME_UNIT_FOREVER_ABS, | 357 | GNUNET_TIME_UNIT_FOREVER_ABS, |
358 | 0, NULL); | 358 | 0, NULL); |
359 | GSF_stream_query_cancel (sr); | 359 | GSF_mesh_query_cancel (sr); |
360 | return GNUNET_YES; | 360 | return GNUNET_YES; |
361 | } | 361 | } |
362 | 362 | ||
363 | 363 | ||
364 | /** | 364 | /** |
365 | * Destroy a stream handle. | 365 | * Destroy a mesh handle. |
366 | * | 366 | * |
367 | * @param sh stream to process | 367 | * @param sh mesh to process |
368 | */ | 368 | */ |
369 | static void | 369 | static void |
370 | destroy_stream_handle (struct StreamHandle *sh) | 370 | destroy_mesh_handle (struct StreamHandle *sh) |
371 | { | 371 | { |
372 | struct GSF_StreamRequest *sr; | 372 | struct GSF_StreamRequest *sr; |
373 | 373 | ||
@@ -376,7 +376,7 @@ destroy_stream_handle (struct StreamHandle *sh) | |||
376 | sr->proc (sr->proc_cls, GNUNET_BLOCK_TYPE_ANY, | 376 | sr->proc (sr->proc_cls, GNUNET_BLOCK_TYPE_ANY, |
377 | GNUNET_TIME_UNIT_FOREVER_ABS, | 377 | GNUNET_TIME_UNIT_FOREVER_ABS, |
378 | 0, NULL); | 378 | 0, NULL); |
379 | GSF_stream_query_cancel (sr); | 379 | GSF_mesh_query_cancel (sr); |
380 | } | 380 | } |
381 | GNUNET_CONTAINER_multihashmap_iterate (sh->waiting_map, | 381 | GNUNET_CONTAINER_multihashmap_iterate (sh->waiting_map, |
382 | &free_waiting_entry, | 382 | &free_waiting_entry, |
@@ -387,9 +387,9 @@ destroy_stream_handle (struct StreamHandle *sh) | |||
387 | GNUNET_SCHEDULER_cancel (sh->timeout_task); | 387 | GNUNET_SCHEDULER_cancel (sh->timeout_task); |
388 | if (GNUNET_SCHEDULER_NO_TASK != sh->reset_task) | 388 | if (GNUNET_SCHEDULER_NO_TASK != sh->reset_task) |
389 | GNUNET_SCHEDULER_cancel (sh->reset_task); | 389 | GNUNET_SCHEDULER_cancel (sh->reset_task); |
390 | GNUNET_MESH_tunnel_destroy (sh->stream); | 390 | GNUNET_MESH_tunnel_destroy (sh->mesh); |
391 | GNUNET_assert (GNUNET_OK == | 391 | GNUNET_assert (GNUNET_OK == |
392 | GNUNET_CONTAINER_multihashmap_remove (stream_map, | 392 | GNUNET_CONTAINER_multihashmap_remove (mesh_map, |
393 | &sh->target.hashPubKey, | 393 | &sh->target.hashPubKey, |
394 | sh)); | 394 | sh)); |
395 | GNUNET_CONTAINER_multihashmap_destroy (sh->waiting_map); | 395 | GNUNET_CONTAINER_multihashmap_destroy (sh->waiting_map); |
@@ -398,9 +398,9 @@ destroy_stream_handle (struct StreamHandle *sh) | |||
398 | 398 | ||
399 | 399 | ||
400 | /** | 400 | /** |
401 | * Transmit pending requests via the stream. | 401 | * Transmit pending requests via the mesh. |
402 | * | 402 | * |
403 | * @param sh stream to process | 403 | * @param sh mesh to process |
404 | */ | 404 | */ |
405 | static void | 405 | static void |
406 | transmit_pending (struct StreamHandle *sh); | 406 | transmit_pending (struct StreamHandle *sh); |
@@ -436,22 +436,22 @@ move_to_pending (void *cls, | |||
436 | 436 | ||
437 | 437 | ||
438 | /** | 438 | /** |
439 | * We had a serious error, tear down and re-create stream from scratch. | 439 | * We had a serious error, tear down and re-create mesh from scratch. |
440 | * | 440 | * |
441 | * @param sh stream to reset | 441 | * @param sh mesh to reset |
442 | */ | 442 | */ |
443 | static void | 443 | static void |
444 | reset_stream (struct StreamHandle *sh) | 444 | reset_mesh (struct StreamHandle *sh) |
445 | { | 445 | { |
446 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 446 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
447 | "Resetting stream to %s\n", | 447 | "Resetting mesh to %s\n", |
448 | GNUNET_i2s (&sh->target)); | 448 | GNUNET_i2s (&sh->target)); |
449 | GNUNET_MESH_tunnel_destroy (sh->stream); | 449 | GNUNET_MESH_tunnel_destroy (sh->mesh); |
450 | sh->is_ready = GNUNET_NO; | 450 | sh->is_ready = GNUNET_NO; |
451 | GNUNET_CONTAINER_multihashmap_iterate (sh->waiting_map, | 451 | GNUNET_CONTAINER_multihashmap_iterate (sh->waiting_map, |
452 | &move_to_pending, | 452 | &move_to_pending, |
453 | sh); | 453 | sh); |
454 | sh->stream = GNUNET_MESH_tunnel_create (listen_socket, | 454 | sh->mesh = GNUNET_MESH_tunnel_create (listen_socket, |
455 | sh, | 455 | sh, |
456 | &sh->target, | 456 | &sh->target, |
457 | GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER); | 457 | GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER); |
@@ -459,61 +459,61 @@ reset_stream (struct StreamHandle *sh) | |||
459 | 459 | ||
460 | 460 | ||
461 | /** | 461 | /** |
462 | * Task called when it is time to destroy an inactive stream. | 462 | * Task called when it is time to destroy an inactive mesh. |
463 | * | 463 | * |
464 | * @param cls the 'struct StreamHandle' to tear down | 464 | * @param cls the 'struct StreamHandle' to tear down |
465 | * @param tc scheduler context, unused | 465 | * @param tc scheduler context, unused |
466 | */ | 466 | */ |
467 | static void | 467 | static void |
468 | stream_timeout (void *cls, | 468 | mesh_timeout (void *cls, |
469 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 469 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
470 | { | 470 | { |
471 | struct StreamHandle *sh = cls; | 471 | struct StreamHandle *sh = cls; |
472 | 472 | ||
473 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 473 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
474 | "Timeout on stream to %s\n", | 474 | "Timeout on mesh to %s\n", |
475 | GNUNET_i2s (&sh->target)); | 475 | GNUNET_i2s (&sh->target)); |
476 | sh->timeout_task = GNUNET_SCHEDULER_NO_TASK; | 476 | sh->timeout_task = GNUNET_SCHEDULER_NO_TASK; |
477 | destroy_stream_handle (sh); | 477 | destroy_mesh_handle (sh); |
478 | } | 478 | } |
479 | 479 | ||
480 | 480 | ||
481 | /** | 481 | /** |
482 | * Task called when it is time to reset an stream. | 482 | * Task called when it is time to reset an mesh. |
483 | * | 483 | * |
484 | * @param cls the 'struct StreamHandle' to tear down | 484 | * @param cls the 'struct StreamHandle' to tear down |
485 | * @param tc scheduler context, unused | 485 | * @param tc scheduler context, unused |
486 | */ | 486 | */ |
487 | static void | 487 | static void |
488 | reset_stream_task (void *cls, | 488 | reset_mesh_task (void *cls, |
489 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 489 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
490 | { | 490 | { |
491 | struct StreamHandle *sh = cls; | 491 | struct StreamHandle *sh = cls; |
492 | 492 | ||
493 | sh->reset_task = GNUNET_SCHEDULER_NO_TASK; | 493 | sh->reset_task = GNUNET_SCHEDULER_NO_TASK; |
494 | reset_stream (sh); | 494 | reset_mesh (sh); |
495 | } | 495 | } |
496 | 496 | ||
497 | 497 | ||
498 | /** | 498 | /** |
499 | * We had a serious error, tear down and re-create stream from scratch, | 499 | * We had a serious error, tear down and re-create mesh from scratch, |
500 | * but do so asynchronously. | 500 | * but do so asynchronously. |
501 | * | 501 | * |
502 | * @param sh stream to reset | 502 | * @param sh mesh to reset |
503 | */ | 503 | */ |
504 | static void | 504 | static void |
505 | reset_stream_async (struct StreamHandle *sh) | 505 | reset_mesh_async (struct StreamHandle *sh) |
506 | { | 506 | { |
507 | if (GNUNET_SCHEDULER_NO_TASK != sh->reset_task) | 507 | if (GNUNET_SCHEDULER_NO_TASK != sh->reset_task) |
508 | GNUNET_SCHEDULER_cancel (sh->reset_task); | 508 | GNUNET_SCHEDULER_cancel (sh->reset_task); |
509 | sh->reset_task = GNUNET_SCHEDULER_add_now (&reset_stream_task, | 509 | sh->reset_task = GNUNET_SCHEDULER_add_now (&reset_mesh_task, |
510 | sh); | 510 | sh); |
511 | } | 511 | } |
512 | 512 | ||
513 | 513 | ||
514 | /** | 514 | /** |
515 | * Functions of this signature are called whenever we are ready to transmit | 515 | * Functions of this signature are called whenever we are ready to transmit |
516 | * query via a stream. | 516 | * query via a mesh. |
517 | * | 517 | * |
518 | * @param cls the struct StreamHandle for which we did the write call | 518 | * @param cls the struct StreamHandle for which we did the write call |
519 | * @param size the number of bytes that can be written to 'buf' | 519 | * @param size the number of bytes that can be written to 'buf' |
@@ -532,7 +532,7 @@ transmit_sqm (void *cls, | |||
532 | sh->wh = NULL; | 532 | sh->wh = NULL; |
533 | if (NULL == buf) | 533 | if (NULL == buf) |
534 | { | 534 | { |
535 | reset_stream (sh); | 535 | reset_mesh (sh); |
536 | return 0; | 536 | return 0; |
537 | } | 537 | } |
538 | sr = sh->pending_head; | 538 | sr = sh->pending_head; |
@@ -547,7 +547,7 @@ transmit_sqm (void *cls, | |||
547 | sr, | 547 | sr, |
548 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | 548 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); |
549 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 549 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
550 | "Sending query via stream to %s\n", | 550 | "Sending query via mesh to %s\n", |
551 | GNUNET_i2s (&sh->target)); | 551 | GNUNET_i2s (&sh->target)); |
552 | sr->was_transmitted = GNUNET_YES; | 552 | sr->was_transmitted = GNUNET_YES; |
553 | sqm.header.size = htons (sizeof (sqm)); | 553 | sqm.header.size = htons (sizeof (sqm)); |
@@ -565,16 +565,16 @@ transmit_sqm (void *cls, | |||
565 | 565 | ||
566 | 566 | ||
567 | /** | 567 | /** |
568 | * Transmit pending requests via the stream. | 568 | * Transmit pending requests via the mesh. |
569 | * | 569 | * |
570 | * @param sh stream to process | 570 | * @param sh mesh to process |
571 | */ | 571 | */ |
572 | static void | 572 | static void |
573 | transmit_pending (struct StreamHandle *sh) | 573 | transmit_pending (struct StreamHandle *sh) |
574 | { | 574 | { |
575 | if (NULL != sh->wh) | 575 | if (NULL != sh->wh) |
576 | return; | 576 | return; |
577 | sh->wh = GNUNET_MESH_notify_transmit_ready (sh->stream, GNUNET_YES /* allow cork */, | 577 | sh->wh = GNUNET_MESH_notify_transmit_ready (sh->mesh, GNUNET_YES /* allow cork */, |
578 | GNUNET_TIME_UNIT_FOREVER_REL, | 578 | GNUNET_TIME_UNIT_FOREVER_REL, |
579 | sizeof (struct StreamQueryMessage), | 579 | sizeof (struct StreamQueryMessage), |
580 | &transmit_sqm, sh); | 580 | &transmit_sqm, sh); |
@@ -636,7 +636,7 @@ handle_reply (void *cls, | |||
636 | hrc->expiration, | 636 | hrc->expiration, |
637 | hrc->data_size, | 637 | hrc->data_size, |
638 | hrc->data); | 638 | hrc->data); |
639 | GSF_stream_query_cancel (sr); | 639 | GSF_mesh_query_cancel (sr); |
640 | hrc->found = GNUNET_YES; | 640 | hrc->found = GNUNET_YES; |
641 | return GNUNET_YES; | 641 | return GNUNET_YES; |
642 | } | 642 | } |
@@ -669,7 +669,7 @@ reply_cb (void *cls, | |||
669 | if (sizeof (struct StreamReplyMessage) > msize) | 669 | if (sizeof (struct StreamReplyMessage) > msize) |
670 | { | 670 | { |
671 | GNUNET_break_op (0); | 671 | GNUNET_break_op (0); |
672 | reset_stream_async (sh); | 672 | reset_mesh_async (sh); |
673 | return GNUNET_SYSERR; | 673 | return GNUNET_SYSERR; |
674 | } | 674 | } |
675 | srm = (const struct StreamReplyMessage *) message; | 675 | srm = (const struct StreamReplyMessage *) message; |
@@ -681,14 +681,14 @@ reply_cb (void *cls, | |||
681 | &srm[1], msize, &query)) | 681 | &srm[1], msize, &query)) |
682 | { | 682 | { |
683 | GNUNET_break_op (0); | 683 | GNUNET_break_op (0); |
684 | reset_stream_async (sh); | 684 | reset_mesh_async (sh); |
685 | return GNUNET_SYSERR; | 685 | return GNUNET_SYSERR; |
686 | } | 686 | } |
687 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 687 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
688 | "Received reply `%s' via stream\n", | 688 | "Received reply `%s' via mesh\n", |
689 | GNUNET_h2s (&query)); | 689 | GNUNET_h2s (&query)); |
690 | GNUNET_STATISTICS_update (GSF_stats, | 690 | GNUNET_STATISTICS_update (GSF_stats, |
691 | gettext_noop ("# replies received via stream"), 1, | 691 | gettext_noop ("# replies received via mesh"), 1, |
692 | GNUNET_NO); | 692 | GNUNET_NO); |
693 | hrc.data = &srm[1]; | 693 | hrc.data = &srm[1]; |
694 | hrc.data_size = msize; | 694 | hrc.data_size = msize; |
@@ -702,7 +702,7 @@ reply_cb (void *cls, | |||
702 | if (GNUNET_NO == hrc.found) | 702 | if (GNUNET_NO == hrc.found) |
703 | { | 703 | { |
704 | GNUNET_STATISTICS_update (GSF_stats, | 704 | GNUNET_STATISTICS_update (GSF_stats, |
705 | gettext_noop ("# replies received via stream dropped"), 1, | 705 | gettext_noop ("# replies received via mesh dropped"), 1, |
706 | GNUNET_NO); | 706 | GNUNET_NO); |
707 | return GNUNET_OK; | 707 | return GNUNET_OK; |
708 | } | 708 | } |
@@ -711,16 +711,16 @@ reply_cb (void *cls, | |||
711 | 711 | ||
712 | 712 | ||
713 | /** | 713 | /** |
714 | * Get (or create) a stream to talk to the given peer. | 714 | * Get (or create) a mesh to talk to the given peer. |
715 | * | 715 | * |
716 | * @param target peer we want to communicate with | 716 | * @param target peer we want to communicate with |
717 | */ | 717 | */ |
718 | static struct StreamHandle * | 718 | static struct StreamHandle * |
719 | get_stream (const struct GNUNET_PeerIdentity *target) | 719 | get_mesh (const struct GNUNET_PeerIdentity *target) |
720 | { | 720 | { |
721 | struct StreamHandle *sh; | 721 | struct StreamHandle *sh; |
722 | 722 | ||
723 | sh = GNUNET_CONTAINER_multihashmap_get (stream_map, | 723 | sh = GNUNET_CONTAINER_multihashmap_get (mesh_map, |
724 | &target->hashPubKey); | 724 | &target->hashPubKey); |
725 | if (NULL != sh) | 725 | if (NULL != sh) |
726 | { | 726 | { |
@@ -732,20 +732,20 @@ get_stream (const struct GNUNET_PeerIdentity *target) | |||
732 | return sh; | 732 | return sh; |
733 | } | 733 | } |
734 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 734 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
735 | "Creating stream to %s\n", | 735 | "Creating mesh to %s\n", |
736 | GNUNET_i2s (target)); | 736 | GNUNET_i2s (target)); |
737 | sh = GNUNET_malloc (sizeof (struct StreamHandle)); | 737 | sh = GNUNET_malloc (sizeof (struct StreamHandle)); |
738 | sh->reset_task = GNUNET_SCHEDULER_add_delayed (CLIENT_RETRY_TIMEOUT, | 738 | sh->reset_task = GNUNET_SCHEDULER_add_delayed (CLIENT_RETRY_TIMEOUT, |
739 | &reset_stream_task, | 739 | &reset_mesh_task, |
740 | sh); | 740 | sh); |
741 | sh->waiting_map = GNUNET_CONTAINER_multihashmap_create (512, GNUNET_YES); | 741 | sh->waiting_map = GNUNET_CONTAINER_multihashmap_create (512, GNUNET_YES); |
742 | sh->target = *target; | 742 | sh->target = *target; |
743 | sh->stream = GNUNET_MESH_tunnel_create (listen_socket, | 743 | sh->mesh = GNUNET_MESH_tunnel_create (listen_socket, |
744 | sh, | 744 | sh, |
745 | &sh->target, | 745 | &sh->target, |
746 | GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER); | 746 | GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER); |
747 | GNUNET_assert (GNUNET_OK == | 747 | GNUNET_assert (GNUNET_OK == |
748 | GNUNET_CONTAINER_multihashmap_put (stream_map, | 748 | GNUNET_CONTAINER_multihashmap_put (mesh_map, |
749 | &sh->target.hashPubKey, | 749 | &sh->target.hashPubKey, |
750 | sh, | 750 | sh, |
751 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 751 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); |
@@ -764,7 +764,7 @@ get_stream (const struct GNUNET_PeerIdentity *target) | |||
764 | * @return handle to cancel the operation | 764 | * @return handle to cancel the operation |
765 | */ | 765 | */ |
766 | struct GSF_StreamRequest * | 766 | struct GSF_StreamRequest * |
767 | GSF_stream_query (const struct GNUNET_PeerIdentity *target, | 767 | GSF_mesh_query (const struct GNUNET_PeerIdentity *target, |
768 | const struct GNUNET_HashCode *query, | 768 | const struct GNUNET_HashCode *query, |
769 | enum GNUNET_BLOCK_Type type, | 769 | enum GNUNET_BLOCK_Type type, |
770 | GSF_StreamReplyProcessor proc, void *proc_cls) | 770 | GSF_StreamReplyProcessor proc, void *proc_cls) |
@@ -773,10 +773,10 @@ GSF_stream_query (const struct GNUNET_PeerIdentity *target, | |||
773 | struct GSF_StreamRequest *sr; | 773 | struct GSF_StreamRequest *sr; |
774 | 774 | ||
775 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 775 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
776 | "Preparing to send query for %s via stream to %s\n", | 776 | "Preparing to send query for %s via mesh to %s\n", |
777 | GNUNET_h2s (query), | 777 | GNUNET_h2s (query), |
778 | GNUNET_i2s (target)); | 778 | GNUNET_i2s (target)); |
779 | sh = get_stream (target); | 779 | sh = get_mesh (target); |
780 | sr = GNUNET_malloc (sizeof (struct GSF_StreamRequest)); | 780 | sr = GNUNET_malloc (sizeof (struct GSF_StreamRequest)); |
781 | sr->sh = sh; | 781 | sr->sh = sh; |
782 | sr->proc = proc; | 782 | sr->proc = proc; |
@@ -799,7 +799,7 @@ GSF_stream_query (const struct GNUNET_PeerIdentity *target, | |||
799 | * @param sr request to cancel | 799 | * @param sr request to cancel |
800 | */ | 800 | */ |
801 | void | 801 | void |
802 | GSF_stream_query_cancel (struct GSF_StreamRequest *sr) | 802 | GSF_mesh_query_cancel (struct GSF_StreamRequest *sr) |
803 | { | 803 | { |
804 | struct StreamHandle *sh = sr->sh; | 804 | struct StreamHandle *sh = sr->sh; |
805 | 805 | ||
@@ -816,7 +816,7 @@ GSF_stream_query_cancel (struct GSF_StreamRequest *sr) | |||
816 | if ( (0 == GNUNET_CONTAINER_multihashmap_size (sh->waiting_map)) && | 816 | if ( (0 == GNUNET_CONTAINER_multihashmap_size (sh->waiting_map)) && |
817 | (NULL == sh->pending_head) ) | 817 | (NULL == sh->pending_head) ) |
818 | sh->timeout_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, | 818 | sh->timeout_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, |
819 | &stream_timeout, | 819 | &mesh_timeout, |
820 | sh); | 820 | sh); |
821 | } | 821 | } |
822 | 822 | ||
@@ -830,10 +830,10 @@ GSF_stream_query_cancel (struct GSF_StreamRequest *sr) | |||
830 | * @param sc client to clean up | 830 | * @param sc client to clean up |
831 | */ | 831 | */ |
832 | static void | 832 | static void |
833 | terminate_stream (struct StreamClient *sc) | 833 | terminate_mesh (struct StreamClient *sc) |
834 | { | 834 | { |
835 | GNUNET_STATISTICS_update (GSF_stats, | 835 | GNUNET_STATISTICS_update (GSF_stats, |
836 | gettext_noop ("# stream connections active"), -1, | 836 | gettext_noop ("# mesh connections active"), -1, |
837 | GNUNET_NO); | 837 | GNUNET_NO); |
838 | if (GNUNET_SCHEDULER_NO_TASK != sc->terminate_task) | 838 | if (GNUNET_SCHEDULER_NO_TASK != sc->terminate_task) |
839 | GNUNET_SCHEDULER_cancel (sc->terminate_task); | 839 | GNUNET_SCHEDULER_cancel (sc->terminate_task); |
@@ -861,24 +861,24 @@ terminate_stream (struct StreamClient *sc) | |||
861 | 861 | ||
862 | 862 | ||
863 | /** | 863 | /** |
864 | * Task run to asynchronously terminate the stream due to timeout. | 864 | * Task run to asynchronously terminate the mesh due to timeout. |
865 | * | 865 | * |
866 | * @param cls the 'struct StreamClient' | 866 | * @param cls the 'struct StreamClient' |
867 | * @param tc scheduler context | 867 | * @param tc scheduler context |
868 | */ | 868 | */ |
869 | static void | 869 | static void |
870 | timeout_stream_task (void *cls, | 870 | timeout_mesh_task (void *cls, |
871 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 871 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
872 | { | 872 | { |
873 | struct StreamClient *sc = cls; | 873 | struct StreamClient *sc = cls; |
874 | 874 | ||
875 | sc->timeout_task = GNUNET_SCHEDULER_NO_TASK; | 875 | sc->timeout_task = GNUNET_SCHEDULER_NO_TASK; |
876 | terminate_stream (sc); | 876 | terminate_mesh (sc); |
877 | } | 877 | } |
878 | 878 | ||
879 | 879 | ||
880 | /** | 880 | /** |
881 | * Reset the timeout for the stream client (due to activity). | 881 | * Reset the timeout for the mesh client (due to activity). |
882 | * | 882 | * |
883 | * @param sc client handle to reset timeout for | 883 | * @param sc client handle to reset timeout for |
884 | */ | 884 | */ |
@@ -888,7 +888,7 @@ refresh_timeout_task (struct StreamClient *sc) | |||
888 | if (GNUNET_SCHEDULER_NO_TASK != sc->timeout_task) | 888 | if (GNUNET_SCHEDULER_NO_TASK != sc->timeout_task) |
889 | GNUNET_SCHEDULER_cancel (sc->timeout_task); | 889 | GNUNET_SCHEDULER_cancel (sc->timeout_task); |
890 | sc->timeout_task = GNUNET_SCHEDULER_add_delayed (IDLE_TIMEOUT, | 890 | sc->timeout_task = GNUNET_SCHEDULER_add_delayed (IDLE_TIMEOUT, |
891 | &timeout_stream_task, | 891 | &timeout_mesh_task, |
892 | sc); | 892 | sc); |
893 | } | 893 | } |
894 | 894 | ||
@@ -941,18 +941,18 @@ write_continuation (void *cls, | |||
941 | if (0 == size) | 941 | if (0 == size) |
942 | { | 942 | { |
943 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 943 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
944 | "Transmission of reply failed, terminating stream\n"); | 944 | "Transmission of reply failed, terminating mesh\n"); |
945 | terminate_stream (sc); | 945 | terminate_mesh (sc); |
946 | return 0; | 946 | return 0; |
947 | } | 947 | } |
948 | GNUNET_CONTAINER_DLL_remove (sc->wqi_head, | 948 | GNUNET_CONTAINER_DLL_remove (sc->wqi_head, |
949 | sc->wqi_tail, | 949 | sc->wqi_tail, |
950 | wqi); | 950 | wqi); |
951 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 951 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
952 | "Transmitted %u byte reply via stream\n", | 952 | "Transmitted %u byte reply via mesh\n", |
953 | (unsigned int) size); | 953 | (unsigned int) size); |
954 | GNUNET_STATISTICS_update (GSF_stats, | 954 | GNUNET_STATISTICS_update (GSF_stats, |
955 | gettext_noop ("# Blocks transferred via stream"), 1, | 955 | gettext_noop ("# Blocks transferred via mesh"), 1, |
956 | GNUNET_NO); | 956 | GNUNET_NO); |
957 | memcpy (buf, &wqi[1], ret = wqi->msize); | 957 | memcpy (buf, &wqi[1], ret = wqi->msize); |
958 | GNUNET_free (wqi); | 958 | GNUNET_free (wqi); |
@@ -992,8 +992,8 @@ continue_writing (struct StreamClient *sc) | |||
992 | if (NULL == sc->wh) | 992 | if (NULL == sc->wh) |
993 | { | 993 | { |
994 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 994 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
995 | "Write failed; terminating stream\n"); | 995 | "Write failed; terminating mesh\n"); |
996 | terminate_stream (sc); | 996 | terminate_mesh (sc); |
997 | return; | 997 | return; |
998 | } | 998 | } |
999 | } | 999 | } |
@@ -1054,7 +1054,7 @@ handle_datastore_reply (void *cls, | |||
1054 | return; | 1054 | return; |
1055 | } | 1055 | } |
1056 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1056 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1057 | "Starting transmission of %u byte reply for query `%s' via stream\n", | 1057 | "Starting transmission of %u byte reply for query `%s' via mesh\n", |
1058 | (unsigned int) size, | 1058 | (unsigned int) size, |
1059 | GNUNET_h2s (key)); | 1059 | GNUNET_h2s (key)); |
1060 | wqi = GNUNET_malloc (sizeof (struct WriteQueueItem) + msize); | 1060 | wqi = GNUNET_malloc (sizeof (struct WriteQueueItem) + msize); |
@@ -1096,10 +1096,10 @@ request_cb (void *cls, | |||
1096 | 1096 | ||
1097 | sqm = (const struct StreamQueryMessage *) message; | 1097 | sqm = (const struct StreamQueryMessage *) message; |
1098 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1098 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1099 | "Received query for `%s' via stream\n", | 1099 | "Received query for `%s' via mesh\n", |
1100 | GNUNET_h2s (&sqm->query)); | 1100 | GNUNET_h2s (&sqm->query)); |
1101 | GNUNET_STATISTICS_update (GSF_stats, | 1101 | GNUNET_STATISTICS_update (GSF_stats, |
1102 | gettext_noop ("# queries received via stream"), 1, | 1102 | gettext_noop ("# queries received via mesh"), 1, |
1103 | GNUNET_NO); | 1103 | GNUNET_NO); |
1104 | refresh_timeout_task (sc); | 1104 | refresh_timeout_task (sc); |
1105 | sc->qe = GNUNET_DATASTORE_get_key (GSF_dsh, | 1105 | sc->qe = GNUNET_DATASTORE_get_key (GSF_dsh, |
@@ -1121,13 +1121,13 @@ request_cb (void *cls, | |||
1121 | 1121 | ||
1122 | 1122 | ||
1123 | /** | 1123 | /** |
1124 | * Functions of this type are called upon new stream connection from other peers | 1124 | * Functions of this type are called upon new mesh connection from other peers |
1125 | * or upon binding error which happen when the app_port given in | 1125 | * or upon binding error which happen when the app_port given in |
1126 | * GNUNET_STREAM_listen() is already taken. | 1126 | * GNUNET_STREAM_listen() is already taken. |
1127 | * | 1127 | * |
1128 | * @param cls the closure from GNUNET_STREAM_listen | 1128 | * @param cls the closure from GNUNET_STREAM_listen |
1129 | * @param socket the socket representing the stream | 1129 | * @param socket the socket representing the mesh |
1130 | * @param initiator the identity of the peer who wants to establish a stream | 1130 | * @param initiator the identity of the peer who wants to establish a mesh |
1131 | * with us; NULL on binding error | 1131 | * with us; NULL on binding error |
1132 | * @return initial tunnel context (our 'struct StreamClient') | 1132 | * @return initial tunnel context (our 'struct StreamClient') |
1133 | */ | 1133 | */ |
@@ -1143,16 +1143,16 @@ accept_cb (void *cls, | |||
1143 | if (sc_count >= sc_count_max) | 1143 | if (sc_count >= sc_count_max) |
1144 | { | 1144 | { |
1145 | GNUNET_STATISTICS_update (GSF_stats, | 1145 | GNUNET_STATISTICS_update (GSF_stats, |
1146 | gettext_noop ("# stream client connections rejected"), 1, | 1146 | gettext_noop ("# mesh client connections rejected"), 1, |
1147 | GNUNET_NO); | 1147 | GNUNET_NO); |
1148 | GNUNET_MESH_tunnel_destroy (socket); | 1148 | GNUNET_MESH_tunnel_destroy (socket); |
1149 | return NULL; | 1149 | return NULL; |
1150 | } | 1150 | } |
1151 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1151 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1152 | "Accepting inbound stream connection from `%s'\n", | 1152 | "Accepting inbound mesh connection from `%s'\n", |
1153 | GNUNET_i2s (initiator)); | 1153 | GNUNET_i2s (initiator)); |
1154 | GNUNET_STATISTICS_update (GSF_stats, | 1154 | GNUNET_STATISTICS_update (GSF_stats, |
1155 | gettext_noop ("# stream connections active"), 1, | 1155 | gettext_noop ("# mesh connections active"), 1, |
1156 | GNUNET_NO); | 1156 | GNUNET_NO); |
1157 | sc = GNUNET_malloc (sizeof (struct StreamClient)); | 1157 | sc = GNUNET_malloc (sizeof (struct StreamClient)); |
1158 | sc->socket = socket; | 1158 | sc->socket = socket; |
@@ -1169,7 +1169,7 @@ accept_cb (void *cls, | |||
1169 | * Initialize subsystem for non-anonymous file-sharing. | 1169 | * Initialize subsystem for non-anonymous file-sharing. |
1170 | */ | 1170 | */ |
1171 | void | 1171 | void |
1172 | GSF_stream_start () | 1172 | GSF_mesh_start () |
1173 | { | 1173 | { |
1174 | static const struct GNUNET_MESH_MessageHandler handlers[] = { | 1174 | static const struct GNUNET_MESH_MessageHandler handlers[] = { |
1175 | { &request_cb, GNUNET_MESSAGE_TYPE_FS_STREAM_QUERY, sizeof (struct StreamQueryMessage)}, | 1175 | { &request_cb, GNUNET_MESSAGE_TYPE_FS_STREAM_QUERY, sizeof (struct StreamQueryMessage)}, |
@@ -1181,7 +1181,7 @@ GSF_stream_start () | |||
1181 | 0 | 1181 | 0 |
1182 | }; | 1182 | }; |
1183 | 1183 | ||
1184 | stream_map = GNUNET_CONTAINER_multihashmap_create (16, GNUNET_YES); | 1184 | mesh_map = GNUNET_CONTAINER_multihashmap_create (16, GNUNET_YES); |
1185 | if (GNUNET_YES == | 1185 | if (GNUNET_YES == |
1186 | GNUNET_CONFIGURATION_get_value_number (GSF_cfg, | 1186 | GNUNET_CONFIGURATION_get_value_number (GSF_cfg, |
1187 | "fs", | 1187 | "fs", |
@@ -1199,7 +1199,7 @@ GSF_stream_start () | |||
1199 | 1199 | ||
1200 | 1200 | ||
1201 | /** | 1201 | /** |
1202 | * Function called on each active streams to shut them down. | 1202 | * Function called on each active meshs to shut them down. |
1203 | * | 1203 | * |
1204 | * @param cls NULL | 1204 | * @param cls NULL |
1205 | * @param key target peer, unused | 1205 | * @param key target peer, unused |
@@ -1207,13 +1207,13 @@ GSF_stream_start () | |||
1207 | * @return GNUNET_YES (continue to iterate) | 1207 | * @return GNUNET_YES (continue to iterate) |
1208 | */ | 1208 | */ |
1209 | static int | 1209 | static int |
1210 | release_streams (void *cls, | 1210 | release_meshs (void *cls, |
1211 | const struct GNUNET_HashCode *key, | 1211 | const struct GNUNET_HashCode *key, |
1212 | void *value) | 1212 | void *value) |
1213 | { | 1213 | { |
1214 | struct StreamHandle *sh = value; | 1214 | struct StreamHandle *sh = value; |
1215 | 1215 | ||
1216 | destroy_stream_handle (sh); | 1216 | destroy_mesh_handle (sh); |
1217 | return GNUNET_YES; | 1217 | return GNUNET_YES; |
1218 | } | 1218 | } |
1219 | 1219 | ||
@@ -1222,22 +1222,22 @@ release_streams (void *cls, | |||
1222 | * Shutdown subsystem for non-anonymous file-sharing. | 1222 | * Shutdown subsystem for non-anonymous file-sharing. |
1223 | */ | 1223 | */ |
1224 | void | 1224 | void |
1225 | GSF_stream_stop () | 1225 | GSF_mesh_stop () |
1226 | { | 1226 | { |
1227 | struct StreamClient *sc; | 1227 | struct StreamClient *sc; |
1228 | 1228 | ||
1229 | while (NULL != (sc = sc_head)) | 1229 | while (NULL != (sc = sc_head)) |
1230 | terminate_stream (sc); | 1230 | terminate_mesh (sc); |
1231 | if (NULL != listen_socket) | 1231 | if (NULL != listen_socket) |
1232 | { | 1232 | { |
1233 | GNUNET_MESH_disconnect (listen_socket); | 1233 | GNUNET_MESH_disconnect (listen_socket); |
1234 | listen_socket = NULL; | 1234 | listen_socket = NULL; |
1235 | } | 1235 | } |
1236 | GNUNET_CONTAINER_multihashmap_iterate (stream_map, | 1236 | GNUNET_CONTAINER_multihashmap_iterate (mesh_map, |
1237 | &release_streams, | 1237 | &release_meshs, |
1238 | NULL); | 1238 | NULL); |
1239 | GNUNET_CONTAINER_multihashmap_destroy (stream_map); | 1239 | GNUNET_CONTAINER_multihashmap_destroy (mesh_map); |
1240 | stream_map = NULL; | 1240 | mesh_map = NULL; |
1241 | } | 1241 | } |
1242 | 1242 | ||
1243 | /* end of gnunet-service-fs_stream.c */ | 1243 | /* end of gnunet-service-fs_mesh.c */ |
diff --git a/src/fs/gnunet-service-fs_mesh.h b/src/fs/gnunet-service-fs_mesh.h index 90cb8e5d8..452809889 100644 --- a/src/fs/gnunet-service-fs_mesh.h +++ b/src/fs/gnunet-service-fs_mesh.h | |||
@@ -27,13 +27,13 @@ | |||
27 | #define GNUNET_SERVICE_FS_MESH_H | 27 | #define GNUNET_SERVICE_FS_MESH_H |
28 | 28 | ||
29 | /** | 29 | /** |
30 | * Handle for a request that is going out via stream API. | 30 | * Handle for a request that is going out via mesh API. |
31 | */ | 31 | */ |
32 | struct GSF_StreamRequest; | 32 | struct GSF_StreamRequest; |
33 | 33 | ||
34 | 34 | ||
35 | /** | 35 | /** |
36 | * Function called with a reply from the stream. | 36 | * Function called with a reply from the mesh. |
37 | * | 37 | * |
38 | * @param cls closure | 38 | * @param cls closure |
39 | * @param type type of the block, ANY on error | 39 | * @param type type of the block, ANY on error |
@@ -59,7 +59,7 @@ typedef void (*GSF_StreamReplyProcessor)(void *cls, | |||
59 | * @return handle to cancel the operation | 59 | * @return handle to cancel the operation |
60 | */ | 60 | */ |
61 | struct GSF_StreamRequest * | 61 | struct GSF_StreamRequest * |
62 | GSF_stream_query (const struct GNUNET_PeerIdentity *target, | 62 | GSF_mesh_query (const struct GNUNET_PeerIdentity *target, |
63 | const struct GNUNET_HashCode *query, | 63 | const struct GNUNET_HashCode *query, |
64 | enum GNUNET_BLOCK_Type type, | 64 | enum GNUNET_BLOCK_Type type, |
65 | GSF_StreamReplyProcessor proc, void *proc_cls); | 65 | GSF_StreamReplyProcessor proc, void *proc_cls); |
@@ -72,20 +72,20 @@ GSF_stream_query (const struct GNUNET_PeerIdentity *target, | |||
72 | * @param sr request to cancel | 72 | * @param sr request to cancel |
73 | */ | 73 | */ |
74 | void | 74 | void |
75 | GSF_stream_query_cancel (struct GSF_StreamRequest *sr); | 75 | GSF_mesh_query_cancel (struct GSF_StreamRequest *sr); |
76 | 76 | ||
77 | 77 | ||
78 | /** | 78 | /** |
79 | * Initialize subsystem for non-anonymous file-sharing. | 79 | * Initialize subsystem for non-anonymous file-sharing. |
80 | */ | 80 | */ |
81 | void | 81 | void |
82 | GSF_stream_start (void); | 82 | GSF_mesh_start (void); |
83 | 83 | ||
84 | 84 | ||
85 | /** | 85 | /** |
86 | * Shutdown subsystem for non-anonymous file-sharing. | 86 | * Shutdown subsystem for non-anonymous file-sharing. |
87 | */ | 87 | */ |
88 | void | 88 | void |
89 | GSF_stream_stop (void); | 89 | GSF_mesh_stop (void); |
90 | 90 | ||
91 | #endif | 91 | #endif |
diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c index 8bcc96b05..de7a729b6 100644 --- a/src/fs/gnunet-service-fs_pr.c +++ b/src/fs/gnunet-service-fs_pr.c | |||
@@ -64,7 +64,7 @@ | |||
64 | #define INSANE_STATISTICS GNUNET_NO | 64 | #define INSANE_STATISTICS GNUNET_NO |
65 | 65 | ||
66 | /** | 66 | /** |
67 | * If obtaining a block via stream fails, how often do we retry it before | 67 | * If obtaining a block via mesh fails, how often do we retry it before |
68 | * giving up for good (and sticking to non-anonymous transfer)? | 68 | * giving up for good (and sticking to non-anonymous transfer)? |
69 | */ | 69 | */ |
70 | #define STREAM_RETRY_MAX 3 | 70 | #define STREAM_RETRY_MAX 3 |
@@ -118,7 +118,7 @@ struct GSF_PendingRequest | |||
118 | /** | 118 | /** |
119 | * Stream request handle for this request (or NULL for none). | 119 | * Stream request handle for this request (or NULL for none). |
120 | */ | 120 | */ |
121 | struct GSF_StreamRequest *stream_request; | 121 | struct GSF_StreamRequest *mesh_request; |
122 | 122 | ||
123 | /** | 123 | /** |
124 | * Function to call upon completion of the local get | 124 | * Function to call upon completion of the local get |
@@ -173,10 +173,10 @@ struct GSF_PendingRequest | |||
173 | uint64_t first_uid; | 173 | uint64_t first_uid; |
174 | 174 | ||
175 | /** | 175 | /** |
176 | * How often have we retried this request via 'stream'? | 176 | * How often have we retried this request via 'mesh'? |
177 | * (used to bound overall retries). | 177 | * (used to bound overall retries). |
178 | */ | 178 | */ |
179 | unsigned int stream_retry_count; | 179 | unsigned int mesh_retry_count; |
180 | 180 | ||
181 | /** | 181 | /** |
182 | * Number of valid entries in the 'replies_seen' array. | 182 | * Number of valid entries in the 'replies_seen' array. |
@@ -626,10 +626,10 @@ clean_request (void *cls, const struct GNUNET_HashCode * key, void *value) | |||
626 | GNUNET_DHT_get_stop (pr->gh); | 626 | GNUNET_DHT_get_stop (pr->gh); |
627 | pr->gh = NULL; | 627 | pr->gh = NULL; |
628 | } | 628 | } |
629 | if (NULL != pr->stream_request) | 629 | if (NULL != pr->mesh_request) |
630 | { | 630 | { |
631 | GSF_stream_query_cancel (pr->stream_request); | 631 | GSF_mesh_query_cancel (pr->mesh_request); |
632 | pr->stream_request = NULL; | 632 | pr->mesh_request = NULL; |
633 | } | 633 | } |
634 | if (GNUNET_SCHEDULER_NO_TASK != pr->warn_task) | 634 | if (GNUNET_SCHEDULER_NO_TASK != pr->warn_task) |
635 | { | 635 | { |
@@ -683,10 +683,10 @@ GSF_pending_request_cancel_ (struct GSF_PendingRequest *pr, int full_cleanup) | |||
683 | GNUNET_DHT_get_stop (pr->gh); | 683 | GNUNET_DHT_get_stop (pr->gh); |
684 | pr->gh = NULL; | 684 | pr->gh = NULL; |
685 | } | 685 | } |
686 | if (NULL != pr->stream_request) | 686 | if (NULL != pr->mesh_request) |
687 | { | 687 | { |
688 | GSF_stream_query_cancel (pr->stream_request); | 688 | GSF_mesh_query_cancel (pr->mesh_request); |
689 | pr->stream_request = NULL; | 689 | pr->mesh_request = NULL; |
690 | } | 690 | } |
691 | if (GNUNET_SCHEDULER_NO_TASK != pr->warn_task) | 691 | if (GNUNET_SCHEDULER_NO_TASK != pr->warn_task) |
692 | { | 692 | { |
@@ -1136,7 +1136,7 @@ GSF_dht_lookup_ (struct GSF_PendingRequest *pr) | |||
1136 | 1136 | ||
1137 | 1137 | ||
1138 | /** | 1138 | /** |
1139 | * Function called with a reply from the stream. | 1139 | * Function called with a reply from the mesh. |
1140 | * | 1140 | * |
1141 | * @param cls the pending request struct | 1141 | * @param cls the pending request struct |
1142 | * @param type type of the block, ANY on error | 1142 | * @param type type of the block, ANY on error |
@@ -1145,7 +1145,7 @@ GSF_dht_lookup_ (struct GSF_PendingRequest *pr) | |||
1145 | * @param data reply block data, NULL on error | 1145 | * @param data reply block data, NULL on error |
1146 | */ | 1146 | */ |
1147 | static void | 1147 | static void |
1148 | stream_reply_proc (void *cls, | 1148 | mesh_reply_proc (void *cls, |
1149 | enum GNUNET_BLOCK_Type type, | 1149 | enum GNUNET_BLOCK_Type type, |
1150 | struct GNUNET_TIME_Absolute expiration, | 1150 | struct GNUNET_TIME_Absolute expiration, |
1151 | size_t data_size, | 1151 | size_t data_size, |
@@ -1155,22 +1155,22 @@ stream_reply_proc (void *cls, | |||
1155 | struct ProcessReplyClosure prq; | 1155 | struct ProcessReplyClosure prq; |
1156 | struct GNUNET_HashCode query; | 1156 | struct GNUNET_HashCode query; |
1157 | 1157 | ||
1158 | pr->stream_request = NULL; | 1158 | pr->mesh_request = NULL; |
1159 | if (GNUNET_BLOCK_TYPE_ANY == type) | 1159 | if (GNUNET_BLOCK_TYPE_ANY == type) |
1160 | { | 1160 | { |
1161 | GNUNET_break (NULL == data); | 1161 | GNUNET_break (NULL == data); |
1162 | GNUNET_break (0 == data_size); | 1162 | GNUNET_break (0 == data_size); |
1163 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1163 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1164 | "Error retrieiving block via stream\n"); | 1164 | "Error retrieiving block via mesh\n"); |
1165 | pr->stream_retry_count++; | 1165 | pr->mesh_retry_count++; |
1166 | if (pr->stream_retry_count >= STREAM_RETRY_MAX) | 1166 | if (pr->mesh_retry_count >= STREAM_RETRY_MAX) |
1167 | return; /* give up on stream */ | 1167 | return; /* give up on mesh */ |
1168 | /* retry -- without delay, as this is non-anonymous | 1168 | /* retry -- without delay, as this is non-anonymous |
1169 | and mesh/stream connect will take some time anyway */ | 1169 | and mesh/mesh connect will take some time anyway */ |
1170 | pr->stream_request = GSF_stream_query (pr->public_data.target, | 1170 | pr->mesh_request = GSF_mesh_query (pr->public_data.target, |
1171 | &pr->public_data.query, | 1171 | &pr->public_data.query, |
1172 | pr->public_data.type, | 1172 | pr->public_data.type, |
1173 | &stream_reply_proc, | 1173 | &mesh_reply_proc, |
1174 | pr); | 1174 | pr); |
1175 | return; | 1175 | return; |
1176 | } | 1176 | } |
@@ -1201,27 +1201,27 @@ stream_reply_proc (void *cls, | |||
1201 | 1201 | ||
1202 | 1202 | ||
1203 | /** | 1203 | /** |
1204 | * Consider downloading via stream (if possible) | 1204 | * Consider downloading via mesh (if possible) |
1205 | * | 1205 | * |
1206 | * @param pr the pending request to process | 1206 | * @param pr the pending request to process |
1207 | */ | 1207 | */ |
1208 | void | 1208 | void |
1209 | GSF_stream_lookup_ (struct GSF_PendingRequest *pr) | 1209 | GSF_mesh_lookup_ (struct GSF_PendingRequest *pr) |
1210 | { | 1210 | { |
1211 | if (0 != pr->public_data.anonymity_level) | 1211 | if (0 != pr->public_data.anonymity_level) |
1212 | return; | 1212 | return; |
1213 | if (0 == pr->public_data.target) | 1213 | if (0 == pr->public_data.target) |
1214 | { | 1214 | { |
1215 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1215 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1216 | "Cannot do stream-based download, target peer not known\n"); | 1216 | "Cannot do mesh-based download, target peer not known\n"); |
1217 | return; | 1217 | return; |
1218 | } | 1218 | } |
1219 | if (NULL != pr->stream_request) | 1219 | if (NULL != pr->mesh_request) |
1220 | return; | 1220 | return; |
1221 | pr->stream_request = GSF_stream_query (pr->public_data.target, | 1221 | pr->mesh_request = GSF_mesh_query (pr->public_data.target, |
1222 | &pr->public_data.query, | 1222 | &pr->public_data.query, |
1223 | pr->public_data.type, | 1223 | pr->public_data.type, |
1224 | &stream_reply_proc, | 1224 | &mesh_reply_proc, |
1225 | pr); | 1225 | pr); |
1226 | } | 1226 | } |
1227 | 1227 | ||
@@ -1550,7 +1550,7 @@ GSF_local_lookup_ (struct GSF_PendingRequest *pr, | |||
1550 | GSF_LocalLookupContinuation cont, void *cont_cls) | 1550 | GSF_LocalLookupContinuation cont, void *cont_cls) |
1551 | { | 1551 | { |
1552 | GNUNET_assert (NULL == pr->gh); | 1552 | GNUNET_assert (NULL == pr->gh); |
1553 | GNUNET_assert (NULL == pr->stream_request); | 1553 | GNUNET_assert (NULL == pr->mesh_request); |
1554 | GNUNET_assert (NULL == pr->llc_cont); | 1554 | GNUNET_assert (NULL == pr->llc_cont); |
1555 | pr->llc_cont = cont; | 1555 | pr->llc_cont = cont; |
1556 | pr->llc_cont_cls = cont_cls; | 1556 | pr->llc_cont_cls = cont_cls; |
diff --git a/src/fs/gnunet-service-fs_pr.h b/src/fs/gnunet-service-fs_pr.h index 66488f79c..022e13eb4 100644 --- a/src/fs/gnunet-service-fs_pr.h +++ b/src/fs/gnunet-service-fs_pr.h | |||
@@ -351,12 +351,12 @@ GSF_dht_lookup_ (struct GSF_PendingRequest *pr); | |||
351 | 351 | ||
352 | 352 | ||
353 | /** | 353 | /** |
354 | * Consider downloading via stream (if possible) | 354 | * Consider downloading via mesh (if possible) |
355 | * | 355 | * |
356 | * @param pr the pending request to process | 356 | * @param pr the pending request to process |
357 | */ | 357 | */ |
358 | void | 358 | void |
359 | GSF_stream_lookup_ (struct GSF_PendingRequest *pr); | 359 | GSF_mesh_lookup_ (struct GSF_PendingRequest *pr); |
360 | 360 | ||
361 | 361 | ||
362 | /** | 362 | /** |
diff --git a/src/fs/test_gnunet_service_fs_p2p.c b/src/fs/test_gnunet_service_fs_p2p.c index ddaff544f..e37a322b8 100644 --- a/src/fs/test_gnunet_service_fs_p2p.c +++ b/src/fs/test_gnunet_service_fs_p2p.c | |||
@@ -121,7 +121,7 @@ do_publish (void *cls, | |||
121 | { | 121 | { |
122 | unsigned int i; | 122 | unsigned int i; |
123 | 123 | ||
124 | if (NULL != strstr (progname, "stream")) | 124 | if (NULL != strstr (progname, "mesh")) |
125 | anonymity_level = 0; | 125 | anonymity_level = 0; |
126 | else | 126 | else |
127 | anonymity_level = 1; | 127 | anonymity_level = 1; |
@@ -143,7 +143,7 @@ main (int argc, char *argv[]) | |||
143 | const char *config; | 143 | const char *config; |
144 | 144 | ||
145 | progname = argv[0]; | 145 | progname = argv[0]; |
146 | if (NULL != strstr (progname, "stream")) | 146 | if (NULL != strstr (progname, "mesh")) |
147 | config = "test_gnunet_service_fs_p2p_mesh.conf"; | 147 | config = "test_gnunet_service_fs_p2p_mesh.conf"; |
148 | else | 148 | else |
149 | config = "fs_test_lib_data.conf"; | 149 | config = "fs_test_lib_data.conf"; |