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.
*/
*
* @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);
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))
" 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;
}
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;