diff options
author | Bart Polot <bart@net.in.tum.de> | 2013-07-08 18:10:14 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2013-07-08 18:10:14 +0000 |
commit | 8096356e5dab41fa45cedfaf1f5bb41603cba89a (patch) | |
tree | b7a08ec6118c844de0d98aba7a6b025aa222df0c /src | |
parent | fa206e9e7f391f008d2afdbbc4e9a49bad4f7f9d (diff) | |
download | gnunet-8096356e5dab41fa45cedfaf1f5bb41603cba89a.tar.gz gnunet-8096356e5dab41fa45cedfaf1f5bb41603cba89a.zip |
- send data_ack from the same ack function as hop-by-hop acks
Diffstat (limited to 'src')
-rw-r--r-- | src/mesh/gnunet-service-mesh.c | 59 |
1 files changed, 52 insertions, 7 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c index 7740d44f9..d05379b11 100644 --- a/src/mesh/gnunet-service-mesh.c +++ b/src/mesh/gnunet-service-mesh.c | |||
@@ -2021,6 +2021,48 @@ send_ack (struct MeshTunnel *t, GNUNET_PEER_Id peer, uint32_t ack) | |||
2021 | 2021 | ||
2022 | 2022 | ||
2023 | /** | 2023 | /** |
2024 | * Send an end-to-end FWD ACK message for the most recent in-sequence payload. | ||
2025 | * | ||
2026 | * @param t Tunnel this is about. | ||
2027 | */ | ||
2028 | static void | ||
2029 | tunnel_send_fwd_data_ack (struct MeshTunnel *t) | ||
2030 | { | ||
2031 | struct GNUNET_MESH_DataACK msg; | ||
2032 | |||
2033 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_DATA_ACK); | ||
2034 | msg.header.size = htons (sizeof (msg)); | ||
2035 | msg.tid = htonl (t->id.tid); | ||
2036 | GNUNET_PEER_resolve (t->id.oid, &msg.oid); | ||
2037 | msg.pid = htonl (t->prev_fc.last_pid_recv); | ||
2038 | msg.futures = 0; // FIXME set bits of other newer messages received | ||
2039 | |||
2040 | send_prebuilt_message (&msg.header, t->prev_hop, t); | ||
2041 | } | ||
2042 | |||
2043 | |||
2044 | /** | ||
2045 | * Send an end-to-end BCK ACK message for the most recent in-sequence payload. | ||
2046 | * | ||
2047 | * @param t Tunnel this is about. | ||
2048 | */ | ||
2049 | static void | ||
2050 | tunnel_send_bck_data_ack (struct MeshTunnel *t) | ||
2051 | { | ||
2052 | struct GNUNET_MESH_DataACK msg; | ||
2053 | |||
2054 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_DATA_ACK); | ||
2055 | msg.header.size = htons (sizeof (msg)); | ||
2056 | msg.tid = htonl (t->id.tid); | ||
2057 | GNUNET_PEER_resolve (t->id.oid, &msg.oid); | ||
2058 | msg.pid = htonl (t->next_fc.last_pid_recv); | ||
2059 | msg.futures = 0; // FIXME set bits of other newer messages received | ||
2060 | |||
2061 | send_prebuilt_message (&msg.header, t->next_hop, t); | ||
2062 | } | ||
2063 | |||
2064 | |||
2065 | /** | ||
2024 | * Send an ACK informing the predecessor about the available buffer space. | 2066 | * Send an ACK informing the predecessor about the available buffer space. |
2025 | * In case there is no predecessor, inform the owning client. | 2067 | * In case there is no predecessor, inform the owning client. |
2026 | * If buffering is off, send only on behalf of children or self if endpoint. | 2068 | * If buffering is off, send only on behalf of children or self if endpoint. |
@@ -2053,9 +2095,11 @@ tunnel_send_fwd_ack (struct MeshTunnel *t, uint16_t type) | |||
2053 | return; | 2095 | return; |
2054 | case GNUNET_MESSAGE_TYPE_MESH_LOCAL_ACK: | 2096 | case GNUNET_MESSAGE_TYPE_MESH_LOCAL_ACK: |
2055 | break; | 2097 | break; |
2098 | case GNUNET_MESSAGE_TYPE_MESH_DATA_ACK: | ||
2099 | tunnel_send_fwd_data_ack (t); | ||
2100 | /* fall through */ | ||
2056 | case GNUNET_MESSAGE_TYPE_MESH_PATH_ACK: | 2101 | case GNUNET_MESSAGE_TYPE_MESH_PATH_ACK: |
2057 | case GNUNET_MESSAGE_TYPE_MESH_POLL: | 2102 | case GNUNET_MESSAGE_TYPE_MESH_POLL: |
2058 | case GNUNET_MESSAGE_TYPE_MESH_DATA_ACK: | ||
2059 | t->force_ack = GNUNET_YES; | 2103 | t->force_ack = GNUNET_YES; |
2060 | break; | 2104 | break; |
2061 | default: | 2105 | default: |
@@ -2131,9 +2175,11 @@ tunnel_send_bck_ack (struct MeshTunnel *t, uint16_t type) | |||
2131 | return; | 2175 | return; |
2132 | case GNUNET_MESSAGE_TYPE_MESH_LOCAL_ACK: | 2176 | case GNUNET_MESSAGE_TYPE_MESH_LOCAL_ACK: |
2133 | break; | 2177 | break; |
2178 | case GNUNET_MESSAGE_TYPE_MESH_DATA_ACK: | ||
2179 | tunnel_send_bck_data_ack (t); | ||
2180 | /* fall through */ | ||
2134 | case GNUNET_MESSAGE_TYPE_MESH_PATH_ACK: | 2181 | case GNUNET_MESSAGE_TYPE_MESH_PATH_ACK: |
2135 | case GNUNET_MESSAGE_TYPE_MESH_POLL: | 2182 | case GNUNET_MESSAGE_TYPE_MESH_POLL: |
2136 | case GNUNET_MESSAGE_TYPE_MESH_DATA_ACK: | ||
2137 | t->force_ack = GNUNET_YES; | 2183 | t->force_ack = GNUNET_YES; |
2138 | break; | 2184 | break; |
2139 | default: | 2185 | default: |
@@ -3601,7 +3647,6 @@ handle_mesh_unicast (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
3601 | tunnel_send_fwd_ack(t, GNUNET_MESSAGE_TYPE_MESH_POLL); | 3647 | tunnel_send_fwd_ack(t, GNUNET_MESSAGE_TYPE_MESH_POLL); |
3602 | return GNUNET_OK; | 3648 | return GNUNET_OK; |
3603 | } | 3649 | } |
3604 | t->prev_fc.last_pid_recv = pid; | ||
3605 | 3650 | ||
3606 | tunnel_reset_timeout (t); | 3651 | tunnel_reset_timeout (t); |
3607 | if (t->dest == myid) | 3652 | if (t->dest == myid) |
@@ -3615,6 +3660,7 @@ handle_mesh_unicast (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
3615 | { | 3660 | { |
3616 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3661 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
3617 | " pid %u not seen yet, forwarding\n", pid); | 3662 | " pid %u not seen yet, forwarding\n", pid); |
3663 | t->prev_fc.last_pid_recv = pid; | ||
3618 | tunnel_send_client_ucast (t, msg); | 3664 | tunnel_send_client_ucast (t, msg); |
3619 | tunnel_send_fwd_ack (t, GNUNET_MESSAGE_TYPE_MESH_UNICAST); | 3665 | tunnel_send_fwd_ack (t, GNUNET_MESSAGE_TYPE_MESH_UNICAST); |
3620 | } | 3666 | } |
@@ -3627,6 +3673,7 @@ handle_mesh_unicast (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
3627 | } | 3673 | } |
3628 | return GNUNET_OK; | 3674 | return GNUNET_OK; |
3629 | } | 3675 | } |
3676 | t->prev_fc.last_pid_recv = pid; | ||
3630 | if (0 == t->next_hop) | 3677 | if (0 == t->next_hop) |
3631 | { | 3678 | { |
3632 | GNUNET_break (0); | 3679 | GNUNET_break (0); |
@@ -3704,9 +3751,6 @@ handle_mesh_to_orig (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
3704 | tunnel_send_bck_ack (t, GNUNET_MESSAGE_TYPE_MESH_POLL); | 3751 | tunnel_send_bck_ack (t, GNUNET_MESSAGE_TYPE_MESH_POLL); |
3705 | return GNUNET_OK; | 3752 | return GNUNET_OK; |
3706 | } | 3753 | } |
3707 | t->next_fc.last_pid_recv = pid; | ||
3708 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
3709 | " pid %u not seen yet, forwarding\n", pid); | ||
3710 | 3754 | ||
3711 | if (myid == t->id.oid) | 3755 | if (myid == t->id.oid) |
3712 | { | 3756 | { |
@@ -3716,6 +3760,7 @@ handle_mesh_to_orig (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
3716 | GNUNET_STATISTICS_update (stats, "# to origin received", 1, GNUNET_NO); | 3760 | GNUNET_STATISTICS_update (stats, "# to origin received", 1, GNUNET_NO); |
3717 | if (pid == t->next_fc.last_pid_recv + 1) // FIXME use "futures" as accepting | 3761 | if (pid == t->next_fc.last_pid_recv + 1) // FIXME use "futures" as accepting |
3718 | { | 3762 | { |
3763 | t->next_fc.last_pid_recv = pid; | ||
3719 | tunnel_send_client_to_orig (t, msg); | 3764 | tunnel_send_client_to_orig (t, msg); |
3720 | tunnel_send_bck_ack (t, GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN); | 3765 | tunnel_send_bck_ack (t, GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN); |
3721 | } | 3766 | } |
@@ -3730,7 +3775,7 @@ handle_mesh_to_orig (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
3730 | } | 3775 | } |
3731 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3776 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
3732 | " not for us, retransmitting...\n"); | 3777 | " not for us, retransmitting...\n"); |
3733 | 3778 | t->next_fc.last_pid_recv = pid; | |
3734 | if (0 == t->prev_hop) /* No owner AND no prev hop */ | 3779 | if (0 == t->prev_hop) /* No owner AND no prev hop */ |
3735 | { | 3780 | { |
3736 | if (GNUNET_YES == t->destroy) | 3781 | if (GNUNET_YES == t->destroy) |