diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2011-10-26 15:15:30 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2011-10-26 15:15:30 +0000 |
commit | 4a26bf8d9186f7e79076cbe6228d7b73258ec7b2 (patch) | |
tree | 573554759dedeb9e3ea8c4c35db7fdb198bfe3b6 /src | |
parent | 3c2468374a5b85e27b18bebed000cbb130ad8b79 (diff) | |
download | gnunet-4a26bf8d9186f7e79076cbe6228d7b73258ec7b2.tar.gz gnunet-4a26bf8d9186f7e79076cbe6228d7b73258ec7b2.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/transport/gnunet-service-transport_neighbours_fsm.c | 52 |
1 files changed, 50 insertions, 2 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours_fsm.c b/src/transport/gnunet-service-transport_neighbours_fsm.c index 16a321e40..e920580a9 100644 --- a/src/transport/gnunet-service-transport_neighbours_fsm.c +++ b/src/transport/gnunet-service-transport_neighbours_fsm.c | |||
@@ -949,6 +949,55 @@ send_connect_continuation (void *cls, | |||
949 | change_state(n, S_CONNECT_SENT); | 949 | change_state(n, S_CONNECT_SENT); |
950 | } | 950 | } |
951 | 951 | ||
952 | /** | ||
953 | * We tried to send a SESSION_CONNECT message to another peer. If this | ||
954 | * succeeded, we change the state. If it failed, we should tell | ||
955 | * ATS to not use this address anymore (until it is re-validated). | ||
956 | * | ||
957 | * @param cls the 'struct NeighbourMapEntry' | ||
958 | * @param success GNUNET_OK on success | ||
959 | */ | ||
960 | static void | ||
961 | send_connect_ack_continuation (void *cls, | ||
962 | const struct GNUNET_PeerIdentity * target, | ||
963 | int success) | ||
964 | |||
965 | { | ||
966 | struct NeighbourMapEntry *n = cls; | ||
967 | |||
968 | //FIMXE comeplete this | ||
969 | GNUNET_break (0); | ||
970 | return; | ||
971 | |||
972 | |||
973 | GNUNET_assert (n != NULL); | ||
974 | if (GNUNET_YES == n->in_disconnect) | ||
975 | return; /* neighbour is going away */ | ||
976 | if (GNUNET_YES != success) | ||
977 | { | ||
978 | #if DEBUG_TRANSPORT | ||
979 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
980 | "Failed to send CONNECT_MSG to peer `%4s' with plugin `%s' address '%s' session %X, asking ATS for new address \n", | ||
981 | GNUNET_i2s (&n->id), n->plugin_name, | ||
982 | (n->addrlen == 0) ? "<inbound>" : GST_plugins_a2s (n->plugin_name, | ||
983 | n->addr, | ||
984 | n->addrlen), | ||
985 | n->session); | ||
986 | #endif | ||
987 | change_state(n, S_NOT_CONNECTED); | ||
988 | |||
989 | GNUNET_ATS_address_destroyed (GST_ats, | ||
990 | &n->id, | ||
991 | n->plugin_name, | ||
992 | n->addr, | ||
993 | n->addrlen, | ||
994 | NULL); | ||
995 | |||
996 | GNUNET_ATS_suggest_address(GST_ats, &n->id); | ||
997 | return; | ||
998 | } | ||
999 | change_state(n, S_CONNECT_SENT); | ||
1000 | } | ||
952 | 1001 | ||
953 | /** | 1002 | /** |
954 | * For an existing neighbour record, set the active connection to | 1003 | * For an existing neighbour record, set the active connection to |
@@ -1051,8 +1100,7 @@ GST_neighbours_switch_to_address (const struct GNUNET_PeerIdentity *peer, | |||
1051 | connect_msg.reserved = htonl (0); | 1100 | connect_msg.reserved = htonl (0); |
1052 | connect_msg.timestamp = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ()); | 1101 | connect_msg.timestamp = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ()); |
1053 | 1102 | ||
1054 | ret = send_with_plugin(NULL, &n->id, (const void *) &connect_msg, msg_len, 0, GNUNET_TIME_UNIT_FOREVER_REL, session, plugin_name, address, address_len, GNUNET_YES, NULL, NULL); | 1103 | ret = send_with_plugin(NULL, &n->id, (const void *) &connect_msg, msg_len, 0, GNUNET_TIME_UNIT_FOREVER_REL, session, plugin_name, address, address_len, GNUNET_YES, &send_connect_ack_continuation, n); |
1055 | |||
1056 | if (ret == GNUNET_SYSERR) | 1104 | if (ret == GNUNET_SYSERR) |
1057 | { | 1105 | { |
1058 | change_state (n, S_NOT_CONNECTED); | 1106 | change_state (n, S_NOT_CONNECTED); |