[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r25441 - gnunet/src/mesh
From: |
gnunet |
Subject: |
[GNUnet-SVN] r25441 - gnunet/src/mesh |
Date: |
Thu, 13 Dec 2012 12:43:07 +0100 |
Author: bartpolot
Date: 2012-12-13 12:43:07 +0100 (Thu, 13 Dec 2012)
New Revision: 25441
Modified:
gnunet/src/mesh/gnunet-service-mesh.c
Log:
- signal both-ways tunnel destruction notification
Modified: gnunet/src/mesh/gnunet-service-mesh.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh.c 2012-12-13 11:42:14 UTC (rev
25440)
+++ gnunet/src/mesh/gnunet-service-mesh.c 2012-12-13 11:43:07 UTC (rev
25441)
@@ -4375,17 +4375,30 @@
* valid.
*
* @param t The tunnel whose peers to notify.
+ * @param send_back Do we need to notify our parent node?
*/
static void
-tunnel_send_destroy (struct MeshTunnel *t)
+tunnel_send_destroy (struct MeshTunnel *t, int send_back)
{
struct GNUNET_MESH_TunnelDestroy msg;
+ struct GNUNET_PeerIdentity id;
+ GNUNET_PEER_Id parent;
+ if (tree_count_children(t->tree) > 0)
+ {
+ msg.header.size = htons (sizeof (msg));
+ msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_TUNNEL_DESTROY);
+ GNUNET_PEER_resolve (t->id.oid, &msg.oid);
+ msg.tid = htonl (t->id.tid);
+ tunnel_send_multicast (t, &msg.header);
+ }
+ parent = tree_get_predecessor(t->tree);
+ if (GNUNET_NO == send_back || 0 == parent)
+ return;
+
msg.header.size = htons (sizeof (msg));
msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_TUNNEL_DESTROY);
- GNUNET_PEER_resolve (t->id.oid, &msg.oid);
- msg.tid = htonl (t->id.tid);
- tunnel_send_multicast (t, &msg.header);
+ send_prebuilt_message(&msg.header, &id, t);
}
@@ -4729,7 +4742,7 @@
tunnel_destroy_empty (t);
return GNUNET_OK;
}
- tunnel_send_destroy (t);
+ tunnel_send_destroy (t, GNUNET_YES);
t->owner = NULL;
t->destroy = GNUNET_YES;
@@ -5771,10 +5784,12 @@
struct GNUNET_MESH_TunnelDestroy *msg;
struct MeshTunnel *t;
+ msg = (struct GNUNET_MESH_TunnelDestroy *) message;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Got a TUNNEL DESTROY packet from %s\n", GNUNET_i2s (peer));
- msg = (struct GNUNET_MESH_TunnelDestroy *) message;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " for tunnel %s [%u]\n",
+ "Got a TUNNEL DESTROY packet from %s\n",
+ GNUNET_i2s (peer));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ " for tunnel %s [%u]\n",
GNUNET_i2s (&msg->oid), ntohl (msg->tid));
t = tunnel_get (&msg->oid, ntohl (msg->tid));
if (NULL == t)
@@ -5783,7 +5798,8 @@
* destroyed the tunnel and retransmitted to children.
* Safe to ignore.
*/
- GNUNET_STATISTICS_update (stats, "# control on unknown tunnel", 1,
GNUNET_NO);
+ GNUNET_STATISTICS_update (stats, "# control on unknown tunnel",
+ 1, GNUNET_NO);
return GNUNET_OK;
}
if (t->id.oid == myid)
@@ -5798,7 +5814,7 @@
t->local_tid, t->local_tid_dest);
send_clients_tunnel_destroy (t);
}
- tunnel_send_destroy (t);
+ tunnel_send_destroy (t, GNUNET_YES);
t->destroy = GNUNET_YES;
// TODO: add timeout to destroy the tunnel anyway
return GNUNET_OK;
@@ -7183,7 +7199,7 @@
/* Don't try to ACK the client about the tunnel_destroy multicast packet */
t->owner = NULL;
- tunnel_send_destroy (t);
+ tunnel_send_destroy (t, GNUNET_YES);
t->destroy = GNUNET_YES;
// The tunnel will be destroyed when the last message is transmitted.
GNUNET_SERVER_receive_done (client, GNUNET_OK);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r25441 - gnunet/src/mesh,
gnunet <=