diff options
author | Bart Polot <bart@net.in.tum.de> | 2013-05-14 10:13:57 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2013-05-14 10:13:57 +0000 |
commit | f6ab8147a173a9dce1802ae7cbcdda4c1f35d375 (patch) | |
tree | 856225a69af87e4eb54786dfb2e33bb473318942 /src/mesh/gnunet-service-mesh-new.c | |
parent | 845c1c5a2825fb8120fab349ac22113396bb5eea (diff) | |
download | gnunet-f6ab8147a173a9dce1802ae7cbcdda4c1f35d375.tar.gz gnunet-f6ab8147a173a9dce1802ae7cbcdda4c1f35d375.zip |
- use faster hash for tunnel hashmaps
Diffstat (limited to 'src/mesh/gnunet-service-mesh-new.c')
-rw-r--r-- | src/mesh/gnunet-service-mesh-new.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/mesh/gnunet-service-mesh-new.c b/src/mesh/gnunet-service-mesh-new.c index 0fb4766ea..b24bbfefe 100644 --- a/src/mesh/gnunet-service-mesh-new.c +++ b/src/mesh/gnunet-service-mesh-new.c | |||
@@ -916,8 +916,6 @@ client_get (struct GNUNET_SERVER_Client *client) | |||
916 | /** | 916 | /** |
917 | * Deletes a tunnel from a client (either owner or destination). To be used on | 917 | * Deletes a tunnel from a client (either owner or destination). To be used on |
918 | * tunnel destroy. | 918 | * tunnel destroy. |
919 | * | ||
920 | * FIXME use fast hash | ||
921 | * | 919 | * |
922 | * @param c Client whose tunnel to delete. | 920 | * @param c Client whose tunnel to delete. |
923 | * @param t Tunnel which should be deleted. | 921 | * @param t Tunnel which should be deleted. |
@@ -929,7 +927,7 @@ client_delete_tunnel (struct MeshClient *c, struct MeshTunnel *t) | |||
929 | 927 | ||
930 | if (c == t->owner) | 928 | if (c == t->owner) |
931 | { | 929 | { |
932 | GNUNET_CRYPTO_hash(&t->local_tid, sizeof (MESH_TunnelNumber), &hash); | 930 | GMC_hash32 (t->local_tid, &hash); |
933 | GNUNET_assert (GNUNET_YES == | 931 | GNUNET_assert (GNUNET_YES == |
934 | GNUNET_CONTAINER_multihashmap_remove (c->own_tunnels, | 932 | GNUNET_CONTAINER_multihashmap_remove (c->own_tunnels, |
935 | &hash, | 933 | &hash, |
@@ -937,7 +935,7 @@ client_delete_tunnel (struct MeshClient *c, struct MeshTunnel *t) | |||
937 | } | 935 | } |
938 | else if (c == t->client) | 936 | else if (c == t->client) |
939 | { | 937 | { |
940 | GNUNET_CRYPTO_hash(&t->local_tid_dest, sizeof (MESH_TunnelNumber), &hash); | 938 | GMC_hash32 (t->local_tid_dest, &hash); |
941 | GNUNET_assert (GNUNET_YES == | 939 | GNUNET_assert (GNUNET_YES == |
942 | GNUNET_CONTAINER_multihashmap_remove (c->incoming_tunnels, | 940 | GNUNET_CONTAINER_multihashmap_remove (c->incoming_tunnels, |
943 | &hash, | 941 | &hash, |
@@ -1711,7 +1709,7 @@ tunnel_get_incoming (MESH_TunnelNumber tid) | |||
1711 | struct GNUNET_HashCode hash; | 1709 | struct GNUNET_HashCode hash; |
1712 | 1710 | ||
1713 | GNUNET_assert (tid >= GNUNET_MESH_LOCAL_TUNNEL_ID_SERV); | 1711 | GNUNET_assert (tid >= GNUNET_MESH_LOCAL_TUNNEL_ID_SERV); |
1714 | GNUNET_CRYPTO_hash (&tid, sizeof (MESH_TunnelNumber), &hash); | 1712 | GMC_hash32 (tid, &hash); |
1715 | return GNUNET_CONTAINER_multihashmap_get (incoming_tunnels, &hash); | 1713 | return GNUNET_CONTAINER_multihashmap_get (incoming_tunnels, &hash); |
1716 | } | 1714 | } |
1717 | 1715 | ||
@@ -1735,7 +1733,7 @@ tunnel_get_by_local_id (struct MeshClient *c, MESH_TunnelNumber tid) | |||
1735 | { | 1733 | { |
1736 | struct GNUNET_HashCode hash; | 1734 | struct GNUNET_HashCode hash; |
1737 | 1735 | ||
1738 | GNUNET_CRYPTO_hash (&tid, sizeof (MESH_TunnelNumber), &hash); | 1736 | GMC_hash32 (tid, &hash); |
1739 | return GNUNET_CONTAINER_multihashmap_get (c->own_tunnels, &hash); | 1737 | return GNUNET_CONTAINER_multihashmap_get (c->own_tunnels, &hash); |
1740 | } | 1738 | } |
1741 | } | 1739 | } |
@@ -2225,10 +2223,9 @@ tunnel_destroy (struct MeshTunnel *t) | |||
2225 | r = GNUNET_SYSERR; | 2223 | r = GNUNET_SYSERR; |
2226 | } | 2224 | } |
2227 | 2225 | ||
2228 | // FIXME use fast hash | ||
2229 | if (NULL != c) | 2226 | if (NULL != c) |
2230 | { | 2227 | { |
2231 | GNUNET_CRYPTO_hash (&t->local_tid, sizeof (MESH_TunnelNumber), &hash); | 2228 | GMC_hash32 (t->local_tid, &hash); |
2232 | if (GNUNET_YES != | 2229 | if (GNUNET_YES != |
2233 | GNUNET_CONTAINER_multihashmap_remove (c->own_tunnels, &hash, t)) | 2230 | GNUNET_CONTAINER_multihashmap_remove (c->own_tunnels, &hash, t)) |
2234 | { | 2231 | { |
@@ -2237,10 +2234,9 @@ tunnel_destroy (struct MeshTunnel *t) | |||
2237 | } | 2234 | } |
2238 | } | 2235 | } |
2239 | 2236 | ||
2240 | // FIXME use fast hash | ||
2241 | if (NULL != t->client) | 2237 | if (NULL != t->client) |
2242 | { | 2238 | { |
2243 | GNUNET_CRYPTO_hash (&t->local_tid_dest, sizeof (MESH_TunnelNumber), &hash); | 2239 | GMC_hash32 (t->local_tid_dest, &hash); |
2244 | if (GNUNET_YES != | 2240 | if (GNUNET_YES != |
2245 | GNUNET_CONTAINER_multihashmap_remove (c->incoming_tunnels, &hash, t)) | 2241 | GNUNET_CONTAINER_multihashmap_remove (c->incoming_tunnels, &hash, t)) |
2246 | { | 2242 | { |
@@ -2248,13 +2244,13 @@ tunnel_destroy (struct MeshTunnel *t) | |||
2248 | r = GNUNET_SYSERR; | 2244 | r = GNUNET_SYSERR; |
2249 | } | 2245 | } |
2250 | } | 2246 | } |
2251 | |||
2252 | if (GNUNET_YES != | 2247 | if (GNUNET_YES != |
2253 | GNUNET_CONTAINER_multihashmap_remove (incoming_tunnels, &hash, t)) | 2248 | GNUNET_CONTAINER_multihashmap_remove (incoming_tunnels, &hash, t)) |
2254 | { | 2249 | { |
2255 | GNUNET_break (0); | 2250 | GNUNET_break (0); |
2256 | r = GNUNET_SYSERR; | 2251 | r = GNUNET_SYSERR; |
2257 | } | 2252 | } |
2253 | |||
2258 | peer_cancel_queues (t->next_hop, t); | 2254 | peer_cancel_queues (t->next_hop, t); |
2259 | peer_cancel_queues (t->prev_hop, t); | 2255 | peer_cancel_queues (t->prev_hop, t); |
2260 | 2256 | ||
@@ -2352,7 +2348,7 @@ tunnel_new (GNUNET_PEER_Id owner, | |||
2352 | 2348 | ||
2353 | if (NULL != client) | 2349 | if (NULL != client) |
2354 | { | 2350 | { |
2355 | GNUNET_CRYPTO_hash (&t->local_tid, sizeof (MESH_TunnelNumber), &hash); | 2351 | GMC_hash32 (t->local_tid, &hash); |
2356 | if (GNUNET_OK != | 2352 | if (GNUNET_OK != |
2357 | GNUNET_CONTAINER_multihashmap_put (client->own_tunnels, &hash, t, | 2353 | GNUNET_CONTAINER_multihashmap_put (client->own_tunnels, &hash, t, |
2358 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)) | 2354 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)) |
@@ -3043,7 +3039,7 @@ handle_mesh_path_create (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
3043 | // FIXME end | 3039 | // FIXME end |
3044 | 3040 | ||
3045 | tunnel_reset_timeout (t); | 3041 | tunnel_reset_timeout (t); |
3046 | GNUNET_CRYPTO_hash (&t->local_tid_dest, sizeof (MESH_TunnelNumber), &hash); | 3042 | GMC_hash32 (t->local_tid_dest, &hash); |
3047 | if (GNUNET_OK != | 3043 | if (GNUNET_OK != |
3048 | GNUNET_CONTAINER_multihashmap_put (incoming_tunnels, &hash, t, | 3044 | GNUNET_CONTAINER_multihashmap_put (incoming_tunnels, &hash, t, |
3049 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) | 3045 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) |