aboutsummaryrefslogtreecommitdiff
path: root/src/mesh/gnunet-service-mesh.c
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2013-07-13 02:46:51 +0000
committerBart Polot <bart@net.in.tum.de>2013-07-13 02:46:51 +0000
commitb5282dae4afbaf004128202d4755742348d56654 (patch)
tree7f4a1a2e4e9fbf78a20d59138e0601238a6e388b /src/mesh/gnunet-service-mesh.c
parent7500dcceeb3a62f82c741ade01d126ea276838fd (diff)
downloadgnunet-b5282dae4afbaf004128202d4755742348d56654.tar.gz
gnunet-b5282dae4afbaf004128202d4755742348d56654.zip
- when injecting a retransmitted message in the queue, update its pid to the lowest from the queue
Diffstat (limited to 'src/mesh/gnunet-service-mesh.c')
-rw-r--r--src/mesh/gnunet-service-mesh.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c
index ef79aac72..f0414e37c 100644
--- a/src/mesh/gnunet-service-mesh.c
+++ b/src/mesh/gnunet-service-mesh.c
@@ -3037,8 +3037,8 @@ queue_get_next (const struct MeshPeerInfo *peer)
3037 return q; 3037 return q;
3038 } 3038 }
3039 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3039 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3040 "* ACK: %u, PID: %u\n", 3040 "* ACK: %u, PID: %u, MID: %llu\n",
3041 ack, pid); 3041 ack, pid, GNUNET_ntohll (dmsg->mid));
3042 if (GNUNET_NO == GMC_is_pid_bigger (pid, ack)) 3042 if (GNUNET_NO == GMC_is_pid_bigger (pid, ack))
3043 { 3043 {
3044 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3044 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -3268,11 +3268,6 @@ queue_add (void *cls, uint16_t type, size_t size,
3268 { 3268 {
3269 if (fc->queue_n >= t->queue_max) 3269 if (fc->queue_n >= t->queue_max)
3270 { 3270 {
3271 GNUNET_break (0);
3272 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3273 "queue full: %u/%u\n",
3274 fc->queue_n, t->queue_max);
3275
3276 /* If this isn't a retransmission, drop the message */ 3271 /* If this isn't a retransmission, drop the message */
3277 if (GNUNET_NO == t->reliable || 3272 if (GNUNET_NO == t->reliable ||
3278 (NULL == t->owner && GNUNET_MESSAGE_TYPE_MESH_UNICAST == type) || 3273 (NULL == t->owner && GNUNET_MESSAGE_TYPE_MESH_UNICAST == type) ||
@@ -3280,6 +3275,10 @@ queue_add (void *cls, uint16_t type, size_t size,
3280 { 3275 {
3281 GNUNET_STATISTICS_update (stats, "# messages dropped (buffer full)", 3276 GNUNET_STATISTICS_update (stats, "# messages dropped (buffer full)",
3282 1, GNUNET_NO); 3277 1, GNUNET_NO);
3278 GNUNET_break (0);
3279 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3280 "queue full: %u/%u\n",
3281 fc->queue_n, t->queue_max);
3283 return; /* Drop this message */ 3282 return; /* Drop this message */
3284 } 3283 }
3285 priority = GNUNET_YES; 3284 priority = GNUNET_YES;
@@ -3293,7 +3292,22 @@ queue_add (void *cls, uint16_t type, size_t size,
3293 queue->peer = dst; 3292 queue->peer = dst;
3294 queue->tunnel = t; 3293 queue->tunnel = t;
3295 if (GNUNET_YES == priority) 3294 if (GNUNET_YES == priority)
3295 {
3296 struct GNUNET_MESH_Data *d;
3297 uint32_t prev;
3298 uint32_t next;
3299
3296 GNUNET_CONTAINER_DLL_insert (dst->queue_head, dst->queue_tail, queue); 3300 GNUNET_CONTAINER_DLL_insert (dst->queue_head, dst->queue_tail, queue);
3301 d = (struct GNUNET_MESH_Data *) queue->cls;
3302 prev = d->pid;
3303 for (queue = dst->queue_tail; NULL != queue; queue = queue->prev)
3304 {
3305 d = (struct GNUNET_MESH_Data *) queue->cls;
3306 next = d->pid;
3307 d->pid = prev;
3308 prev = next;
3309 }
3310 }
3297 else 3311 else
3298 GNUNET_CONTAINER_DLL_insert_tail (dst->queue_head, dst->queue_tail, queue); 3312 GNUNET_CONTAINER_DLL_insert_tail (dst->queue_head, dst->queue_tail, queue);
3299 if (NULL == dst->core_transmit) 3313 if (NULL == dst->core_transmit)