diff options
author | Bart Polot <bart@net.in.tum.de> | 2012-10-30 17:21:54 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2012-10-30 17:21:54 +0000 |
commit | ce0102d7815d30cdfbc099108673ab568b7bec25 (patch) | |
tree | 06bd91d462b76b3e85f39e2a776cc1519f830d7b /src/mesh/gnunet-service-mesh-new.c | |
parent | d4ab5782bc57672748c9d34ab0bb82adc5886891 (diff) | |
download | gnunet-ce0102d7815d30cdfbc099108673ab568b7bec25.tar.gz gnunet-ce0102d7815d30cdfbc099108673ab568b7bec25.zip |
- refactoring, make compile
Diffstat (limited to 'src/mesh/gnunet-service-mesh-new.c')
-rw-r--r-- | src/mesh/gnunet-service-mesh-new.c | 143 |
1 files changed, 72 insertions, 71 deletions
diff --git a/src/mesh/gnunet-service-mesh-new.c b/src/mesh/gnunet-service-mesh-new.c index 3961f22d1..457b3da8b 100644 --- a/src/mesh/gnunet-service-mesh-new.c +++ b/src/mesh/gnunet-service-mesh-new.c | |||
@@ -3541,7 +3541,7 @@ tunnel_send_multicast (struct MeshTunnel *t, | |||
3541 | * | 3541 | * |
3542 | * @param cls Closure (ID of the peer that HAS received the message). | 3542 | * @param cls Closure (ID of the peer that HAS received the message). |
3543 | * @param key ID of the neighbor. | 3543 | * @param key ID of the neighbor. |
3544 | * @param value Information about the neighbor. | 3544 | * @param value FLow control information about the neighbor. |
3545 | * | 3545 | * |
3546 | * @return GNUNET_YES to keep iterating. | 3546 | * @return GNUNET_YES to keep iterating. |
3547 | */ | 3547 | */ |
@@ -4050,11 +4050,11 @@ tunnel_send_clients_bck_ack (struct MeshTunnel *t) | |||
4050 | /* Find client whom to allow to send to origin (with lowest buffer space) */ | 4050 | /* Find client whom to allow to send to origin (with lowest buffer space) */ |
4051 | for (i = 0; i < t->nclients; i++) | 4051 | for (i = 0; i < t->nclients; i++) |
4052 | { | 4052 | { |
4053 | struct MeshTunnelClientInfo *clinfo; | 4053 | struct MeshTunnelFlowControlInfo *fcinfo; |
4054 | unsigned int delta; | 4054 | unsigned int delta; |
4055 | 4055 | ||
4056 | clinfo = &t->clients_fc[i]; | 4056 | fcinfo = &t->clients_fc[i]; |
4057 | delta = clinfo->bck_ack - clinfo->bck_pid; | 4057 | delta = fcinfo->bck_ack - fcinfo->bck_pid; |
4058 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " client %u delta: %u\n", | 4058 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " client %u delta: %u\n", |
4059 | t->clients[i]->id, delta); | 4059 | t->clients[i]->id, delta); |
4060 | 4060 | ||
@@ -4063,13 +4063,13 @@ tunnel_send_clients_bck_ack (struct MeshTunnel *t) | |||
4063 | { | 4063 | { |
4064 | uint32_t ack; | 4064 | uint32_t ack; |
4065 | 4065 | ||
4066 | ack = clinfo->bck_pid; | 4066 | ack = fcinfo->bck_pid; |
4067 | ack += t->nobuffer ? 1 : tunnel_delta; | 4067 | ack += t->nobuffer ? 1 : tunnel_delta; |
4068 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 4068 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
4069 | " sending ack to client %u: %u\n", | 4069 | " sending ack to client %u: %u\n", |
4070 | t->clients[i]->id, ack); | 4070 | t->clients[i]->id, ack); |
4071 | send_local_ack (t, t->clients[i], ack); | 4071 | send_local_ack (t, t->clients[i], ack); |
4072 | clinfo->bck_ack = ack; | 4072 | fcinfo->bck_ack = ack; |
4073 | } | 4073 | } |
4074 | else | 4074 | else |
4075 | { | 4075 | { |
@@ -4707,7 +4707,7 @@ queue_destroy (struct MeshPeerQueue *queue, int clear_cls) | |||
4707 | { | 4707 | { |
4708 | struct MeshTransmissionDescriptor *dd; | 4708 | struct MeshTransmissionDescriptor *dd; |
4709 | struct MeshPathInfo *path_info; | 4709 | struct MeshPathInfo *path_info; |
4710 | struct MeshTunnelChildInfo *cinfo; | 4710 | struct MeshTunnelFlowControlInfo *fcinfo; |
4711 | struct GNUNET_PeerIdentity id; | 4711 | struct GNUNET_PeerIdentity id; |
4712 | unsigned int i; | 4712 | unsigned int i; |
4713 | unsigned int max; | 4713 | unsigned int max; |
@@ -4754,29 +4754,30 @@ queue_destroy (struct MeshPeerQueue *queue, int clear_cls) | |||
4754 | /* Delete from child_fc in the appropiate tunnel */ | 4754 | /* Delete from child_fc in the appropiate tunnel */ |
4755 | max = queue->tunnel->fwd_queue_max; | 4755 | max = queue->tunnel->fwd_queue_max; |
4756 | GNUNET_PEER_resolve (queue->peer->id, &id); | 4756 | GNUNET_PEER_resolve (queue->peer->id, &id); |
4757 | cinfo = tunnel_get_neighbor_fc (queue->tunnel, &id); | 4757 | fcinfo = tunnel_get_neighbor_fc (queue->tunnel, &id); |
4758 | if (NULL != cinfo) | 4758 | if (NULL != fcinfo) |
4759 | { | 4759 | { |
4760 | for (i = 0; i < cinfo->send_buffer_n; i++) | 4760 | GNUNET_assert (NULL != fcinfo->peer); |
4761 | for (i = 0; i < fcinfo->send_buffer_n; i++) | ||
4761 | { | 4762 | { |
4762 | unsigned int i2; | 4763 | unsigned int i2; |
4763 | i2 = (cinfo->send_buffer_start + i) % max; | 4764 | i2 = (fcinfo->send_buffer_start + i) % max; |
4764 | if (cinfo->send_buffer[i2] == queue) | 4765 | if (fcinfo->send_buffer[i2] == queue) |
4765 | { | 4766 | { |
4766 | /* Found corresponding entry in the send_buffer. Move all others back. */ | 4767 | /* Found corresponding entry in the send_buffer. Move all others back. */ |
4767 | unsigned int j; | 4768 | unsigned int j; |
4768 | unsigned int j2; | 4769 | unsigned int j2; |
4769 | unsigned int j3; | 4770 | unsigned int j3; |
4770 | 4771 | ||
4771 | for (j = i, j2 = 0, j3 = 0; j < cinfo->send_buffer_n - 1; j++) | 4772 | for (j = i, j2 = 0, j3 = 0; j < fcinfo->send_buffer_n - 1; j++) |
4772 | { | 4773 | { |
4773 | j2 = (cinfo->send_buffer_start + j) % max; | 4774 | j2 = (fcinfo->send_buffer_start + j) % max; |
4774 | j3 = (cinfo->send_buffer_start + j + 1) % max; | 4775 | j3 = (fcinfo->send_buffer_start + j + 1) % max; |
4775 | cinfo->send_buffer[j2] = cinfo->send_buffer[j3]; | 4776 | fcinfo->send_buffer[j2] = fcinfo->send_buffer[j3]; |
4776 | } | 4777 | } |
4777 | 4778 | ||
4778 | cinfo->send_buffer[j3] = NULL; | 4779 | fcinfo->send_buffer[j3] = NULL; |
4779 | cinfo->send_buffer_n--; | 4780 | fcinfo->send_buffer_n--; |
4780 | } | 4781 | } |
4781 | } | 4782 | } |
4782 | } | 4783 | } |
@@ -4802,7 +4803,7 @@ queue_get_next (const struct MeshPeerInfo *peer) | |||
4802 | struct MeshPeerQueue *q; | 4803 | struct MeshPeerQueue *q; |
4803 | struct MeshTunnel *t; | 4804 | struct MeshTunnel *t; |
4804 | struct MeshTransmissionDescriptor *info; | 4805 | struct MeshTransmissionDescriptor *info; |
4805 | struct MeshTunnelChildInfo *cinfo; | 4806 | struct MeshTunnelFlowControlInfo *fcinfo; |
4806 | struct GNUNET_MESH_Unicast *ucast; | 4807 | struct GNUNET_MESH_Unicast *ucast; |
4807 | struct GNUNET_MESH_ToOrigin *to_orig; | 4808 | struct GNUNET_MESH_ToOrigin *to_orig; |
4808 | struct GNUNET_MESH_Multicast *mcast; | 4809 | struct GNUNET_MESH_Multicast *mcast; |
@@ -4824,8 +4825,8 @@ queue_get_next (const struct MeshPeerInfo *peer) | |||
4824 | ucast = (struct GNUNET_MESH_Unicast *) info->mesh_data->data; | 4825 | ucast = (struct GNUNET_MESH_Unicast *) info->mesh_data->data; |
4825 | pid = ntohl (ucast->pid); | 4826 | pid = ntohl (ucast->pid); |
4826 | GNUNET_PEER_resolve (info->peer->id, &id); | 4827 | GNUNET_PEER_resolve (info->peer->id, &id); |
4827 | cinfo = tunnel_get_neighbor_fc(t, &id); | 4828 | fcinfo = tunnel_get_neighbor_fc (t, &id); |
4828 | ack = cinfo->fwd_ack; | 4829 | ack = fcinfo->fwd_ack; |
4829 | break; | 4830 | break; |
4830 | case GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN: | 4831 | case GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN: |
4831 | to_orig = (struct GNUNET_MESH_ToOrigin *) info->mesh_data->data; | 4832 | to_orig = (struct GNUNET_MESH_ToOrigin *) info->mesh_data->data; |
@@ -4841,8 +4842,8 @@ queue_get_next (const struct MeshPeerInfo *peer) | |||
4841 | } | 4842 | } |
4842 | pid = ntohl (mcast->pid); | 4843 | pid = ntohl (mcast->pid); |
4843 | GNUNET_PEER_resolve (info->peer->id, &id); | 4844 | GNUNET_PEER_resolve (info->peer->id, &id); |
4844 | cinfo = tunnel_get_neighbor_fc(t, &id); | 4845 | fcinfo = tunnel_get_neighbor_fc (t, &id); |
4845 | ack = cinfo->fwd_ack; | 4846 | ack = fcinfo->fwd_ack; |
4846 | break; | 4847 | break; |
4847 | default: | 4848 | default: |
4848 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 4849 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -4886,12 +4887,12 @@ queue_send (void *cls, size_t size, void *buf) | |||
4886 | struct GNUNET_MessageHeader *msg; | 4887 | struct GNUNET_MessageHeader *msg; |
4887 | struct MeshPeerQueue *queue; | 4888 | struct MeshPeerQueue *queue; |
4888 | struct MeshTunnel *t; | 4889 | struct MeshTunnel *t; |
4889 | struct MeshTunnelChildInfo *cinfo; | 4890 | struct MeshTunnelFlowControlInfo *fcinfo; |
4890 | struct GNUNET_PeerIdentity dst_id; | 4891 | struct GNUNET_PeerIdentity dst_id; |
4891 | size_t data_size; | 4892 | size_t data_size; |
4892 | 4893 | ||
4893 | peer->core_transmit = NULL; | 4894 | peer->core_transmit = NULL; |
4894 | cinfo = NULL; | 4895 | fcinfo = NULL; |
4895 | 4896 | ||
4896 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "********* Queue send\n"); | 4897 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "********* Queue send\n"); |
4897 | queue = queue_get_next (peer); | 4898 | queue = queue_get_next (peer); |
@@ -5013,22 +5014,22 @@ queue_send (void *cls, size_t size, void *buf) | |||
5013 | case GNUNET_MESSAGE_TYPE_MESH_UNICAST: | 5014 | case GNUNET_MESSAGE_TYPE_MESH_UNICAST: |
5014 | case GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN: | 5015 | case GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN: |
5015 | case GNUNET_MESSAGE_TYPE_MESH_MULTICAST: | 5016 | case GNUNET_MESSAGE_TYPE_MESH_MULTICAST: |
5016 | cinfo = tunnel_get_neighbor_fc (t, &dst_id); | 5017 | fcinfo = tunnel_get_neighbor_fc (t, &dst_id); |
5017 | if (cinfo->send_buffer[cinfo->send_buffer_start] != queue) | 5018 | if (fcinfo->send_buffer[fcinfo->send_buffer_start] != queue) |
5018 | { | 5019 | { |
5019 | GNUNET_break (0); | 5020 | GNUNET_break (0); |
5020 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 5021 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
5021 | "at pos %u (%p) != %p\n", | 5022 | "at pos %u (%p) != %p\n", |
5022 | cinfo->send_buffer_start, | 5023 | fcinfo->send_buffer_start, |
5023 | cinfo->send_buffer[cinfo->send_buffer_start], | 5024 | fcinfo->send_buffer[fcinfo->send_buffer_start], |
5024 | queue); | 5025 | queue); |
5025 | } | 5026 | } |
5026 | if (cinfo->send_buffer_n > 0) | 5027 | if (fcinfo->send_buffer_n > 0) |
5027 | { | 5028 | { |
5028 | cinfo->send_buffer[cinfo->send_buffer_start] = NULL; | 5029 | fcinfo->send_buffer[fcinfo->send_buffer_start] = NULL; |
5029 | cinfo->send_buffer_n--; | 5030 | fcinfo->send_buffer_n--; |
5030 | cinfo->send_buffer_start++; | 5031 | fcinfo->send_buffer_start++; |
5031 | cinfo->send_buffer_start %= t->fwd_queue_max; | 5032 | fcinfo->send_buffer_start %= t->fwd_queue_max; |
5032 | } | 5033 | } |
5033 | else | 5034 | else |
5034 | { | 5035 | { |
@@ -5074,10 +5075,10 @@ queue_send (void *cls, size_t size, void *buf) | |||
5074 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 5075 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
5075 | "********* %s stalled\n", | 5076 | "********* %s stalled\n", |
5076 | GNUNET_i2s(&my_full_id)); | 5077 | GNUNET_i2s(&my_full_id)); |
5077 | if (NULL == cinfo) | 5078 | if (NULL == fcinfo) |
5078 | cinfo = tunnel_get_neighbor_fc (t, &dst_id); | 5079 | fcinfo = tunnel_get_neighbor_fc (t, &dst_id); |
5079 | cinfo->fc_poll = GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_UNIT_SECONDS, | 5080 | fcinfo->fc_poll = GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_UNIT_SECONDS, |
5080 | &tunnel_poll, cinfo); | 5081 | &tunnel_poll, fcinfo); |
5081 | } | 5082 | } |
5082 | } | 5083 | } |
5083 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "********* return %d\n", data_size); | 5084 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "********* return %d\n", data_size); |
@@ -5107,7 +5108,7 @@ queue_add (void *cls, uint16_t type, size_t size, | |||
5107 | struct MeshPeerInfo *dst, struct MeshTunnel *t) | 5108 | struct MeshPeerInfo *dst, struct MeshTunnel *t) |
5108 | { | 5109 | { |
5109 | struct MeshPeerQueue *queue; | 5110 | struct MeshPeerQueue *queue; |
5110 | struct MeshTunnelChildInfo *cinfo; | 5111 | struct MeshTunnelFlowControlInfo *fcinfo; |
5111 | struct GNUNET_PeerIdentity id; | 5112 | struct GNUNET_PeerIdentity id; |
5112 | unsigned int *max; | 5113 | unsigned int *max; |
5113 | unsigned int *n; | 5114 | unsigned int *n; |
@@ -5167,24 +5168,24 @@ queue_add (void *cls, uint16_t type, size_t size, | |||
5167 | return; | 5168 | return; |
5168 | 5169 | ||
5169 | // It's payload, keep track of buffer per peer. | 5170 | // It's payload, keep track of buffer per peer. |
5170 | cinfo = tunnel_get_neighbor_fc(t, &id); | 5171 | fcinfo = tunnel_get_neighbor_fc (t, &id); |
5171 | i = (cinfo->send_buffer_start + cinfo->send_buffer_n) % t->fwd_queue_max; | 5172 | i = (fcinfo->send_buffer_start + fcinfo->send_buffer_n) % t->fwd_queue_max; |
5172 | if (NULL != cinfo->send_buffer[i]) | 5173 | if (NULL != fcinfo->send_buffer[i]) |
5173 | { | 5174 | { |
5174 | GNUNET_break (cinfo->send_buffer_n == t->fwd_queue_max); // aka i == start | 5175 | GNUNET_break (fcinfo->send_buffer_n == t->fwd_queue_max); // aka i == start |
5175 | queue_destroy (cinfo->send_buffer[cinfo->send_buffer_start], GNUNET_YES); | 5176 | queue_destroy (fcinfo->send_buffer[fcinfo->send_buffer_start], GNUNET_YES); |
5176 | cinfo->send_buffer_start++; | 5177 | fcinfo->send_buffer_start++; |
5177 | cinfo->send_buffer_start %= t->fwd_queue_max; | 5178 | fcinfo->send_buffer_start %= t->fwd_queue_max; |
5178 | } | 5179 | } |
5179 | else | 5180 | else |
5180 | { | 5181 | { |
5181 | cinfo->send_buffer_n++; | 5182 | fcinfo->send_buffer_n++; |
5182 | } | 5183 | } |
5183 | cinfo->send_buffer[i] = queue; | 5184 | fcinfo->send_buffer[i] = queue; |
5184 | if (cinfo->send_buffer_n > t->fwd_queue_max) | 5185 | if (fcinfo->send_buffer_n > t->fwd_queue_max) |
5185 | { | 5186 | { |
5186 | GNUNET_break (0); | 5187 | GNUNET_break (0); |
5187 | cinfo->send_buffer_n = t->fwd_queue_max; | 5188 | fcinfo->send_buffer_n = t->fwd_queue_max; |
5188 | } | 5189 | } |
5189 | } | 5190 | } |
5190 | 5191 | ||
@@ -5579,7 +5580,7 @@ handle_mesh_data_unicast (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
5579 | { | 5580 | { |
5580 | struct GNUNET_MESH_Unicast *msg; | 5581 | struct GNUNET_MESH_Unicast *msg; |
5581 | struct GNUNET_PeerIdentity *neighbor; | 5582 | struct GNUNET_PeerIdentity *neighbor; |
5582 | struct MeshTunnelChildInfo *cinfo; | 5583 | struct MeshTunnelFlowControlInfo *fcinfo; |
5583 | struct MeshTunnel *t; | 5584 | struct MeshTunnel *t; |
5584 | GNUNET_PEER_Id dest_id; | 5585 | GNUNET_PEER_Id dest_id; |
5585 | uint32_t pid; | 5586 | uint32_t pid; |
@@ -5660,16 +5661,16 @@ handle_mesh_data_unicast (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
5660 | " not for us, retransmitting...\n"); | 5661 | " not for us, retransmitting...\n"); |
5661 | 5662 | ||
5662 | neighbor = tree_get_first_hop (t->tree, dest_id); | 5663 | neighbor = tree_get_first_hop (t->tree, dest_id); |
5663 | cinfo = tunnel_get_neighbor_fc (t, neighbor); | 5664 | fcinfo = tunnel_get_neighbor_fc (t, neighbor); |
5664 | cinfo->fwd_pid = pid; | 5665 | fcinfo->fwd_pid = pid; |
5665 | GNUNET_CONTAINER_multihashmap_iterate (t->children_fc, | 5666 | GNUNET_CONTAINER_multihashmap_iterate (t->children_fc, |
5666 | &tunnel_add_skip, | 5667 | &tunnel_add_skip, |
5667 | &neighbor); | 5668 | &neighbor); |
5668 | if (GNUNET_YES == t->nobuffer && | 5669 | if (GNUNET_YES == t->nobuffer && |
5669 | GNUNET_YES == GMC_is_pid_bigger (pid, cinfo->fwd_ack)) | 5670 | GNUNET_YES == GMC_is_pid_bigger (pid, fcinfo->fwd_ack)) |
5670 | { | 5671 | { |
5671 | GNUNET_STATISTICS_update (stats, "# unsolicited unicast", 1, GNUNET_NO); | 5672 | GNUNET_STATISTICS_update (stats, "# unsolicited unicast", 1, GNUNET_NO); |
5672 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, " %u > %u\n", pid, cinfo->fwd_ack); | 5673 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, " %u > %u\n", pid, fcinfo->fwd_ack); |
5673 | GNUNET_break_op (0); | 5674 | GNUNET_break_op (0); |
5674 | return GNUNET_OK; | 5675 | return GNUNET_OK; |
5675 | } | 5676 | } |
@@ -5785,7 +5786,7 @@ handle_mesh_data_to_orig (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
5785 | struct GNUNET_PeerIdentity id; | 5786 | struct GNUNET_PeerIdentity id; |
5786 | struct MeshPeerInfo *peer_info; | 5787 | struct MeshPeerInfo *peer_info; |
5787 | struct MeshTunnel *t; | 5788 | struct MeshTunnel *t; |
5788 | struct MeshTunnelChildInfo *cinfo; | 5789 | struct MeshTunnelFlowControlInfo *fcinfo; |
5789 | size_t size; | 5790 | size_t size; |
5790 | uint32_t pid; | 5791 | uint32_t pid; |
5791 | 5792 | ||
@@ -5815,14 +5816,14 @@ handle_mesh_data_to_orig (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
5815 | return GNUNET_OK; | 5816 | return GNUNET_OK; |
5816 | } | 5817 | } |
5817 | 5818 | ||
5818 | cinfo = tunnel_get_neighbor_fc(t, peer); | 5819 | fcinfo = tunnel_get_neighbor_fc (t, peer); |
5819 | if (NULL == cinfo) | 5820 | if (NULL == fcinfo) |
5820 | { | 5821 | { |
5821 | GNUNET_break (0); | 5822 | GNUNET_break (0); |
5822 | return GNUNET_OK; | 5823 | return GNUNET_OK; |
5823 | } | 5824 | } |
5824 | 5825 | ||
5825 | if (cinfo->bck_pid == pid) | 5826 | if (fcinfo->bck_pid == pid) |
5826 | { | 5827 | { |
5827 | /* already seen this packet, drop */ | 5828 | /* already seen this packet, drop */ |
5828 | GNUNET_STATISTICS_update (stats, "# duplicate PID drops BCK", 1, GNUNET_NO); | 5829 | GNUNET_STATISTICS_update (stats, "# duplicate PID drops BCK", 1, GNUNET_NO); |
@@ -5834,7 +5835,7 @@ handle_mesh_data_to_orig (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
5834 | 5835 | ||
5835 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 5836 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
5836 | " pid %u not seen yet, forwarding\n", pid); | 5837 | " pid %u not seen yet, forwarding\n", pid); |
5837 | cinfo->bck_pid = pid; | 5838 | fcinfo->bck_pid = pid; |
5838 | 5839 | ||
5839 | if (NULL != t->owner) | 5840 | if (NULL != t->owner) |
5840 | { | 5841 | { |
@@ -5914,12 +5915,12 @@ handle_mesh_ack (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
5914 | /* Is this a forward or backward ACK? */ | 5915 | /* Is this a forward or backward ACK? */ |
5915 | if (tree_get_predecessor(t->tree) != GNUNET_PEER_search(peer)) | 5916 | if (tree_get_predecessor(t->tree) != GNUNET_PEER_search(peer)) |
5916 | { | 5917 | { |
5917 | struct MeshTunnelChildInfo *cinfo; | 5918 | struct MeshTunnelFlowControlInfo *fcinfo; |
5918 | 5919 | ||
5919 | debug_bck_ack++; | 5920 | debug_bck_ack++; |
5920 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " FWD ACK\n"); | 5921 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " FWD ACK\n"); |
5921 | cinfo = tunnel_get_neighbor_fc (t, peer); | 5922 | fcinfo = tunnel_get_neighbor_fc (t, peer); |
5922 | cinfo->fwd_ack = ack; | 5923 | fcinfo->fwd_ack = ack; |
5923 | tunnel_send_fwd_ack (t, GNUNET_MESSAGE_TYPE_MESH_ACK); | 5924 | tunnel_send_fwd_ack (t, GNUNET_MESSAGE_TYPE_MESH_ACK); |
5924 | tunnel_unlock_fwd_queues (t); | 5925 | tunnel_unlock_fwd_queues (t); |
5925 | } | 5926 | } |
@@ -5973,11 +5974,11 @@ handle_mesh_poll (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
5973 | /* Is this a forward or backward ACK? */ | 5974 | /* Is this a forward or backward ACK? */ |
5974 | if (tree_get_predecessor(t->tree) != GNUNET_PEER_search(peer)) | 5975 | if (tree_get_predecessor(t->tree) != GNUNET_PEER_search(peer)) |
5975 | { | 5976 | { |
5976 | struct MeshTunnelChildInfo *cinfo; | 5977 | struct MeshTunnelFlowControlInfo *fcinfo; |
5977 | 5978 | ||
5978 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " from FWD\n"); | 5979 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " from FWD\n"); |
5979 | cinfo = tunnel_get_neighbor_fc (t, peer); | 5980 | fcinfo = tunnel_get_neighbor_fc (t, peer); |
5980 | cinfo->bck_ack = cinfo->fwd_pid; // mark as ready to send | 5981 | fcinfo->bck_ack = fcinfo->fwd_pid; // mark as ready to send |
5981 | tunnel_send_bck_ack (t, GNUNET_MESSAGE_TYPE_MESH_POLL); | 5982 | tunnel_send_bck_ack (t, GNUNET_MESSAGE_TYPE_MESH_POLL); |
5982 | } | 5983 | } |
5983 | else | 5984 | else |
@@ -7624,7 +7625,7 @@ handle_local_to_origin (void *cls, struct GNUNET_SERVER_Client *client, | |||
7624 | const struct GNUNET_MessageHeader *message) | 7625 | const struct GNUNET_MessageHeader *message) |
7625 | { | 7626 | { |
7626 | struct GNUNET_MESH_ToOrigin *data_msg; | 7627 | struct GNUNET_MESH_ToOrigin *data_msg; |
7627 | struct MeshTunnelClientInfo *clinfo; | 7628 | struct MeshTunnelFlowControlInfo *fcinfo; |
7628 | struct MeshClient *c; | 7629 | struct MeshClient *c; |
7629 | struct MeshTunnel *t; | 7630 | struct MeshTunnel *t; |
7630 | MESH_TunnelNumber tid; | 7631 | MESH_TunnelNumber tid; |
@@ -7681,18 +7682,18 @@ handle_local_to_origin (void *cls, struct GNUNET_SERVER_Client *client, | |||
7681 | } | 7682 | } |
7682 | 7683 | ||
7683 | /* PID should be as expected */ | 7684 | /* PID should be as expected */ |
7684 | clinfo = tunnel_get_client_fc (t, c); | 7685 | fcinfo = tunnel_get_client_fc (t, c); |
7685 | if (ntohl (data_msg->pid) != clinfo->bck_pid + 1) | 7686 | if (ntohl (data_msg->pid) != fcinfo->bck_pid + 1) |
7686 | { | 7687 | { |
7687 | GNUNET_break (0); | 7688 | GNUNET_break (0); |
7688 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 7689 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
7689 | "To Origin PID, expected %u, got %u\n", | 7690 | "To Origin PID, expected %u, got %u\n", |
7690 | clinfo->bck_pid + 1, | 7691 | fcinfo->bck_pid + 1, |
7691 | ntohl (data_msg->pid)); | 7692 | ntohl (data_msg->pid)); |
7692 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 7693 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
7693 | return; | 7694 | return; |
7694 | } | 7695 | } |
7695 | clinfo->bck_pid++; | 7696 | fcinfo->bck_pid++; |
7696 | 7697 | ||
7697 | /* Ok, everything is correct, send the message | 7698 | /* Ok, everything is correct, send the message |
7698 | * (pretend we got it from a mesh peer) | 7699 | * (pretend we got it from a mesh peer) |