diff options
author | Bart Polot <bart@net.in.tum.de> | 2013-10-15 14:20:46 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2013-10-15 14:20:46 +0000 |
commit | 5f09226e9088614acbf3e915d8bd63afac46e464 (patch) | |
tree | c1ee34f7698e3343915f5c53622818b8ce295fa3 /src/mesh | |
parent | d3cc12ee5c871cdf4c32972925e1ea235c10e33f (diff) | |
download | gnunet-5f09226e9088614acbf3e915d8bd63afac46e464.tar.gz gnunet-5f09226e9088614acbf3e915d8bd63afac46e464.zip |
- fix new connection handler
Diffstat (limited to 'src/mesh')
-rw-r--r-- | src/mesh/gnunet-service-mesh_connection.c | 20 | ||||
-rw-r--r-- | src/mesh/gnunet-service-mesh_peer.c | 1 |
2 files changed, 19 insertions, 2 deletions
diff --git a/src/mesh/gnunet-service-mesh_connection.c b/src/mesh/gnunet-service-mesh_connection.c index a47a3b835..5ca287cb1 100644 --- a/src/mesh/gnunet-service-mesh_connection.c +++ b/src/mesh/gnunet-service-mesh_connection.c | |||
@@ -929,6 +929,23 @@ unregister_neighbors (struct MeshConnection *c) | |||
929 | } | 929 | } |
930 | 930 | ||
931 | 931 | ||
932 | /** | ||
933 | * Bind the connection to the peer and the tunnel to that peer. | ||
934 | * | ||
935 | * If the peer has no tunnel, create one. Update tunnel and connection | ||
936 | * data structres to reflect new status. | ||
937 | * | ||
938 | * @param c Connection. | ||
939 | * @param peer Peer. | ||
940 | */ | ||
941 | static void | ||
942 | add_to_peer (struct MeshConnection *c, struct MeshPeer *peer) | ||
943 | { | ||
944 | GMP_add_tunnel (peer); | ||
945 | c->t = GMP_get_tunnel (peer); | ||
946 | GMT_add_connection (c->t, c); | ||
947 | } | ||
948 | |||
932 | /******************************************************************************/ | 949 | /******************************************************************************/ |
933 | /******************************** API ***********************************/ | 950 | /******************************** API ***********************************/ |
934 | /******************************************************************************/ | 951 | /******************************************************************************/ |
@@ -1040,8 +1057,7 @@ GMC_handle_create (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1040 | LOG (GNUNET_ERROR_TYPE_DEBUG, " It's for us!\n"); | 1057 | LOG (GNUNET_ERROR_TYPE_DEBUG, " It's for us!\n"); |
1041 | GMP_add_path_to_origin (orig_peer, path, GNUNET_YES); | 1058 | GMP_add_path_to_origin (orig_peer, path, GNUNET_YES); |
1042 | 1059 | ||
1043 | GMP_add_tunnel (orig_peer); | 1060 | add_to_peer (c, orig_peer); |
1044 | GMP_add_connection (orig_peer, c); | ||
1045 | if (MESH_TUNNEL3_NEW == GMT_get_state (c->t)) | 1061 | if (MESH_TUNNEL3_NEW == GMT_get_state (c->t)) |
1046 | GMT_change_state (c->t, MESH_TUNNEL3_WAITING); | 1062 | GMT_change_state (c->t, MESH_TUNNEL3_WAITING); |
1047 | 1063 | ||
diff --git a/src/mesh/gnunet-service-mesh_peer.c b/src/mesh/gnunet-service-mesh_peer.c index 0127615c1..ff0d43813 100644 --- a/src/mesh/gnunet-service-mesh_peer.c +++ b/src/mesh/gnunet-service-mesh_peer.c | |||
@@ -1390,6 +1390,7 @@ GMP_is_neighbor (const struct MeshPeer *peer) | |||
1390 | 1390 | ||
1391 | /** | 1391 | /** |
1392 | * Create and initialize a new tunnel towards a peer, in case it has none. | 1392 | * Create and initialize a new tunnel towards a peer, in case it has none. |
1393 | * In case the peer already has a tunnel, nothing is done. | ||
1393 | * | 1394 | * |
1394 | * Does not generate any traffic, just creates the local data structures. | 1395 | * Does not generate any traffic, just creates the local data structures. |
1395 | * | 1396 | * |