[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r30881 - gnunet/src/mesh
From: |
gnunet |
Subject: |
[GNUnet-SVN] r30881 - gnunet/src/mesh |
Date: |
Tue, 26 Nov 2013 18:53:57 +0100 |
Author: bartpolot
Date: 2013-11-26 18:53:57 +0100 (Tue, 26 Nov 2013)
New Revision: 30881
Modified:
gnunet/src/mesh/gnunet-service-mesh_channel.c
gnunet/src/mesh/gnunet-service-mesh_channel.h
Log:
- dont resend useless channel_destroy messages
Modified: gnunet/src/mesh/gnunet-service-mesh_channel.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_channel.c 2013-11-26 17:53:36 UTC
(rev 30880)
+++ gnunet/src/mesh/gnunet-service-mesh_channel.c 2013-11-26 17:53:57 UTC
(rev 30881)
@@ -504,6 +504,38 @@
/**
+ * Notify a client that the channel is no longer valid.
+ *
+ * @param ch Channel that is destroyed.
+ * @param local_only Should we try to send it to other peers?
+ */
+static void
+send_destroy (struct MeshChannel *ch, int local_only)
+{
+ struct GNUNET_MESH_ChannelManage msg;
+
+ msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY);
+ msg.header.size = htons (sizeof (msg));
+ 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
+ * 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.
+ */
+ if (NULL != ch->root)
+ GML_send_channel_destroy (ch->root, ch->lid_root);
+ else if (0 == ch->lid_root && GNUNET_NO == local_only)
+ GMCH_send_prebuilt_message (&msg.header, ch, GNUNET_NO, GNUNET_NO);
+
+ if (NULL != ch->dest)
+ GML_send_channel_destroy (ch->dest, ch->lid_dest);
+ else if (0 == ch->lid_dest && GNUNET_NO == local_only)
+ GMCH_send_prebuilt_message (&msg.header, ch, GNUNET_YES, GNUNET_NO);
+}
+
+
+/**
* Destroy all reliable messages queued for a channel,
* during a channel destruction.
* Frees the reliability structure itself.
@@ -1140,37 +1172,7 @@
}
-/**
- * Notify a client that the channel is no longer valid.
- *
- * @param ch Channel that is destroyed.
- */
-void
-GMCH_send_destroy (struct MeshChannel *ch)
-{
- struct GNUNET_MESH_ChannelManage msg;
- msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY);
- msg.header.size = htons (sizeof (msg));
- 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
- * 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.
- */
- if (NULL != ch->root)
- GML_send_channel_destroy (ch->root, ch->lid_root);
- else if (0 == ch->lid_root)
- GMCH_send_prebuilt_message (&msg.header, ch, GNUNET_NO, GNUNET_NO);
-
- if (NULL != ch->dest)
- GML_send_channel_destroy (ch->dest, ch->lid_dest);
- else if (0 == ch->lid_dest)
- GMCH_send_prebuilt_message (&msg.header, ch, GNUNET_YES, GNUNET_NO);
-}
-
-
/**
* Send an end-to-end ACK message for the most recent in-sequence payload.
*
@@ -1462,7 +1464,7 @@
}
t = ch->t;
- GMCH_send_destroy (ch);
+ send_destroy (ch, GNUNET_NO);
GMCH_destroy (ch);
GMT_destroy_if_empty (t);
}
@@ -1881,7 +1883,7 @@
}
t = ch->t;
- GMCH_send_destroy (ch);
+ send_destroy (ch, GNUNET_YES);
GMCH_destroy (ch);
GMT_destroy_if_empty (t);
}
Modified: gnunet/src/mesh/gnunet-service-mesh_channel.h
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_channel.h 2013-11-26 17:53:36 UTC
(rev 30880)
+++ gnunet/src/mesh/gnunet-service-mesh_channel.h 2013-11-26 17:53:57 UTC
(rev 30881)
@@ -147,14 +147,6 @@
GMCH_send_create (struct MeshChannel *ch);
/**
- * Notify a client that the channel is no longer valid.
- *
- * @param ch Channel that is destroyed.
- */
-void
-GMCH_send_destroy (struct MeshChannel *ch);
-
-/**
* Allow a client to send us more data, in case it was choked.
*
* @param ch Channel.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r30881 - gnunet/src/mesh,
gnunet <=