diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mesh/gnunet-service-mesh_connection.c | 46 | ||||
-rw-r--r-- | src/mesh/gnunet-service-mesh_connection.h | 14 |
2 files changed, 44 insertions, 16 deletions
diff --git a/src/mesh/gnunet-service-mesh_connection.c b/src/mesh/gnunet-service-mesh_connection.c index e6c38f467..6947e4726 100644 --- a/src/mesh/gnunet-service-mesh_connection.c +++ b/src/mesh/gnunet-service-mesh_connection.c | |||
@@ -839,7 +839,7 @@ send_broken (struct MeshConnection *c, | |||
839 | * @param peer Peer to notify (neighbor who sent the connection). | 839 | * @param peer Peer to notify (neighbor who sent the connection). |
840 | */ | 840 | */ |
841 | static void | 841 | static void |
842 | send_broken2 (struct GNUNET_HashCode *connection_id, | 842 | send_broken2 (struct GNUNET_MeshHash *connection_id, |
843 | const struct GNUNET_PeerIdentity *id1, | 843 | const struct GNUNET_PeerIdentity *id1, |
844 | const struct GNUNET_PeerIdentity *id2, | 844 | const struct GNUNET_PeerIdentity *id2, |
845 | GNUNET_PEER_Id peer_id) | 845 | GNUNET_PEER_Id peer_id) |
@@ -847,8 +847,8 @@ send_broken2 (struct GNUNET_HashCode *connection_id, | |||
847 | struct GNUNET_MESH_ConnectionBroken *msg; | 847 | struct GNUNET_MESH_ConnectionBroken *msg; |
848 | struct MeshPeer *neighbor; | 848 | struct MeshPeer *neighbor; |
849 | 849 | ||
850 | LOG (GNUNET_ERROR_TYPE_INFO, | 850 | LOG (GNUNET_ERROR_TYPE_INFO, "=> BROKEN on unknown connection %s\n", |
851 | "Send BROKEN on unknown connection %s\n", GNUNET_h2s (connection_id)); | 851 | GNUNET_h2s (GM_h2hc (connection_id))); |
852 | 852 | ||
853 | msg = GNUNET_new (struct GNUNET_MESH_ConnectionBroken); | 853 | msg = GNUNET_new (struct GNUNET_MESH_ConnectionBroken); |
854 | msg->header.size = htons (sizeof (struct GNUNET_MESH_ConnectionBroken)); | 854 | msg->header.size = htons (sizeof (struct GNUNET_MESH_ConnectionBroken)); |
@@ -1480,10 +1480,11 @@ build_path_from_peer_ids (struct GNUNET_PeerIdentity *peers, | |||
1480 | static void | 1480 | static void |
1481 | log_message (const struct GNUNET_MessageHeader *message, | 1481 | log_message (const struct GNUNET_MessageHeader *message, |
1482 | const struct GNUNET_PeerIdentity *peer, | 1482 | const struct GNUNET_PeerIdentity *peer, |
1483 | const struct GNUNET_HashCode *hash) | 1483 | const struct GNUNET_MeshHash *hash) |
1484 | { | 1484 | { |
1485 | LOG (GNUNET_ERROR_TYPE_INFO, "<- %s on connection %s from %s\n", | 1485 | LOG (GNUNET_ERROR_TYPE_INFO, "<- %s on connection %s from %s\n", |
1486 | GM_m2s (ntohs (message->type)), GNUNET_h2s (hash), GNUNET_i2s (peer)); | 1486 | GM_m2s (ntohs (message->type)), GNUNET_h2s (GM_h2hc (hash)), |
1487 | GNUNET_i2s (peer)); | ||
1487 | } | 1488 | } |
1488 | 1489 | ||
1489 | /******************************************************************************/ | 1490 | /******************************************************************************/ |
@@ -1506,7 +1507,7 @@ GMC_handle_create (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1506 | { | 1507 | { |
1507 | struct GNUNET_MESH_ConnectionCreate *msg; | 1508 | struct GNUNET_MESH_ConnectionCreate *msg; |
1508 | struct GNUNET_PeerIdentity *id; | 1509 | struct GNUNET_PeerIdentity *id; |
1509 | struct GNUNET_HashCode *cid; | 1510 | struct GNUNET_MeshHash *cid; |
1510 | struct MeshPeerPath *path; | 1511 | struct MeshPeerPath *path; |
1511 | struct MeshPeer *dest_peer; | 1512 | struct MeshPeer *dest_peer; |
1512 | struct MeshPeer *orig_peer; | 1513 | struct MeshPeer *orig_peer; |
@@ -1891,8 +1892,8 @@ handle_mesh_encrypted (const struct GNUNET_PeerIdentity *peer, | |||
1891 | if (NULL == c) | 1892 | if (NULL == c) |
1892 | { | 1893 | { |
1893 | GNUNET_STATISTICS_update (stats, "# unknown connection", 1, GNUNET_NO); | 1894 | GNUNET_STATISTICS_update (stats, "# unknown connection", 1, GNUNET_NO); |
1894 | LOG (GNUNET_ERROR_TYPE_DEBUG, "WARNING enc on unknown connection %s\n", | 1895 | LOG (GNUNET_ERROR_TYPE_DEBUG, "enc on unknown connection %s\n", |
1895 | GNUNET_h2s (&msg->cid)); | 1896 | GNUNET_h2s (GM_h2hc (&msg->cid))); |
1896 | return GNUNET_OK; | 1897 | return GNUNET_OK; |
1897 | } | 1898 | } |
1898 | 1899 | ||
@@ -2016,7 +2017,7 @@ handle_mesh_kx (const struct GNUNET_PeerIdentity *peer, | |||
2016 | { | 2017 | { |
2017 | GNUNET_STATISTICS_update (stats, "# unknown connection", 1, GNUNET_NO); | 2018 | GNUNET_STATISTICS_update (stats, "# unknown connection", 1, GNUNET_NO); |
2018 | LOG (GNUNET_ERROR_TYPE_DEBUG, "kx on unknown connection %s\n", | 2019 | LOG (GNUNET_ERROR_TYPE_DEBUG, "kx on unknown connection %s\n", |
2019 | GNUNET_h2s (&msg->cid)); | 2020 | GNUNET_h2s (GM_h2hc (&msg->cid))); |
2020 | return GNUNET_OK; | 2021 | return GNUNET_OK; |
2021 | } | 2022 | } |
2022 | LOG (GNUNET_ERROR_TYPE_DEBUG, " on connection %s\n", GMC_2s (c)); | 2023 | LOG (GNUNET_ERROR_TYPE_DEBUG, " on connection %s\n", GMC_2s (c)); |
@@ -2219,7 +2220,7 @@ GMC_handle_poll (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
2219 | GNUNET_NO); | 2220 | GNUNET_NO); |
2220 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2221 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2221 | "WARNING POLL message on unknown connection %s!\n", | 2222 | "WARNING POLL message on unknown connection %s!\n", |
2222 | GNUNET_h2s (&msg->cid)); | 2223 | GNUNET_h2s (GM_h2hc (&msg->cid))); |
2223 | return GNUNET_OK; | 2224 | return GNUNET_OK; |
2224 | } | 2225 | } |
2225 | 2226 | ||
@@ -2391,7 +2392,7 @@ GMC_shutdown (void) | |||
2391 | 2392 | ||
2392 | 2393 | ||
2393 | struct MeshConnection * | 2394 | struct MeshConnection * |
2394 | GMC_new (const struct GNUNET_HashCode *cid, | 2395 | GMC_new (const struct GNUNET_MeshHash *cid, |
2395 | struct MeshTunnel3 *t, | 2396 | struct MeshTunnel3 *t, |
2396 | struct MeshPeerPath *p, | 2397 | struct MeshPeerPath *p, |
2397 | unsigned int own_pos) | 2398 | unsigned int own_pos) |
@@ -2402,7 +2403,7 @@ GMC_new (const struct GNUNET_HashCode *cid, | |||
2402 | c->id = *cid; | 2403 | c->id = *cid; |
2403 | GNUNET_assert (GNUNET_OK == | 2404 | GNUNET_assert (GNUNET_OK == |
2404 | GNUNET_CONTAINER_multihashmap_put (connections, | 2405 | GNUNET_CONTAINER_multihashmap_put (connections, |
2405 | &c->id, c, | 2406 | GMC_get_h (c), c, |
2406 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 2407 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); |
2407 | fc_init (&c->fwd_fc); | 2408 | fc_init (&c->fwd_fc); |
2408 | fc_init (&c->bck_fc); | 2409 | fc_init (&c->bck_fc); |
@@ -2494,7 +2495,8 @@ GMC_destroy (struct MeshConnection *c) | |||
2494 | } | 2495 | } |
2495 | 2496 | ||
2496 | GNUNET_break (GNUNET_YES == | 2497 | GNUNET_break (GNUNET_YES == |
2497 | GNUNET_CONTAINER_multihashmap_remove (connections, &c->id, c)); | 2498 | GNUNET_CONTAINER_multihashmap_remove (connections, |
2499 | GMC_get_h (c), c)); | ||
2498 | 2500 | ||
2499 | GNUNET_STATISTICS_update (stats, "# connections", -1, GNUNET_NO); | 2501 | GNUNET_STATISTICS_update (stats, "# connections", -1, GNUNET_NO); |
2500 | GNUNET_free (c); | 2502 | GNUNET_free (c); |
@@ -2515,6 +2517,20 @@ GMC_get_id (const struct MeshConnection *c) | |||
2515 | 2517 | ||
2516 | 2518 | ||
2517 | /** | 2519 | /** |
2520 | * Get the connection ID. | ||
2521 | * | ||
2522 | * @param c Connection to get the ID from. | ||
2523 | * | ||
2524 | * @return ID of the connection. | ||
2525 | */ | ||
2526 | const struct GNUNET_HashCode * | ||
2527 | GMC_get_h (const struct MeshConnection *c) | ||
2528 | { | ||
2529 | return GM_h2hc (&c->id); | ||
2530 | } | ||
2531 | |||
2532 | |||
2533 | /** | ||
2518 | * Get the connection path. | 2534 | * Get the connection path. |
2519 | * | 2535 | * |
2520 | * @param c Connection to get the path from. | 2536 | * @param c Connection to get the path from. |
@@ -3048,8 +3064,8 @@ GMC_2s (const struct MeshConnection *c) | |||
3048 | { | 3064 | { |
3049 | static char buf[128]; | 3065 | static char buf[128]; |
3050 | 3066 | ||
3051 | sprintf (buf, "%s (->%s)", GNUNET_h2s (&c->id), GMT_2s (c->t)); | 3067 | sprintf (buf, "%s (->%s)", GNUNET_h2s (GM_h2hc (GMC_get_id(c))), GMT_2s (c->t)); |
3052 | return buf; | 3068 | return buf; |
3053 | } | 3069 | } |
3054 | return GNUNET_h2s (&c->id); | 3070 | return GNUNET_h2s (GM_h2hc (&c->id)); |
3055 | } | 3071 | } |
diff --git a/src/mesh/gnunet-service-mesh_connection.h b/src/mesh/gnunet-service-mesh_connection.h index ec11cb8ab..f79117f2d 100644 --- a/src/mesh/gnunet-service-mesh_connection.h +++ b/src/mesh/gnunet-service-mesh_connection.h | |||
@@ -266,7 +266,7 @@ GMC_shutdown (void); | |||
266 | * @return Newly created connection, NULL in case of error (own id not in path). | 266 | * @return Newly created connection, NULL in case of error (own id not in path). |
267 | */ | 267 | */ |
268 | struct MeshConnection * | 268 | struct MeshConnection * |
269 | GMC_new (const struct GNUNET_HashCode *cid, | 269 | GMC_new (const struct GNUNET_MeshHash *cid, |
270 | struct MeshTunnel3 *t, | 270 | struct MeshTunnel3 *t, |
271 | struct MeshPeerPath *p, | 271 | struct MeshPeerPath *p, |
272 | unsigned int own_pos); | 272 | unsigned int own_pos); |
@@ -292,6 +292,18 @@ GMC_destroy (struct MeshConnection *c); | |||
292 | const struct GNUNET_MeshHash * | 292 | const struct GNUNET_MeshHash * |
293 | GMC_get_id (const struct MeshConnection *c); | 293 | GMC_get_id (const struct MeshConnection *c); |
294 | 294 | ||
295 | |||
296 | /** | ||
297 | * Get a hash for the connection ID. | ||
298 | * | ||
299 | * @param c Connection to get the hash. | ||
300 | * | ||
301 | * @return Hash expanded from the ID of the connection. | ||
302 | */ | ||
303 | const struct GNUNET_HashCode * | ||
304 | GMC_get_h (const struct MeshConnection *c); | ||
305 | |||
306 | |||
295 | /** | 307 | /** |
296 | * Get the connection path. | 308 | * Get the connection path. |
297 | * | 309 | * |