diff options
author | Bart Polot <bart@net.in.tum.de> | 2015-10-02 03:37:40 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2015-10-02 03:37:40 +0000 |
commit | 4a51a063b8a4ea7242e67f8eb3aaceea3667663b (patch) | |
tree | 7a1fac0fad9a432c0154213c829477a174c85efd | |
parent | d00dd9a2bdf4aacb7c289bfc6364b6f352004369 (diff) | |
download | gnunet-4a51a063b8a4ea7242e67f8eb3aaceea3667663b.tar.gz gnunet-4a51a063b8a4ea7242e67f8eb3aaceea3667663b.zip |
- don't connect twice on core_connect, as it may cause problems since connections hashmap is not yet created
-rw-r--r-- | src/cadet/gnunet-service-cadet_peer.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/cadet/gnunet-service-cadet_peer.c b/src/cadet/gnunet-service-cadet_peer.c index 98ac15a4b..d60858321 100644 --- a/src/cadet/gnunet-service-cadet_peer.c +++ b/src/cadet/gnunet-service-cadet_peer.c | |||
@@ -434,13 +434,15 @@ core_connect (void *cls, | |||
434 | path->peers[0] = myid; | 434 | path->peers[0] = myid; |
435 | GNUNET_PEER_change_rc (myid, 1); | 435 | GNUNET_PEER_change_rc (myid, 1); |
436 | GCP_add_path (neighbor, path, GNUNET_YES); | 436 | GCP_add_path (neighbor, path, GNUNET_YES); |
437 | |||
438 | GNUNET_assert (NULL == neighbor->connections); | ||
439 | neighbor->connections = GNUNET_CONTAINER_multihashmap_create (16, GNUNET_NO); | ||
440 | GNUNET_assert (NULL != neighbor->connections); | ||
441 | |||
437 | GNUNET_STATISTICS_update (stats, | 442 | GNUNET_STATISTICS_update (stats, |
438 | "# peers", | 443 | "# peers", |
439 | 1, | 444 | 1, |
440 | GNUNET_NO); | 445 | GNUNET_NO); |
441 | GNUNET_assert (NULL == neighbor->connections); | ||
442 | neighbor->connections = GNUNET_CONTAINER_multihashmap_create (16, GNUNET_NO); | ||
443 | GNUNET_assert (NULL != neighbor->connections); | ||
444 | 446 | ||
445 | if ( (NULL != GCP_get_tunnel (neighbor)) && | 447 | if ( (NULL != GCP_get_tunnel (neighbor)) && |
446 | (0 > GNUNET_CRYPTO_cmp_peer_identity (&my_full_id, peer)) ) | 448 | (0 > GNUNET_CRYPTO_cmp_peer_identity (&my_full_id, peer)) ) |
@@ -2000,6 +2002,7 @@ GCP_is_neighbor (const struct CadetPeer *peer) | |||
2000 | } | 2002 | } |
2001 | 2003 | ||
2002 | /* Is not a neighbor but connections is not NULL, probably disconnecting */ | 2004 | /* Is not a neighbor but connections is not NULL, probably disconnecting */ |
2005 | GNUNET_break (0); | ||
2003 | return GNUNET_NO; | 2006 | return GNUNET_NO; |
2004 | } | 2007 | } |
2005 | 2008 | ||
@@ -2151,7 +2154,8 @@ GCP_add_path (struct CadetPeer *peer, | |||
2151 | 2154 | ||
2152 | finish: | 2155 | finish: |
2153 | if (NULL != peer->tunnel | 2156 | if (NULL != peer->tunnel |
2154 | && CONNECTIONS_PER_TUNNEL > GCT_count_connections (peer->tunnel)) | 2157 | && CONNECTIONS_PER_TUNNEL > GCT_count_connections (peer->tunnel) |
2158 | && 2 < path->length) /* Direct paths are handled by core_connect */ | ||
2155 | { | 2159 | { |
2156 | GCP_connect (peer); | 2160 | GCP_connect (peer); |
2157 | } | 2161 | } |