From 0cf253483433ce66627915bb72bc643d2f7c8a5c Mon Sep 17 00:00:00 2001 From: Bart Polot Date: Wed, 9 Apr 2014 17:18:48 +0000 Subject: - add context in path to link connection --- src/mesh/gnunet-service-mesh_connection.c | 1 + src/mesh/gnunet-service-mesh_peer.c | 15 ++++++++++++--- src/mesh/mesh_path.h | 7 +++++++ 3 files changed, 20 insertions(+), 3 deletions(-) (limited to 'src/mesh') diff --git a/src/mesh/gnunet-service-mesh_connection.c b/src/mesh/gnunet-service-mesh_connection.c index 8b5bf8dbf..e355b9e2b 100644 --- a/src/mesh/gnunet-service-mesh_connection.c +++ b/src/mesh/gnunet-service-mesh_connection.c @@ -2439,6 +2439,7 @@ GMC_new (const struct GNUNET_MESH_Hash *cid, GNUNET_assert (own_pos <= p->length - 1); c->own_pos = own_pos; c->path = p; + p->c = c; if (GNUNET_OK != register_neighbors (c)) { diff --git a/src/mesh/gnunet-service-mesh_peer.c b/src/mesh/gnunet-service-mesh_peer.c index 7d537e875..50e37fee2 100644 --- a/src/mesh/gnunet-service-mesh_peer.c +++ b/src/mesh/gnunet-service-mesh_peer.c @@ -744,11 +744,10 @@ peer_get_best_path (const struct MeshPeer *peer) best_p = NULL; for (p = peer->path_head; NULL != p; p = p->next) { - if (GNUNET_YES == GMT_is_path_used (peer->tunnel, p)) - continue; /* If path is already in use, skip it. */ - if (GNUNET_NO == path_is_valid (p)) continue; /* Don't use invalid paths. */ + if (GNUNET_YES == GMT_is_path_used (peer->tunnel, p)) + continue; /* If path is already in use, skip it. */ if ((cost = GMT_get_path_cost (peer->tunnel, p)) < best_cost) { @@ -760,6 +759,16 @@ peer_get_best_path (const struct MeshPeer *peer) } +/** + * Is this queue element sendable? + * + * - All management traffic is always sendable. + * - For payload traffic, check the connection flow control. + * + * @param q Queue element to inspect. + * + * @return #GNUNET_YES if it is sendable, #GNUNET_NO otherwise. + */ static int queue_is_sendable (struct MeshPeerQueue *q) { diff --git a/src/mesh/mesh_path.h b/src/mesh/mesh_path.h index 8b8e20a1e..bba11e9d4 100644 --- a/src/mesh/mesh_path.h +++ b/src/mesh/mesh_path.h @@ -24,6 +24,8 @@ * @author Bartlomiej Polot */ +#include "gnunet-service-mesh_connection.h" + #ifndef MESH_PATH_H_ #define MESH_PATH_H_ @@ -61,6 +63,11 @@ struct MeshPeerPath */ unsigned int length; + /** + * User defined data store. + */ + struct MeshConnection *c; + /** * Path's score, how reliable is the path. */ -- cgit v1.2.3