commit c4bf6c6e248b3e9f97bac1e9faa04bd7d7c126a1
parent a9fbe235a3d94d197d0359a4df546f85b2fd405b
Author: Bart Polot <bart@net.in.tum.de>
Date: Tue, 26 Nov 2013 01:52:30 +0000
- fix #3114: add feedback from _local to _channel on who is requesting the channel destruction, notify the other part
Diffstat:
3 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/src/mesh/gnunet-service-mesh_channel.c b/src/mesh/gnunet-service-mesh_channel.c
@@ -1155,7 +1155,7 @@ GMCH_send_destroy (struct MeshChannel *ch)
msg.chid = htonl (ch->gid);
/* If root is not NULL, notify.
- * If it's NULL, check lid_root. When a local destroy comes in, root
+ * If it's NULL, check lid_root. When a local destroy comes in, root
* is set to NULL but lid_root is left untouched. In this case, do nothing,
* the client is the one who reuqested the channel to be destroyed.
*/
@@ -1438,21 +1438,23 @@ GMCH_handle_local_data (struct MeshChannel *ch,
*
* @param ch Channel.
* @param c Client that requested the destruction (to avoid notifying him).
+ * @param is_root Is the request coming from root?
*/
void
GMCH_handle_local_destroy (struct MeshChannel *ch,
- struct MeshClient *c)
+ struct MeshClient *c,
+ int is_root)
{
struct MeshTunnel3 *t;
/* Cleanup after the tunnel */
- if (c == ch->dest)
+ if (GNUNET_NO == is_root && c == ch->dest)
{
LOG (GNUNET_ERROR_TYPE_DEBUG, " Client %s is destination.\n", GML_2s (c));
GML_client_delete_channel (c, ch, ch->lid_dest);
ch->dest = NULL;
}
- if (c == ch->root)
+ if (GNUNET_YES == is_root && c == ch->root)
{
LOG (GNUNET_ERROR_TYPE_DEBUG, " Client %s is owner.\n", GML_2s (c));
GML_client_delete_channel (c, ch, ch->lid_root);
@@ -1908,7 +1910,7 @@ GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
int retransmission)
{
LOG (GNUNET_ERROR_TYPE_DEBUG, "GMCH Send %s %s on channel %s\n",
- fwd ? "FWD" : "BCK", GNUNET_MESH_DEBUG_M2S (ntohs (message->type)),
+ fwd ? "FWD" : "BCK", GNUNET_MESH_DEBUG_M2S (ntohs (message->type)),
GMCH_2s (ch));
if (GMT_is_loopback (ch->t))
diff --git a/src/mesh/gnunet-service-mesh_channel.h b/src/mesh/gnunet-service-mesh_channel.h
@@ -209,10 +209,12 @@ GMCH_handle_local_data (struct MeshChannel *ch,
*
* @param ch Channel.
* @param c Client that requested the destruction (to avoid notifying him).
+ * @param is_root Is the request coming from root?
*/
void
GMCH_handle_local_destroy (struct MeshChannel *ch,
- struct MeshClient *c);
+ struct MeshClient *c,
+ int is_root);
/**
* Handle a channel create requested by a client.
diff --git a/src/mesh/gnunet-service-mesh_local.c b/src/mesh/gnunet-service-mesh_local.c
@@ -214,7 +214,7 @@ channel_destroy_iterator (void *cls,
" Channel %s destroy, due to client %s shutdown.\n",
GMCH_2s (ch), GML_2s (c));
- GMCH_handle_local_destroy (ch, c);
+ GMCH_handle_local_destroy (ch, c, key < GNUNET_MESH_LOCAL_CHANNEL_ID_SERV);
return GNUNET_OK;
}
@@ -439,7 +439,7 @@ handle_channel_destroy (void *cls, struct GNUNET_SERVER_Client *client,
return;
}
- GMCH_handle_local_destroy (ch, c);
+ GMCH_handle_local_destroy (ch, c, chid < GNUNET_MESH_LOCAL_CHANNEL_ID_SERV);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;