aboutsummaryrefslogtreecommitdiff
path: root/src/mesh/gnunet-service-mesh.c
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2013-07-10 01:11:29 +0000
committerBart Polot <bart@net.in.tum.de>2013-07-10 01:11:29 +0000
commit0c7a9be65aaa70113b41163b03046d5a08211df1 (patch)
treee9cfdcce56b6c2c36ea1d593354cb3be5240fdcd /src/mesh/gnunet-service-mesh.c
parent404596b00d154261da23af6c615b3eb827c24a79 (diff)
downloadgnunet-0c7a9be65aaa70113b41163b03046d5a08211df1.tar.gz
gnunet-0c7a9be65aaa70113b41163b03046d5a08211df1.zip
- don't use deltas, send last PID in POLL message instead
Diffstat (limited to 'src/mesh/gnunet-service-mesh.c')
-rw-r--r--src/mesh/gnunet-service-mesh.c31
1 files changed, 9 insertions, 22 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c
index 894bee622..467e4d614 100644
--- a/src/mesh/gnunet-service-mesh.c
+++ b/src/mesh/gnunet-service-mesh.c
@@ -1624,6 +1624,7 @@ tunnel_poll (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1624 msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_POLL); 1624 msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_POLL);
1625 msg.header.size = htons (sizeof (msg)); 1625 msg.header.size = htons (sizeof (msg));
1626 msg.tid = htonl (t->id.tid); 1626 msg.tid = htonl (t->id.tid);
1627 msg.pid = htonl (fc->last_pid_sent);
1627 GNUNET_PEER_resolve (t->id.oid, &msg.oid); 1628 GNUNET_PEER_resolve (t->id.oid, &msg.oid);
1628 1629
1629 if (fc == &t->prev_fc) 1630 if (fc == &t->prev_fc)
@@ -2065,7 +2066,6 @@ static void
2065tunnel_send_fwd_ack (struct MeshTunnel *t, uint16_t type) 2066tunnel_send_fwd_ack (struct MeshTunnel *t, uint16_t type)
2066{ 2067{
2067 uint32_t ack; 2068 uint32_t ack;
2068 int use_delta = GNUNET_NO;
2069 2069
2070 /* Is it after unicast retransmission? */ 2070 /* Is it after unicast retransmission? */
2071 switch (type) 2071 switch (type)
@@ -2088,8 +2088,6 @@ tunnel_send_fwd_ack (struct MeshTunnel *t, uint16_t type)
2088 tunnel_send_fwd_data_ack (t); 2088 tunnel_send_fwd_data_ack (t);
2089 break; 2089 break;
2090 case GNUNET_MESSAGE_TYPE_MESH_POLL: 2090 case GNUNET_MESSAGE_TYPE_MESH_POLL:
2091 use_delta = GNUNET_YES;
2092 /* falltrough */
2093 case GNUNET_MESSAGE_TYPE_MESH_PATH_ACK: 2091 case GNUNET_MESSAGE_TYPE_MESH_PATH_ACK:
2094 t->force_ack = GNUNET_YES; 2092 t->force_ack = GNUNET_YES;
2095 break; 2093 break;
@@ -2113,8 +2111,7 @@ tunnel_send_fwd_ack (struct MeshTunnel *t, uint16_t type)
2113 } 2111 }
2114 2112
2115 /* Ok, ACK might be necessary, what PID to ACK? */ 2113 /* Ok, ACK might be necessary, what PID to ACK? */
2116 ack = t->queue_max - t->next_fc.queue_n; 2114 ack = t->prev_fc.last_pid_recv + t->queue_max - t->next_fc.queue_n;
2117 ack += use_delta ? 0 : t->prev_fc.last_pid_recv;
2118 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " FWD ACK %u\n", ack); 2115 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " FWD ACK %u\n", ack);
2119 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2116 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2120 " last %u, qmax %u, q %u\n", 2117 " last %u, qmax %u, q %u\n",
@@ -2125,8 +2122,7 @@ tunnel_send_fwd_ack (struct MeshTunnel *t, uint16_t type)
2125 return; 2122 return;
2126 } 2123 }
2127 2124
2128 if (GNUNET_NO == use_delta) 2125 t->prev_fc.last_ack_sent = ack;
2129 t->prev_fc.last_ack_sent = ack;
2130 if (NULL != t->owner) 2126 if (NULL != t->owner)
2131 send_local_ack (t, t->owner, ack, GNUNET_YES); 2127 send_local_ack (t, t->owner, ack, GNUNET_YES);
2132 else if (0 != t->prev_hop) 2128 else if (0 != t->prev_hop)
@@ -3640,11 +3636,8 @@ handle_mesh_unicast (void *cls, const struct GNUNET_PeerIdentity *peer,
3640 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3636 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3641 "Received PID %u, ACK %u\n", 3637 "Received PID %u, ACK %u\n",
3642 pid, t->prev_fc.last_ack_sent); 3638 pid, t->prev_fc.last_ack_sent);
3643 // FIXME address this in some sensible manner 3639 tunnel_send_fwd_ack(t, GNUNET_MESSAGE_TYPE_MESH_POLL);
3644 // - remember that we were polled and last ack might not be accurate 3640 return GNUNET_OK;
3645 // - eliminate altogether and just drop messages of full queue
3646// tunnel_send_fwd_ack(t, GNUNET_MESSAGE_TYPE_MESH_POLL);
3647// return GNUNET_OK;
3648 } 3641 }
3649 3642
3650 tunnel_reset_timeout (t); 3643 tunnel_reset_timeout (t);
@@ -3751,11 +3744,8 @@ handle_mesh_to_orig (void *cls, const struct GNUNET_PeerIdentity *peer,
3751 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3744 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3752 "Received PID %u, ACK %u\n", 3745 "Received PID %u, ACK %u\n",
3753 pid, t->next_fc.last_ack_sent); 3746 pid, t->next_fc.last_ack_sent);
3754 // FIXME address this in some sensible manner 3747 tunnel_send_bck_ack (t, GNUNET_MESSAGE_TYPE_MESH_POLL);
3755 // - remember that we were polled and last ack might not be accurate 3748 return GNUNET_OK;
3756 // - eliminate altogether and just drop messages of full queue
3757// tunnel_send_bck_ack (t, GNUNET_MESSAGE_TYPE_MESH_POLL);
3758// return GNUNET_OK;
3759 } 3749 }
3760 3750
3761 if (myid == t->id.oid) 3751 if (myid == t->id.oid)
@@ -3957,11 +3947,6 @@ handle_mesh_ack (void *cls, const struct GNUNET_PeerIdentity *peer,
3957 return GNUNET_OK; 3947 return GNUNET_OK;
3958 } 3948 }
3959 3949
3960 /* If we have already polled, the response will be a delta (free queue) */
3961 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " LAST %u\n", fc->last_pid_sent);
3962 if (fc->poll_time.rel_value > GNUNET_TIME_UNIT_SECONDS.rel_value)
3963 ack += fc->last_pid_sent;
3964
3965 if (GNUNET_SCHEDULER_NO_TASK != fc->poll_task && 3950 if (GNUNET_SCHEDULER_NO_TASK != fc->poll_task &&
3966 GMC_is_pid_bigger (ack, fc->last_ack_recv)) 3951 GMC_is_pid_bigger (ack, fc->last_ack_recv))
3967 { 3952 {
@@ -4019,11 +4004,13 @@ handle_mesh_poll (void *cls, const struct GNUNET_PeerIdentity *peer,
4019 if (t->next_hop == id) 4004 if (t->next_hop == id)
4020 { 4005 {
4021 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " from FWD\n"); 4006 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " from FWD\n");
4007 t->next_fc.last_pid_recv = ntohl (msg->pid);
4022 tunnel_send_bck_ack (t, GNUNET_MESSAGE_TYPE_MESH_POLL); 4008 tunnel_send_bck_ack (t, GNUNET_MESSAGE_TYPE_MESH_POLL);
4023 } 4009 }
4024 else if (t->prev_hop == id) 4010 else if (t->prev_hop == id)
4025 { 4011 {
4026 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " from BCK\n"); 4012 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " from BCK\n");
4013 t->prev_fc.last_pid_recv = ntohl (msg->pid);
4027 tunnel_send_fwd_ack (t, GNUNET_MESSAGE_TYPE_MESH_POLL); 4014 tunnel_send_fwd_ack (t, GNUNET_MESSAGE_TYPE_MESH_POLL);
4028 } 4015 }
4029 else 4016 else