aboutsummaryrefslogtreecommitdiff
path: root/src/mesh/gnunet-service-mesh.c
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2013-07-13 09:09:43 +0000
committerBart Polot <bart@net.in.tum.de>2013-07-13 09:09:43 +0000
commitfed82bb5995cb8bac06e376717c65b7bceb2066f (patch)
tree5eeab3fc4459abf73231373b8f14c86befbaecaa /src/mesh/gnunet-service-mesh.c
parentbd210046c5733577a6ea5c9ebb564d122fb3e887 (diff)
downloadgnunet-fed82bb5995cb8bac06e376717c65b7bceb2066f.tar.gz
gnunet-fed82bb5995cb8bac06e376717c65b7bceb2066f.zip
- tweak timing, improve precessing of received messages
Diffstat (limited to 'src/mesh/gnunet-service-mesh.c')
-rw-r--r--src/mesh/gnunet-service-mesh.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c
index 674b79f65..62c3553b1 100644
--- a/src/mesh/gnunet-service-mesh.c
+++ b/src/mesh/gnunet-service-mesh.c
@@ -2156,7 +2156,9 @@ tunnel_send_fwd_ack (struct MeshTunnel *t, uint16_t type)
2156 2156
2157 /* Ok, ACK might be necessary, what PID to ACK? */ 2157 /* Ok, ACK might be necessary, what PID to ACK? */
2158 delta = t->queue_max - t->next_fc.queue_n; 2158 delta = t->queue_max - t->next_fc.queue_n;
2159 if (0 > delta) 2159 if (0 > delta || (GNUNET_YES == t->reliable &&
2160 NULL != t->owner &&
2161 t->fwd_rel->n_sent > 10))
2160 delta = 0; 2162 delta = 0;
2161 if (NULL != t->owner && delta > 1) 2163 if (NULL != t->owner && delta > 1)
2162 delta = 1; 2164 delta = 1;
@@ -2365,8 +2367,13 @@ tunnel_retransmit_message (void *cls,
2365 /* Message not found in the queue */ 2367 /* Message not found in the queue */
2366 if (NULL == q) 2368 if (NULL == q)
2367 { 2369 {
2370 struct GNUNET_TIME_Relative diff;
2371
2368 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! RETRANSMIT %llu\n", copy->mid); 2372 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! RETRANSMIT %llu\n", copy->mid);
2369 copy->timestamp = GNUNET_TIME_absolute_get (); 2373 diff = GNUNET_TIME_absolute_get_duration (copy->timestamp);
2374 diff = GNUNET_TIME_relative_divide (diff, 10);
2375 copy->timestamp = GNUNET_TIME_absolute_subtract (GNUNET_TIME_absolute_get(),
2376 diff);
2370 2377
2371 fc->last_ack_sent++; 2378 fc->last_ack_sent++;
2372 payload->pid = htonl (fc->last_pid_recv + 1); 2379 payload->pid = htonl (fc->last_pid_recv + 1);
@@ -3770,24 +3777,36 @@ handle_mesh_unicast (void *cls, const struct GNUNET_PeerIdentity *peer,
3770// if (GMC_is_pid_bigger(pid, t->prev_fc.last_pid_recv)) FIXME use 3777// if (GMC_is_pid_bigger(pid, t->prev_fc.last_pid_recv)) FIXME use
3771 if (GMC_is_pid_bigger (pid, t->prev_fc.last_pid_recv)) 3778 if (GMC_is_pid_bigger (pid, t->prev_fc.last_pid_recv))
3772 { 3779 {
3780 uint64_t mid;
3781
3782 mid = GNUNET_ntohll (msg->mid);
3773 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3783 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3774 " pid %u not seen yet\n", pid); 3784 " pid %u (%llu) not seen yet\n", pid, mid);
3775 t->prev_fc.last_pid_recv = pid; 3785 t->prev_fc.last_pid_recv = pid;
3776 3786
3777 if (GNUNET_NO == t->reliable || 3787 if (GNUNET_NO == t->reliable ||
3778 GNUNET_ntohll (msg->mid) == t->bck_rel->mid_recv) 3788 (mid >= t->bck_rel->mid_recv && mid < t->bck_rel->mid_recv + 64))
3779 { 3789 {
3780 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3790 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3781 "!!! RECV %llu\n", GNUNET_ntohll(msg->mid)); 3791 "!!! RECV %llu\n", GNUNET_ntohll(msg->mid));
3782 if (GNUNET_YES == t->reliable) 3792 if (GNUNET_YES == t->reliable)
3783 t->bck_rel->mid_recv++; 3793 {
3794 if (mid == t->bck_rel->mid_recv)
3795 t->bck_rel->mid_recv++;
3796 }
3784 tunnel_send_client_ucast (t, msg); 3797 tunnel_send_client_ucast (t, msg);
3785 } 3798 }
3799 else
3800 {
3801 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3802 " MID %llu not expected (%llu), dropping!\n",
3803 GNUNET_ntohll (msg->mid), t->bck_rel->mid_recv);
3804 }
3786 } 3805 }
3787 else 3806 else
3788 { 3807 {
3789// GNUNET_STATISTICS_update (stats, "# duplicate PID", 1, GNUNET_NO); 3808// GNUNET_STATISTICS_update (stats, "# duplicate PID", 1, GNUNET_NO);
3790 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 3809 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3791 " Pid %u not expected (%u), dropping!\n", 3810 " Pid %u not expected (%u), dropping!\n",
3792 pid, t->prev_fc.last_pid_recv + 1); 3811 pid, t->prev_fc.last_pid_recv + 1);
3793 } 3812 }