From 4e952ed52de883f6ad4cc7f964d8a19171c4ac41 Mon Sep 17 00:00:00 2001 From: Bart Polot Date: Wed, 1 Aug 2012 11:24:47 +0000 Subject: [PATCH] - wip --- src/mesh/gnunet-service-mesh.c | 48 ++++++++++++++++++++++++------ src/mesh/test_mesh.conf | 10 +++++++ src/mesh/test_mesh_local_traffic.c | 2 +- 3 files changed, 50 insertions(+), 10 deletions(-) diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c index c1ac2ca6e..b6c5daa1b 100644 --- a/src/mesh/gnunet-service-mesh.c +++ b/src/mesh/gnunet-service-mesh.c @@ -981,15 +981,26 @@ tunnel_notify_connection_broken (struct MeshTunnel *t, GNUNET_PEER_Id p1, /** - * Get the current ack value for a tunnel, taking in account the tunnel - * mode and the status of all children nodes. + * Get the current ack value for a tunnel, for data going from root to leaves, + * taking in account the tunnel mode and the status of all children and clients. + * + * @param t Tunnel. + * + * @return Maximum PID allowed. + */ +static uint32_t +tunnel_get_fwd_ack (struct MeshTunnel *t); + +/** + * Get the current ack value for a tunnel, for data going from leaves to root, + * taking in account the tunnel mode and the status of all children and clients. * * @param t Tunnel. * * @return Maximum PID allowed. */ static uint32_t -tunnel_get_ack (struct MeshTunnel *t); +tunnel_get_bck_ack (struct MeshTunnel *t); /** * Add a client to a tunnel, initializing all needed data structures. @@ -1968,7 +1979,7 @@ send_client_tunnel_ack (struct MeshClient *c, struct MeshTunnel *t) GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " to client %u\n", c->id); - ack = tunnel_get_ack (t); + ack = tunnel_get_fwd_ack (t); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " ack %u\n", ack); if (t->last_ack == ack) @@ -3288,7 +3299,7 @@ tunnel_get_child_ack (void *cls, * * @param t Tunnel. * - * @return Maximum PID allowed. + * @return Maximum PID allowed, 0 if node has no children. */ static uint32_t tunnel_get_children_ack (struct MeshTunnel *t) @@ -3407,7 +3418,7 @@ tunnel_get_clients_ack (struct MeshTunnel *t) * @return Maximum PID allowed. */ static uint32_t -tunnel_get_ack (struct MeshTunnel *t) +tunnel_get_fwd_ack (struct MeshTunnel *t) { uint32_t count; uint32_t buffer_free; @@ -3419,7 +3430,8 @@ tunnel_get_ack (struct MeshTunnel *t) buffer_free = t->queue_max - t->queue_n; ack = count + buffer_free; child_ack = tunnel_get_children_ack (t); - client_ack = tunnel_get_clients_ack (t); + if (0 == child_ack) + ack = client_ack = tunnel_get_clients_ack (t); if (GNUNET_YES == t->speed_min) { @@ -3436,6 +3448,24 @@ tunnel_get_ack (struct MeshTunnel *t) return ack; } +/** + * Get the current ack value for a tunnel, taking in account the tunnel + * mode and the status of all children nodes. + * + * @param t Tunnel. + * + * @return Maximum PID allowed. + */ +static uint32_t +tunnel_get_bck_ack (struct MeshTunnel *t) +{ + uint32_t ack; + + ack = 0; + + return ack; +} + /** * Send an ACK informing the predecessor about the available buffer space. @@ -3475,7 +3505,7 @@ tunnel_send_ack (struct MeshTunnel *t, uint16_t type) } /* Ok, ACK might be necessary, what PID to ACK? */ - ack = tunnel_get_ack (t); + ack = tunnel_get_fwd_ack (t); /* If speed_min and not all children have ack'd, dont send yet */ if (ack == t->last_ack) @@ -6596,7 +6626,7 @@ handle_local_ack (void *cls, struct GNUNET_SERVER_Client *client, } /* Does client own tunnel? */ - if (NULL != t->owner && t->owner->handle != client) + if (NULL != t->owner && t->owner->handle == client) { GNUNET_break (0); // FIXME TODO diff --git a/src/mesh/test_mesh.conf b/src/mesh/test_mesh.conf index f2e51e4e3..5b5d1ffc7 100644 --- a/src/mesh/test_mesh.conf +++ b/src/mesh/test_mesh.conf @@ -12,6 +12,16 @@ HOSTNAME = localhost PORT = 10511 # PREFIX = valgrind --leak-check=full # PREFIX = xterm -geometry 100x85 -T peer1 -e gdb --args +REFRESH_PATH_TIME = 3 s +APP_ANNOUNCE_TIME = 5 s +ID_ANNOUNCE_TIME = 5 s +UNACKNOWLEDGED_WAIT = 2 s +CONNECT_TIMEOUT = 30 s +DEFAULT_TTL = 16 +DHT_REPLICATION_LEVEL = 10 +MAX_TUNNELS = 10 +MAX_MSGS_QUEUE = 20 + [dht] DEBUG = NO diff --git a/src/mesh/test_mesh_local_traffic.c b/src/mesh/test_mesh_local_traffic.c index 78e1049f6..367edb3a6 100644 --- a/src/mesh/test_mesh_local_traffic.c +++ b/src/mesh/test_mesh_local_traffic.c @@ -32,7 +32,7 @@ #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5) -#define TARGET 1000 +#define TARGET 10 GNUNET_NETWORK_STRUCT_BEGIN -- 2.25.1