aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2013-05-16 16:51:50 +0000
committerBart Polot <bart@net.in.tum.de>2013-05-16 16:51:50 +0000
commitdb1bb9ce90445dc4e72761c83476c56b6b6828a1 (patch)
tree8bc6ada4c1f9084cb60a0607341f9c8b1b675752 /src
parent72dabf2eb55013193206d1fe0c1b0e805a5f4997 (diff)
downloadgnunet-db1bb9ce90445dc4e72761c83476c56b6b6828a1.tar.gz
gnunet-db1bb9ce90445dc4e72761c83476c56b6b6828a1.zip
- always set prev & next hop to allow reuse of p2p code for local-only tunnels
Diffstat (limited to 'src')
-rw-r--r--src/mesh/gnunet-service-mesh-new.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/src/mesh/gnunet-service-mesh-new.c b/src/mesh/gnunet-service-mesh-new.c
index 611f86179..f2fc72dd0 100644
--- a/src/mesh/gnunet-service-mesh-new.c
+++ b/src/mesh/gnunet-service-mesh-new.c
@@ -1238,12 +1238,6 @@ send_path_ack (struct MeshTunnel *t)
1238{ 1238{
1239 struct MeshPeerInfo *peer; 1239 struct MeshPeerInfo *peer;
1240 1240
1241 if (0 == t->prev_hop)
1242 {
1243 GNUNET_break (0);
1244 return;
1245 }
1246
1247 peer = peer_get_short (t->prev_hop); 1241 peer = peer_get_short (t->prev_hop);
1248 1242
1249 queue_add (t, 1243 queue_add (t,
@@ -1797,11 +1791,11 @@ tunnel_use_path (struct MeshTunnel *t, struct MeshPeerPath *p)
1797 if (i < p->length - 1) 1791 if (i < p->length - 1)
1798 t->next_hop = p->peers[i + 1]; 1792 t->next_hop = p->peers[i + 1];
1799 else 1793 else
1800 t->next_hop = 0; 1794 t->next_hop = p->peers[i];
1801 if (0 < i) 1795 if (0 < i)
1802 t->prev_hop = p->peers[i - 1]; 1796 t->prev_hop = p->peers[i - 1];
1803 else 1797 else
1804 t->prev_hop = 0; 1798 t->prev_hop = p->peers[0];
1805 1799
1806 if (NULL != t->path) 1800 if (NULL != t->path)
1807 path_destroy (t->path); 1801 path_destroy (t->path);
@@ -1959,10 +1953,10 @@ tunnel_send_fwd_ack (struct MeshTunnel *t, uint16_t type)
1959 } 1953 }
1960 1954
1961 t->prev_fc.last_ack_sent = ack; 1955 t->prev_fc.last_ack_sent = ack;
1962 if (0 != t->prev_hop) 1956 if (NULL != t->owner)
1963 send_ack (t, t->prev_hop, ack);
1964 else if (NULL != t->owner)
1965 send_local_ack (t, t->owner, ack); 1957 send_local_ack (t, t->owner, ack);
1958 else if (0 != t->prev_hop)
1959 send_ack (t, t->prev_hop, ack);
1966 else 1960 else
1967 GNUNET_break (0); 1961 GNUNET_break (0);
1968 debug_fwd_ack++; 1962 debug_fwd_ack++;
@@ -2025,10 +2019,10 @@ tunnel_send_bck_ack (struct MeshTunnel *t, uint16_t type)
2025 ack, t->next_fc.last_ack_sent); 2019 ack, t->next_fc.last_ack_sent);
2026 t->next_fc.last_ack_sent = ack; 2020 t->next_fc.last_ack_sent = ack;
2027 2021
2028 if (0 != t->next_hop) 2022 if (NULL != t->client)
2029 send_ack (t, t->next_hop, ack);
2030 else if (NULL != t->client)
2031 send_local_ack (t, t->client, ack); 2023 send_local_ack (t, t->client, ack);
2024 else if (0 != t->next_hop)
2025 send_ack (t, t->next_hop, ack);
2032 else 2026 else
2033 GNUNET_break (0); 2027 GNUNET_break (0);
2034 t->force_ack = GNUNET_NO; 2028 t->force_ack = GNUNET_NO;
@@ -2101,7 +2095,7 @@ tunnel_send_destroy (struct MeshTunnel *t)
2101 " sending tunnel destroy for tunnel: %s [%X]\n", 2095 " sending tunnel destroy for tunnel: %s [%X]\n",
2102 GNUNET_i2s (&msg.oid), t->id.tid); 2096 GNUNET_i2s (&msg.oid), t->id.tid);
2103 2097
2104 if (0 != t->next_hop) 2098 if (NULL == t->client)
2105 { 2099 {
2106 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " child: %u\n", t->next_hop); 2100 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " child: %u\n", t->next_hop);
2107 GNUNET_PEER_resolve (t->next_hop, &id); 2101 GNUNET_PEER_resolve (t->next_hop, &id);
@@ -2110,7 +2104,7 @@ tunnel_send_destroy (struct MeshTunnel *t)
2110 GNUNET_i2s (&id)); 2104 GNUNET_i2s (&id));
2111 send_prebuilt_message (&msg.header, t->next_hop, t); 2105 send_prebuilt_message (&msg.header, t->next_hop, t);
2112 } 2106 }
2113 if (0 != t->prev_hop) 2107 if (NULL == t->owner)
2114 { 2108 {
2115 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " parent: %u\n", t->prev_hop); 2109 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " parent: %u\n", t->prev_hop);
2116 GNUNET_PEER_resolve (t->prev_hop, &id); 2110 GNUNET_PEER_resolve (t->prev_hop, &id);