aboutsummaryrefslogtreecommitdiff
path: root/src/dv
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-03-26 15:02:37 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-03-26 15:02:37 +0000
commitfec18deaff1382f2fc7598cb4a5c87865447ddda (patch)
tree7f3319f352f1b53efde2c4f66eb09297237f9339 /src/dv
parent916a78761f48b4fabf4fd7d3d93f12cb679f4bd6 (diff)
downloadgnunet-fec18deaff1382f2fc7598cb4a5c87865447ddda.tar.gz
gnunet-fec18deaff1382f2fc7598cb4a5c87865447ddda.zip
api change
Diffstat (limited to 'src/dv')
-rw-r--r--src/dv/gnunet-service-dv.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/dv/gnunet-service-dv.c b/src/dv/gnunet-service-dv.c
index 4479c0b08..8190ecc91 100644
--- a/src/dv/gnunet-service-dv.c
+++ b/src/dv/gnunet-service-dv.c
@@ -962,7 +962,8 @@ handle_direct_disconnect (struct DirectNeighbor *neighbor)
962 */ 962 */
963static void 963static void
964handle_ats_update (void *cls, 964handle_ats_update (void *cls,
965 const struct GNUNET_PeerIdentity *peer, 965 const struct GNUNET_HELLO_Address *address,
966 int active,
966 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, 967 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
967 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, 968 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
968 const struct GNUNET_ATS_Information *ats, 969 const struct GNUNET_ATS_Information *ats,
@@ -971,11 +972,12 @@ handle_ats_update (void *cls,
971 struct DirectNeighbor *neighbor; 972 struct DirectNeighbor *neighbor;
972 uint32_t distance; 973 uint32_t distance;
973 974
974 /* FIXME: ignore CB if this address is not the one that is in use! */ 975 if (GNUNET_NO == active)
976 return;
975 distance = get_atsi_distance (ats, ats_count); 977 distance = get_atsi_distance (ats, ats_count);
976 /* check if entry exists */ 978 /* check if entry exists */
977 neighbor = GNUNET_CONTAINER_multihashmap_get (direct_neighbors, 979 neighbor = GNUNET_CONTAINER_multihashmap_get (direct_neighbors,
978 &peer->hashPubKey); 980 &address->peer.hashPubKey);
979 if (NULL != neighbor) 981 if (NULL != neighbor)
980 { 982 {
981 if ( (DIRECT_NEIGHBOR_COST == neighbor->distance) && 983 if ( (DIRECT_NEIGHBOR_COST == neighbor->distance) &&
@@ -1002,10 +1004,10 @@ handle_ats_update (void *cls,
1002 return; 1004 return;
1003 } 1005 }
1004 neighbor = GNUNET_malloc (sizeof (struct DirectNeighbor)); 1006 neighbor = GNUNET_malloc (sizeof (struct DirectNeighbor));
1005 neighbor->peer = (*peer); 1007 neighbor->peer = address->peer;
1006 GNUNET_assert (GNUNET_YES == 1008 GNUNET_assert (GNUNET_YES ==
1007 GNUNET_CONTAINER_multihashmap_put (direct_neighbors, 1009 GNUNET_CONTAINER_multihashmap_put (direct_neighbors,
1008 &peer->hashPubKey, 1010 &address->peer.hashPubKey,
1009 neighbor, 1011 neighbor,
1010 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); 1012 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
1011 neighbor->connected = GNUNET_NO; /* not yet */ 1013 neighbor->connected = GNUNET_NO; /* not yet */
@@ -1699,7 +1701,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
1699 1701
1700 if (NULL == core_api) 1702 if (NULL == core_api)
1701 return; 1703 return;
1702 ats = GNUNET_ATS_performance_init (cfg, &handle_ats_update, NULL, NULL, NULL); 1704 ats = GNUNET_ATS_performance_init (cfg, &handle_ats_update, NULL);
1703 if (NULL == ats) 1705 if (NULL == ats)
1704 { 1706 {
1705 GNUNET_CORE_disconnect (core_api); 1707 GNUNET_CORE_disconnect (core_api);