commit 0cf253483433ce66627915bb72bc643d2f7c8a5c
parent 2dae6d8d5b7eff1ee73f47ee6b3b57d40ae4f602
Author: Bart Polot <bart@net.in.tum.de>
Date: Wed, 9 Apr 2014 17:18:48 +0000
- add context in path to link connection
Diffstat:
3 files changed, 20 insertions(+), 3 deletions(-)
diff --git 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
@@ -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
@@ -24,6 +24,8 @@
* @author Bartlomiej Polot
*/
+#include "gnunet-service-mesh_connection.h"
+
#ifndef MESH_PATH_H_
#define MESH_PATH_H_
@@ -62,6 +64,11 @@ struct MeshPeerPath
unsigned int length;
/**
+ * User defined data store.
+ */
+ struct MeshConnection *c;
+
+ /**
* Path's score, how reliable is the path.
*/
// int score;