[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r24116 - gnunet/src/mesh
From: |
gnunet |
Subject: |
[GNUnet-SVN] r24116 - gnunet/src/mesh |
Date: |
Fri, 28 Sep 2012 20:18:00 +0200 |
Author: bartpolot
Date: 2012-09-28 20:18:00 +0200 (Fri, 28 Sep 2012)
New Revision: 24116
Modified:
gnunet/src/mesh/gnunet-service-mesh.c
gnunet/src/mesh/mesh.h
gnunet/src/mesh/mesh_api.c
Log:
- fix mesh fc when buffering is off
Modified: gnunet/src/mesh/gnunet-service-mesh.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh.c 2012-09-28 17:01:53 UTC (rev
24115)
+++ gnunet/src/mesh/gnunet-service-mesh.c 2012-09-28 18:18:00 UTC (rev
24116)
@@ -2085,6 +2085,11 @@
tmsg.header.type = htons
(GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_CREATE);
GNUNET_PEER_resolve (t->id.oid, &tmsg.peer);
tmsg.tunnel_id = htonl (t->local_tid_dest);
+ tmsg.opt = 0;
+ if (GNUNET_YES == t->speed_min)
+ tmsg.opt |= MESH_TUNNEL_OPT_SPEED_MIN;
+ if (GNUNET_YES == t->nobuffer)
+ tmsg.opt |= MESH_TUNNEL_OPT_NOBUFFER;
GNUNET_SERVER_notification_context_unicast (nc, c->handle,
&tmsg.header, GNUNET_NO);
tunnel_add_client (t, c);
@@ -3701,9 +3706,23 @@
count = t->fwd_pid - t->skip;
buffer_free = t->fwd_queue_max - t->fwd_queue_n;
- ack = count + buffer_free;
child_ack = tunnel_get_children_fwd_ack (t);
client_ack = tunnel_get_clients_fwd_ack (t);
+ if (GNUNET_YES == t->nobuffer)
+ {
+ ack = count;
+ if (-1LL == child_ack)
+ child_ack = client_ack;
+ if (-1LL == child_ack)
+ {
+ GNUNET_break (0);
+ client_ack = child_ack = ack;
+ }
+ }
+ else
+ {
+ ack = count + buffer_free; // Overflow? OK!
+ }
if (-1LL == child_ack)
{
// Node has no children, child_ack AND core buffer are irrelevant.
@@ -3712,20 +3731,18 @@
}
if (-1LL == client_ack)
{
- client_ack = ack; // Might overflow 32 bits, it's ok!
+ client_ack = ack;
}
if (GNUNET_YES == t->speed_min)
{
- ack = GMC_min_pid ((uint32_t) child_ack, ack); // Might overflow 32 bits,
it's ok!;
+ ack = GMC_min_pid ((uint32_t) child_ack, ack);
ack = GMC_min_pid ((uint32_t) client_ack, ack);
}
else
{
- ack = GMC_max_pid ((uint32_t) child_ack, ack); // Might overflow 32 bits,
it's ok!;
+ ack = GMC_max_pid ((uint32_t) child_ack, ack);
ack = GMC_max_pid ((uint32_t) client_ack, ack);
}
- if (GNUNET_YES == t->nobuffer && GMC_is_pid_bigger(ack, t->fwd_pid))
- ack = t->fwd_pid + 1; // Might overflow 32 bits, it's ok!
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"c %u, bf %u, ch %lld, cl %lld, ACK: %u\n",
count, buffer_free, child_ack, client_ack, ack);
@@ -3796,7 +3813,10 @@
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " ack %u\n", ack);
if (t->last_fwd_ack == ack)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " same as last, not sending!\n");
return;
+ }
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " sending!\n");
t->last_fwd_ack = ack;
@@ -5111,8 +5131,11 @@
opt = ntohl (msg->opt);
t->speed_min = (0 != (opt & MESH_TUNNEL_OPT_SPEED_MIN)) ?
GNUNET_YES : GNUNET_NO;
- t->nobuffer = (0 != (opt & MESH_TUNNEL_OPT_NOBUFFER)) ?
- GNUNET_YES : GNUNET_NO;
+ if (0 != (opt & MESH_TUNNEL_OPT_NOBUFFER))
+ {
+ t->nobuffer = GNUNET_YES;
+ t->last_fwd_ack = t->fwd_pid + 1;
+ }
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
" speed_min: %d, nobuffer:%d\n",
t->speed_min, t->nobuffer);
@@ -5509,6 +5532,7 @@
GNUNET_YES == GMC_is_pid_bigger (pid, cinfo->fwd_ack))
{
GNUNET_STATISTICS_update (stats, "# unsolicited unicast", 1, GNUNET_NO);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, " %u > %u\n", pid, cinfo->fwd_ack);
GNUNET_break_op (0);
return GNUNET_OK;
}
Modified: gnunet/src/mesh/mesh.h
===================================================================
--- gnunet/src/mesh/mesh.h 2012-09-28 17:01:53 UTC (rev 24115)
+++ gnunet/src/mesh/mesh.h 2012-09-28 18:18:00 UTC (rev 24116)
@@ -169,6 +169,11 @@
* Peer at the other end, if any
*/
struct GNUNET_PeerIdentity peer;
+
+ /**
+ * Tunnel options (speed, buffering)
+ */
+ uint32_t opt;
};
/**
Modified: gnunet/src/mesh/mesh_api.c
===================================================================
--- gnunet/src/mesh/mesh_api.c 2012-09-28 17:01:53 UTC (rev 24115)
+++ gnunet/src/mesh/mesh_api.c 2012-09-28 18:18:00 UTC (rev 24116)
@@ -467,6 +467,7 @@
}
t->max_send_pid = INITIAL_WINDOW_SIZE - 1;
t->last_recv_pid = (uint32_t) -1;
+ t->buffering = GNUNET_YES;
return t;
}
@@ -707,7 +708,10 @@
t->tid, t->max_recv_pid, t->last_recv_pid, delta);
return;
}
- t->max_recv_pid = t->last_recv_pid + INITIAL_WINDOW_SIZE;
+ if (GNUNET_YES == t->buffering)
+ t->max_recv_pid = t->last_recv_pid + INITIAL_WINDOW_SIZE;
+ else
+ t->max_recv_pid = t->last_recv_pid + 1;
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Sending ACK on tunnel %X: %u\n",
t->tid, t->max_recv_pid);
@@ -970,6 +974,12 @@
GNUNET_PEER_change_rc (t->owner, 1);
t->mesh = h;
t->tid = tid;
+ if ((msg->opt & MESH_TUNNEL_OPT_NOBUFFER) != 0)
+ t->buffering = GNUNET_NO;
+ else
+ t->buffering = GNUNET_YES;
+ if ((msg->opt & MESH_TUNNEL_OPT_SPEED_MIN) != 0)
+ t->speed_min = GNUNET_YES;
atsi.type = 0;
atsi.value = 0;
LOG (GNUNET_ERROR_TYPE_DEBUG, " created tunnel %p\n", t);
@@ -1817,6 +1827,7 @@
h = tunnel->mesh;
tunnel->buffering = buffer;
+ tunnel->max_send_pid = tunnel->next_send_pid;
if (GNUNET_YES == buffer)
msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_BUFFER);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r24116 - gnunet/src/mesh,
gnunet <=