aboutsummaryrefslogtreecommitdiff
path: root/src/mesh
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2011-05-19 13:34:47 +0000
committerBart Polot <bart@net.in.tum.de>2011-05-19 13:34:47 +0000
commitb302b2971e868fdfb93bf885366483b511581b5f (patch)
tree0438e5ec941b8f664d221afa075cf5a771b1e69b /src/mesh
parent730f86ac0e726c33a8819f7249b16c46fedc7ce3 (diff)
downloadgnunet-b302b2971e868fdfb93bf885366483b511581b5f.tar.gz
gnunet-b302b2971e868fdfb93bf885366483b511581b5f.zip
WiP
Diffstat (limited to 'src/mesh')
-rw-r--r--src/mesh/gnunet-service-mesh.c40
1 files changed, 36 insertions, 4 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c
index 4865ed7e8..ca2d652e7 100644
--- a/src/mesh/gnunet-service-mesh.c
+++ b/src/mesh/gnunet-service-mesh.c
@@ -490,6 +490,31 @@ send_core_create_path_for_peer (void *cls, size_t size, void *buf)
490 490
491 491
492/** 492/**
493 * Send another peer a notification to destroy a tunnel
494 * @param cls The tunnel to destroy
495 * @param size Size in the buffer
496 * @param buf Memory where to put the data to transmit
497 * @return Size of data put in buffer
498 */
499static size_t
500send_p2p_tunnel_destroy(void *cls, size_t size, void *buf)
501{
502 struct MeshTunnel *t = cls;
503 struct MeshClient *c;
504 struct GNUNET_MESH_TunnelMessage *msg;
505
506 c = t->client;
507 msg = buf;
508 msg->header.type = htons(GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_DESTROY); /*FIXME*/
509 msg->header.size = htons(sizeof(struct GNUNET_MESH_TunnelMessage));
510 msg->tunnel_id = htonl(t->tid);
511
512 destroy_tunnel(c, t);
513 return sizeof(struct GNUNET_MESH_TunnelMessage);
514}
515
516
517/**
493 * Core handler for path creation 518 * Core handler for path creation
494 * struct GNUNET_CORE_MessageHandler 519 * struct GNUNET_CORE_MessageHandler
495 * 520 *
@@ -636,7 +661,7 @@ dht_get_response_handler(void *cls,
636 GNUNET_SERVER_notify_transmit_ready( 661 GNUNET_SERVER_notify_transmit_ready(
637 t->client->handle, 662 t->client->handle,
638 sizeof(struct GNUNET_MESH_PeerControl), 663 sizeof(struct GNUNET_MESH_PeerControl),
639 GNUNET_TIME_relative_get_forever(), 664 GNUNET_TIME_UNIT_FOREVER_REL,
640 &notify_client_connection_failure, 665 &notify_client_connection_failure,
641 peer_info 666 peer_info
642 ); 667 );
@@ -664,7 +689,7 @@ dht_get_response_handler(void *cls,
664 GNUNET_CORE_notify_transmit_ready(core_handle, 689 GNUNET_CORE_notify_transmit_ready(core_handle,
665 0, 690 0,
666 0, 691 0,
667 GNUNET_TIME_relative_get_forever(), 692 GNUNET_TIME_UNIT_FOREVER_REL,
668 get_path[1], 693 get_path[1],
669 sizeof(struct GNUNET_MESH_ManipulatePath) 694 sizeof(struct GNUNET_MESH_ManipulatePath)
670 + (p->length 695 + (p->length
@@ -885,7 +910,14 @@ handle_local_tunnel_destroy (void *cls,
885 GNUNET_CRYPTO_hash(&tid, sizeof(MESH_TunnelID), &hash); 910 GNUNET_CRYPTO_hash(&tid, sizeof(MESH_TunnelID), &hash);
886 t = GNUNET_CONTAINER_multihashmap_get(c->tunnel_ids, &hash); 911 t = GNUNET_CONTAINER_multihashmap_get(c->tunnel_ids, &hash);
887 GNUNET_CONTAINER_multihashmap_remove_all(c->tunnel_ids, &hash); 912 GNUNET_CONTAINER_multihashmap_remove_all(c->tunnel_ids, &hash);
888 destroy_tunnel(c, t); 913 GNUNET_CORE_notify_transmit_ready(core_handle,
914 1,
915 1,
916 GNUNET_TIME_UNIT_FOREVER_REL,
917 NULL,
918 sizeof(struct GNUNET_MESH_TunnelMessage),
919 &send_p2p_tunnel_destroy,
920 t);
889 921
890 GNUNET_SERVER_receive_done(client, GNUNET_OK); 922 GNUNET_SERVER_receive_done(client, GNUNET_OK);
891 return; 923 return;
@@ -961,7 +993,7 @@ handle_local_connect_add (void *cls,
961 sizeof(struct GNUNET_PeerIdentity), 993 sizeof(struct GNUNET_PeerIdentity),
962 &key); 994 &key);
963 peer_info->dhtget = GNUNET_DHT_get_start(dht_handle, 995 peer_info->dhtget = GNUNET_DHT_get_start(dht_handle,
964 GNUNET_TIME_relative_get_forever(), 996 GNUNET_TIME_UNIT_FOREVER_REL,
965 GNUNET_BLOCK_TYPE_ANY, 997 GNUNET_BLOCK_TYPE_ANY,
966 &key, 998 &key,
967 4, /* replication level */ 999 4, /* replication level */