aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbartpolot <bartpolot@140774ce-b5e7-0310-ab8b-a85725594a96>2012-09-26 09:38:46 +0000
committerbartpolot <bartpolot@140774ce-b5e7-0310-ab8b-a85725594a96>2012-09-26 09:38:46 +0000
commit65c3d7c6198264ca1ee80459258f2c922914cbba (patch)
tree56a8bd565a4d3cd0a59f5a4167da2a8ce99bc12c
parentdd7872e9e0113016833de15c8d1943c146ae010d (diff)
- on queue destroy, eliminate the entry in the peer's children info circular buffer
git-svn-id: https://gnunet.org/svn/gnunet@24010 140774ce-b5e7-0310-ab8b-a85725594a96
-rw-r--r--src/mesh/gnunet-service-mesh.c39
1 files changed, 34 insertions, 5 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c
index e6621a6c61..9e60b38d9a 100644
--- a/src/mesh/gnunet-service-mesh.c
+++ b/src/mesh/gnunet-service-mesh.c
@@ -4572,6 +4572,10 @@ queue_destroy (struct MeshPeerQueue *queue, int clear_cls)
{
struct MeshTransmissionDescriptor *dd;
struct MeshPathInfo *path_info;
+ struct MeshTunnelChildInfo *cinfo;
+ struct GNUNET_PeerIdentity id;
+ unsigned int i;
+ unsigned int max;
if (GNUNET_YES == clear_cls)
{
@@ -4602,6 +4606,34 @@ queue_destroy (struct MeshPeerQueue *queue, int clear_cls)
GNUNET_CONTAINER_DLL_remove (queue->peer->queue_head,
queue->peer->queue_tail,
queue);
+
+ /* Delete from child_fc in the appropiate tunnel */
+ max = queue->tunnel->fwd_queue_max;
+ GNUNET_PEER_resolve (queue->peer->id, &id);
+ cinfo = tunnel_get_neighbor_fc (queue->tunnel, &id);
+ for (i = 0; i < cinfo->send_buffer_n; i++)
+ {
+ unsigned int i2;
+ i2 = (cinfo->send_buffer_start + i) % max;
+ if (cinfo->send_buffer[i2] == queue)
+ {
+ /* Found corresponding entry in the send_buffer. Move all others back. */
+ unsigned int j;
+ unsigned int j2;
+ unsigned int j3;
+
+ for (j = i; j < cinfo->send_buffer_n - 1; j++)
+ {
+ j2 = (cinfo->send_buffer_start + j) % max;
+ j3 = (cinfo->send_buffer_start + j + 1) % max;
+ cinfo->send_buffer[j2] = cinfo->send_buffer[j3];
+ }
+ cinfo->send_buffer[j3] = NULL;
+ cinfo->send_buffer_n--;
+ }
+ }
+ //queue->
+
GNUNET_free (queue);
}
@@ -7734,11 +7766,8 @@ core_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer)
while (NULL != q)
{
n = q->next;
- if (q->peer == pi)
- {
- /* try to reroute this traffic instead */
- queue_destroy(q, GNUNET_YES);
- }
+ /* TODO try to reroute this traffic instead */
+ queue_destroy(q, GNUNET_YES);
q = n;
}
peer_info_remove_path (pi, pi->id, myid);