*/
uint32_t last_fwd_ack;
- /**
- * BCK ACK value received from the hop towards the owner of the tunnel,
- * (previous node / owner): up to what message PID can we sent back to him.
- */
+ /**
+ * BCK ACK value received from the hop towards the owner of the tunnel,
+ * (previous node / owner): up to what message PID can we sent back to him.
+ */
uint32_t bck_ack;
/**
*/
unsigned int peers_ready;
- /**
- * Number of peers that have been added to the tunnel
- */
- unsigned int peers_total;
-
/**
* Client owner of the tunnel, if any
*/
struct GNUNET_SERVER_Client *handle;
/**
- * Applications that this client has claimed to provide
+ * Applications that this client has claimed to provide: H(app) = app.
*/
struct GNUNET_CONTAINER_MultiHashMap *apps;
static MESH_TunnelNumber next_local_tid;
/**
- * All application types provided by this peer.
+ * All application types provided by this peer: H(app) = *Client.
*/
static struct GNUNET_CONTAINER_MultiHashMap *applications;
return GNUNET_YES;
}
block.type = htonl (block.type);
-
+ DEBUG_DHT ("Putting APP key: %s\n", GNUNET_h2s (key));
GNUNET_break (NULL !=
GNUNET_DHT_put (dht_handle, key,
dht_replication_level,
{
peer->ntunnels--;
peer->tunnels[i] = peer->tunnels[peer->ntunnels];
- peer->tunnels = GNUNET_realloc (peer->tunnels, peer->ntunnels);
+ peer->tunnels =
+ GNUNET_realloc (peer->tunnels,
+ peer->ntunnels * sizeof(struct MeshTunnel *));
return GNUNET_YES;
}
}
if (GNUNET_NO ==
GNUNET_CONTAINER_multihashmap_contains (t->peers, &id.hashPubKey))
{
- t->peers_total++;
GNUNET_array_append (peer->tunnels, peer->ntunnels, t);
GNUNET_assert (GNUNET_OK ==
GNUNET_CONTAINER_multihashmap_put (t->peers, &id.hashPubKey,
tree_set_status (t->tree, peer_info->id, MESH_PEER_READY);
send_client_peer_connected (t, peer_info->id);
}
+ if (NULL != peer_info->dhtget)
+ {
+ GNUNET_DHT_get_stop (peer_info->dhtget);
+ peer_info->dhtget = NULL;
+ }
return GNUNET_OK;
}
" not for us, retransmitting...\n");
GNUNET_PEER_resolve (tree_get_predecessor (t->tree), &id);
peer_info = peer_info_get (&msg->oid);
- if (NULL == peer_info)
- {
- /* If we know the tunnel, we should DEFINITELY know the peer */
- GNUNET_break (0);
- return GNUNET_OK;
- }
send_prebuilt_message (message, &id, t);
return GNUNET_OK;
}
static int
deregister_app (void *cls, const struct GNUNET_HashCode * key, void *value)
{
- struct GNUNET_CONTAINER_MultiHashMap *h = cls;
+ struct MeshClient *c = cls;
+
GNUNET_break (GNUNET_YES ==
- GNUNET_CONTAINER_multihashmap_remove (h, key, value));
+ GNUNET_CONTAINER_multihashmap_remove (applications, key, c));
return GNUNET_OK;
}
GNUNET_PEER_resolve (path_info->peer->id, &pi);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " for %s\n", GNUNET_i2s (&pi));
- p = path_build_from_dht (get_path, get_path_length, put_path,
- put_path_length);
+ p = path_build_from_dht (get_path, get_path_length,
+ put_path, put_path_length);
path_add_to_peers (p, GNUNET_NO);
- path_destroy(p);
+ path_destroy (p);
for (i = 0; i < path_info->peer->ntunnels; i++)
{
tunnel_add_peer (path_info->peer->tunnels[i], path_info->peer);
/* deregister clients applications */
if (NULL != c->apps)
{
- GNUNET_CONTAINER_multihashmap_iterate (c->apps, &deregister_app, c->apps);
+ GNUNET_CONTAINER_multihashmap_iterate (c->apps, &deregister_app, c);
GNUNET_CONTAINER_multihashmap_destroy (c->apps);
}
if (0 == GNUNET_CONTAINER_multihashmap_size (applications) &&
*resp = *msg;
resp->npeers = 0;
ctx.msg = resp;
- ctx.lookup = GNUNET_CONTAINER_multihashmap_create (4 * t->peers_total,
- GNUNET_YES);
+ ctx.lookup = GNUNET_CONTAINER_multihashmap_create (32, GNUNET_YES);
ctx.c = c;
/* Collect and send information */