[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r17631 - gnunet/src/mesh
From: |
gnunet |
Subject: |
[GNUnet-SVN] r17631 - gnunet/src/mesh |
Date: |
Thu, 20 Oct 2011 14:49:52 +0200 |
Author: bartpolot
Date: 2011-10-20 14:49:52 +0200 (Thu, 20 Oct 2011)
New Revision: 17631
Modified:
gnunet/src/mesh/gnunet-service-mesh.c
gnunet/src/mesh/mesh_api_new.c
Log:
Fixed bugs in tunnel destruction chain
Modified: gnunet/src/mesh/gnunet-service-mesh.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh.c 2011-10-20 11:38:06 UTC (rev
17630)
+++ gnunet/src/mesh/gnunet-service-mesh.c 2011-10-20 12:49:52 UTC (rev
17631)
@@ -787,6 +787,7 @@
/**
* Notify the client that owns the tunnel that a peer has connected to it
+ * (the requested path to it has been confirmed).
*
* @param t Tunnel whose owner to notify
* @param id Short id of the peer that has connected
@@ -806,6 +807,24 @@
/**
+ * Notify all clients (not depending on registration status) that the incoming
+ * tunnel is no longer valid.
+ *
+ * @param t Tunnel that was destroyed.
+ */
+static void
+send_clients_tunnel_destroy (struct MeshTunnel *t)
+{
+ struct GNUNET_MESH_TunnelMessage msg;
+
+ msg.header.size = htons (sizeof (msg));
+ msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_DESTROY);
+ msg.tunnel_id = htonl (t->local_tid);
+ GNUNET_SERVER_notification_context_broadcast(nc, &msg.header, GNUNET_NO);
+}
+
+
+/**
* Function called to notify a client about the socket
* being ready to queue more data. "buf" will be
* NULL and "size" zero if the socket was closed for
@@ -1777,7 +1796,11 @@
GNUNET_assert (NULL != t->tree->me);
n = t->tree->me->children_head;
if (NULL == n)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "MESH: no children in the tree, no one to send.\n");
return 0;
+ }
copies = GNUNET_malloc (sizeof (unsigned int));
for (*copies = 0; NULL != n; n = n->next)
(*copies)++;
@@ -1836,7 +1859,7 @@
msg.header.size = htons (sizeof (msg));
msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_TUNNEL_DESTROY);
- msg.oid = my_full_id;
+ GNUNET_PEER_resolve (t->id.oid, &msg.oid);
msg.tid = htonl (t->id.tid);
tunnel_send_multicast (t, &msg.header);
}
@@ -2558,6 +2581,10 @@
"MESH: Got a TUNNEL DESTROY packet from %s\n",
GNUNET_i2s (peer));
msg = (struct GNUNET_MESH_TunnelDestroy *) message;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "MESH: for tunnel %s [%u]\n",
+ GNUNET_i2s (&msg->oid),
+ ntohl (msg->tid));
t = tunnel_get (&msg->oid, ntohl (msg->tid));
if (NULL == t)
{
@@ -2565,6 +2592,16 @@
GNUNET_break_op (0);
return GNUNET_OK;
}
+ if (t->id.oid == myid)
+ {
+ GNUNET_break_op (0);
+ return GNUNET_OK;
+ }
+ if (t->local_tid >= GNUNET_MESH_LOCAL_TUNNEL_ID_SERV)
+ {
+ /* Tunnel was incoming, notify clients */
+ send_clients_tunnel_destroy (t);
+ }
tunnel_send_destroy (t);
tunnel_destroy (t);
return GNUNET_OK;
@@ -3376,7 +3413,8 @@
MESH_TunnelNumber tid;
GNUNET_HashCode hash;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: destroying tunnel\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "MESH: Got a DESTROY TUNNEL from client!\n");
/* Sanity check for client registration */
if (NULL == (c = client_get (client)))
Modified: gnunet/src/mesh/mesh_api_new.c
===================================================================
--- gnunet/src/mesh/mesh_api_new.c 2011-10-20 11:38:06 UTC (rev 17630)
+++ gnunet/src/mesh/mesh_api_new.c 2011-10-20 12:49:52 UTC (rev 17631)
@@ -796,7 +796,6 @@
if (NULL == t)
{
- GNUNET_break (0);
return;
}
if (0 == t->owner)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r17631 - gnunet/src/mesh,
gnunet <=