diff options
author | Bart Polot <bart@net.in.tum.de> | 2012-09-26 09:38:46 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2012-09-26 09:38:46 +0000 |
commit | fc41416a25081b5727d50ebee57a64651c0ef3c3 (patch) | |
tree | 56a8bd565a4d3cd0a59f5a4167da2a8ce99bc12c /src | |
parent | 033331f8cb21f4236afa1954c07d4de8f92a01b1 (diff) | |
download | gnunet-fc41416a25081b5727d50ebee57a64651c0ef3c3.tar.gz gnunet-fc41416a25081b5727d50ebee57a64651c0ef3c3.zip |
- on queue destroy, eliminate the entry in the peer's children info circular buffer
Diffstat (limited to 'src')
-rw-r--r-- | src/mesh/gnunet-service-mesh.c | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c index e6621a6c6..9e60b38d9 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) | |||
4572 | { | 4572 | { |
4573 | struct MeshTransmissionDescriptor *dd; | 4573 | struct MeshTransmissionDescriptor *dd; |
4574 | struct MeshPathInfo *path_info; | 4574 | struct MeshPathInfo *path_info; |
4575 | struct MeshTunnelChildInfo *cinfo; | ||
4576 | struct GNUNET_PeerIdentity id; | ||
4577 | unsigned int i; | ||
4578 | unsigned int max; | ||
4575 | 4579 | ||
4576 | if (GNUNET_YES == clear_cls) | 4580 | if (GNUNET_YES == clear_cls) |
4577 | { | 4581 | { |
@@ -4602,6 +4606,34 @@ queue_destroy (struct MeshPeerQueue *queue, int clear_cls) | |||
4602 | GNUNET_CONTAINER_DLL_remove (queue->peer->queue_head, | 4606 | GNUNET_CONTAINER_DLL_remove (queue->peer->queue_head, |
4603 | queue->peer->queue_tail, | 4607 | queue->peer->queue_tail, |
4604 | queue); | 4608 | queue); |
4609 | |||
4610 | /* Delete from child_fc in the appropiate tunnel */ | ||
4611 | max = queue->tunnel->fwd_queue_max; | ||
4612 | GNUNET_PEER_resolve (queue->peer->id, &id); | ||
4613 | cinfo = tunnel_get_neighbor_fc (queue->tunnel, &id); | ||
4614 | for (i = 0; i < cinfo->send_buffer_n; i++) | ||
4615 | { | ||
4616 | unsigned int i2; | ||
4617 | i2 = (cinfo->send_buffer_start + i) % max; | ||
4618 | if (cinfo->send_buffer[i2] == queue) | ||
4619 | { | ||
4620 | /* Found corresponding entry in the send_buffer. Move all others back. */ | ||
4621 | unsigned int j; | ||
4622 | unsigned int j2; | ||
4623 | unsigned int j3; | ||
4624 | |||
4625 | for (j = i; j < cinfo->send_buffer_n - 1; j++) | ||
4626 | { | ||
4627 | j2 = (cinfo->send_buffer_start + j) % max; | ||
4628 | j3 = (cinfo->send_buffer_start + j + 1) % max; | ||
4629 | cinfo->send_buffer[j2] = cinfo->send_buffer[j3]; | ||
4630 | } | ||
4631 | cinfo->send_buffer[j3] = NULL; | ||
4632 | cinfo->send_buffer_n--; | ||
4633 | } | ||
4634 | } | ||
4635 | //queue-> | ||
4636 | |||
4605 | GNUNET_free (queue); | 4637 | GNUNET_free (queue); |
4606 | } | 4638 | } |
4607 | 4639 | ||
@@ -7734,11 +7766,8 @@ core_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) | |||
7734 | while (NULL != q) | 7766 | while (NULL != q) |
7735 | { | 7767 | { |
7736 | n = q->next; | 7768 | n = q->next; |
7737 | if (q->peer == pi) | 7769 | /* TODO try to reroute this traffic instead */ |
7738 | { | 7770 | queue_destroy(q, GNUNET_YES); |
7739 | /* try to reroute this traffic instead */ | ||
7740 | queue_destroy(q, GNUNET_YES); | ||
7741 | } | ||
7742 | q = n; | 7771 | q = n; |
7743 | } | 7772 | } |
7744 | peer_info_remove_path (pi, pi->id, myid); | 7773 | peer_info_remove_path (pi, pi->id, myid); |