diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-07-18 11:50:11 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-07-18 11:50:11 +0000 |
commit | 987ae64ee29d86619062823509ff3154694593f4 (patch) | |
tree | 0351d40d4a87c7e4ec06bc80829e4ec144ba86e5 /src/fs/gnunet-service-fs_mesh_client.c | |
parent | 009cf9f77acdacf094739cee2a3c5acf5c53d094 (diff) | |
download | gnunet-987ae64ee29d86619062823509ff3154694593f4.tar.gz gnunet-987ae64ee29d86619062823509ff3154694593f4.zip |
-sync for bart
Diffstat (limited to 'src/fs/gnunet-service-fs_mesh_client.c')
-rw-r--r-- | src/fs/gnunet-service-fs_mesh_client.c | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/src/fs/gnunet-service-fs_mesh_client.c b/src/fs/gnunet-service-fs_mesh_client.c index 5acf95ef2..0487be5fe 100644 --- a/src/fs/gnunet-service-fs_mesh_client.c +++ b/src/fs/gnunet-service-fs_mesh_client.c | |||
@@ -155,7 +155,7 @@ struct MeshHandle | |||
155 | /** | 155 | /** |
156 | * Mesh tunnel for creating outbound tunnels. | 156 | * Mesh tunnel for creating outbound tunnels. |
157 | */ | 157 | */ |
158 | static struct GNUNET_MESH_Handle *mesh_tunnel; | 158 | static struct GNUNET_MESH_Handle *mesh_handle; |
159 | 159 | ||
160 | /** | 160 | /** |
161 | * Map from peer identities to 'struct MeshHandles' with mesh | 161 | * Map from peer identities to 'struct MeshHandles' with mesh |
@@ -216,16 +216,16 @@ reset_mesh (struct MeshHandle *mh) | |||
216 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 216 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
217 | "Resetting mesh tunnel to %s\n", | 217 | "Resetting mesh tunnel to %s\n", |
218 | GNUNET_i2s (&mh->target)); | 218 | GNUNET_i2s (&mh->target)); |
219 | GNUNET_MESH_tunnel_destroy (mh->tunnel); | 219 | GNUNET_mesh_handle_destroy (mh->tunnel); |
220 | GNUNET_CONTAINER_multihashmap_iterate (mh->waiting_map, | 220 | GNUNET_CONTAINER_multihashmap_iterate (mh->waiting_map, |
221 | &move_to_pending, | 221 | &move_to_pending, |
222 | mh); | 222 | mh); |
223 | mh->tunnel = GNUNET_MESH_tunnel_create (mesh_tunnel, | 223 | mh->tunnel = GNUNET_mesh_handle_create (mesh_handle, |
224 | mh, | 224 | mh, |
225 | &mh->target, | 225 | &mh->target, |
226 | GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER, | 226 | GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER, |
227 | GNUNET_YES, | 227 | GNUNET_YES, |
228 | GNUNET_YES); | 228 | GNUNET_YES); |
229 | } | 229 | } |
230 | 230 | ||
231 | 231 | ||
@@ -240,7 +240,7 @@ mesh_timeout (void *cls, | |||
240 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 240 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
241 | { | 241 | { |
242 | struct MeshHandle *mh = cls; | 242 | struct MeshHandle *mh = cls; |
243 | struct GNUNET_MESH_Tunnel *tun; | 243 | struct GNUNET_Mesh_Handle *tun; |
244 | 244 | ||
245 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 245 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
246 | "Timeout on mesh tunnel to %s\n", | 246 | "Timeout on mesh tunnel to %s\n", |
@@ -248,7 +248,7 @@ mesh_timeout (void *cls, | |||
248 | mh->timeout_task = GNUNET_SCHEDULER_NO_TASK; | 248 | mh->timeout_task = GNUNET_SCHEDULER_NO_TASK; |
249 | tun = mh->tunnel; | 249 | tun = mh->tunnel; |
250 | mh->tunnel = NULL; | 250 | mh->tunnel = NULL; |
251 | GNUNET_MESH_tunnel_destroy (tun); | 251 | GNUNET_mesh_handle_destroy (tun); |
252 | } | 252 | } |
253 | 253 | ||
254 | 254 | ||
@@ -306,6 +306,9 @@ transmit_sqm (void *cls, | |||
306 | mh->wh = NULL; | 306 | mh->wh = NULL; |
307 | if (NULL == buf) | 307 | if (NULL == buf) |
308 | { | 308 | { |
309 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
310 | "Mesh tunnel to %s failed during transmission attempt, rebuilding\n", | ||
311 | GNUNET_i2s (&mh->target)); | ||
309 | reset_mesh (mh); | 312 | reset_mesh (mh); |
310 | return 0; | 313 | return 0; |
311 | } | 314 | } |
@@ -430,7 +433,7 @@ handle_reply (void *cls, | |||
430 | */ | 433 | */ |
431 | static int | 434 | static int |
432 | reply_cb (void *cls, | 435 | reply_cb (void *cls, |
433 | struct GNUNET_MESH_Tunnel *tunnel, | 436 | struct GNUNET_Mesh_Handle *tunnel, |
434 | void **tunnel_ctx, | 437 | void **tunnel_ctx, |
435 | const struct GNUNET_MessageHeader *message) | 438 | const struct GNUNET_MessageHeader *message) |
436 | { | 439 | { |
@@ -464,6 +467,7 @@ reply_cb (void *cls, | |||
464 | "Received reply `%s' via mesh from peer %s\n", | 467 | "Received reply `%s' via mesh from peer %s\n", |
465 | GNUNET_h2s (&query), | 468 | GNUNET_h2s (&query), |
466 | GNUNET_i2s (&mh->target)); | 469 | GNUNET_i2s (&mh->target)); |
470 | GNUNET_MESH_receive_done (tunnel); | ||
467 | GNUNET_STATISTICS_update (GSF_stats, | 471 | GNUNET_STATISTICS_update (GSF_stats, |
468 | gettext_noop ("# replies received via mesh"), 1, | 472 | gettext_noop ("# replies received via mesh"), 1, |
469 | GNUNET_NO); | 473 | GNUNET_NO); |
@@ -517,12 +521,12 @@ get_mesh (const struct GNUNET_PeerIdentity *target) | |||
517 | mh); | 521 | mh); |
518 | mh->waiting_map = GNUNET_CONTAINER_multihashmap_create (16, GNUNET_YES); | 522 | mh->waiting_map = GNUNET_CONTAINER_multihashmap_create (16, GNUNET_YES); |
519 | mh->target = *target; | 523 | mh->target = *target; |
520 | mh->tunnel = GNUNET_MESH_tunnel_create (mesh_tunnel, | 524 | mh->tunnel = GNUNET_mesh_handle_create (mesh_handle, |
521 | mh, | 525 | mh, |
522 | &mh->target, | 526 | &mh->target, |
523 | GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER, | 527 | GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER, |
524 | GNUNET_NO, | 528 | GNUNET_NO, |
525 | GNUNET_YES); | 529 | GNUNET_YES); |
526 | GNUNET_assert (GNUNET_OK == | 530 | GNUNET_assert (GNUNET_OK == |
527 | GNUNET_CONTAINER_multihashmap_put (mesh_map, | 531 | GNUNET_CONTAINER_multihashmap_put (mesh_map, |
528 | &mh->target.hashPubKey, | 532 | &mh->target.hashPubKey, |
@@ -638,7 +642,7 @@ free_waiting_entry (void *cls, | |||
638 | */ | 642 | */ |
639 | static void | 643 | static void |
640 | cleaner_cb (void *cls, | 644 | cleaner_cb (void *cls, |
641 | const struct GNUNET_MESH_Tunnel *tunnel, | 645 | const struct GNUNET_Mesh_Handle *tunnel, |
642 | void *tunnel_ctx) | 646 | void *tunnel_ctx) |
643 | { | 647 | { |
644 | struct MeshHandle *mh = tunnel_ctx; | 648 | struct MeshHandle *mh = tunnel_ctx; |
@@ -680,18 +684,14 @@ GSF_mesh_start_client () | |||
680 | { &reply_cb, GNUNET_MESSAGE_TYPE_FS_MESH_REPLY, 0 }, | 684 | { &reply_cb, GNUNET_MESSAGE_TYPE_FS_MESH_REPLY, 0 }, |
681 | { NULL, 0, 0 } | 685 | { NULL, 0, 0 } |
682 | }; | 686 | }; |
683 | static const uint32_t ports[] = { | ||
684 | GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER, | ||
685 | 0 | ||
686 | }; | ||
687 | 687 | ||
688 | mesh_map = GNUNET_CONTAINER_multihashmap_create (16, GNUNET_YES); | 688 | mesh_map = GNUNET_CONTAINER_multihashmap_create (16, GNUNET_YES); |
689 | mesh_tunnel = GNUNET_MESH_connect (GSF_cfg, | 689 | mesh_handle = GNUNET_MESH_connect (GSF_cfg, |
690 | NULL, | 690 | NULL, |
691 | NULL, | 691 | NULL, |
692 | &cleaner_cb, | 692 | &cleaner_cb, |
693 | handlers, | 693 | handlers, |
694 | ports); | 694 | NULL); |
695 | } | 695 | } |
696 | 696 | ||
697 | 697 | ||
@@ -709,7 +709,7 @@ release_meshs (void *cls, | |||
709 | void *value) | 709 | void *value) |
710 | { | 710 | { |
711 | struct MeshHandle *mh = value; | 711 | struct MeshHandle *mh = value; |
712 | struct GNUNET_MESH_Tunnel *tun; | 712 | struct GNUNET_Mesh_Handle *tun; |
713 | 713 | ||
714 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 714 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
715 | "Timeout on mesh tunnel to %s\n", | 715 | "Timeout on mesh tunnel to %s\n", |
@@ -717,7 +717,7 @@ release_meshs (void *cls, | |||
717 | tun = mh->tunnel; | 717 | tun = mh->tunnel; |
718 | mh->tunnel = NULL; | 718 | mh->tunnel = NULL; |
719 | if (NULL != tun) | 719 | if (NULL != tun) |
720 | GNUNET_MESH_tunnel_destroy (tun); | 720 | GNUNET_mesh_handle_destroy (tun); |
721 | return GNUNET_YES; | 721 | return GNUNET_YES; |
722 | } | 722 | } |
723 | 723 | ||
@@ -733,10 +733,10 @@ GSF_mesh_stop_client () | |||
733 | NULL); | 733 | NULL); |
734 | GNUNET_CONTAINER_multihashmap_destroy (mesh_map); | 734 | GNUNET_CONTAINER_multihashmap_destroy (mesh_map); |
735 | mesh_map = NULL; | 735 | mesh_map = NULL; |
736 | if (NULL != mesh_tunnel) | 736 | if (NULL != mesh_handle) |
737 | { | 737 | { |
738 | GNUNET_MESH_disconnect (mesh_tunnel); | 738 | GNUNET_MESH_disconnect (mesh_handle); |
739 | mesh_tunnel = NULL; | 739 | mesh_handle = NULL; |
740 | } | 740 | } |
741 | } | 741 | } |
742 | 742 | ||