diff options
Diffstat (limited to 'src/dv/gnunet-service-dv.c')
-rw-r--r-- | src/dv/gnunet-service-dv.c | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/src/dv/gnunet-service-dv.c b/src/dv/gnunet-service-dv.c index 7d86fc24c..60745070c 100644 --- a/src/dv/gnunet-service-dv.c +++ b/src/dv/gnunet-service-dv.c | |||
@@ -1349,13 +1349,13 @@ send_message_delayed (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1349 | */ | 1349 | */ |
1350 | static uint32_t | 1350 | static uint32_t |
1351 | get_atsi_distance (const struct GNUNET_ATS_Information *atsi, | 1351 | get_atsi_distance (const struct GNUNET_ATS_Information *atsi, |
1352 | unsigned int atsi_count) | 1352 | unsigned int atsi_count) |
1353 | { | 1353 | { |
1354 | unsigned int i; | 1354 | unsigned int i; |
1355 | 1355 | ||
1356 | for (i=0;i<atsi_count;i++) | 1356 | for (i = 0; i < atsi_count; i++) |
1357 | if (ntohl (atsi[i].type) == GNUNET_ATS_QUALITY_NET_DISTANCE) | 1357 | if (ntohl (atsi[i].type) == GNUNET_ATS_QUALITY_NET_DISTANCE) |
1358 | return ntohl (atsi->value); | 1358 | return ntohl (atsi->value); |
1359 | /* FIXME: we do not have distance data? Assume direct neighbor. */ | 1359 | /* FIXME: we do not have distance data? Assume direct neighbor. */ |
1360 | return DIRECT_NEIGHBOR_COST; | 1360 | return DIRECT_NEIGHBOR_COST; |
1361 | } | 1361 | } |
@@ -1369,14 +1369,14 @@ get_atsi_distance (const struct GNUNET_ATS_Information *atsi, | |||
1369 | */ | 1369 | */ |
1370 | static struct GNUNET_TIME_Relative | 1370 | static struct GNUNET_TIME_Relative |
1371 | get_atsi_latency (const struct GNUNET_ATS_Information *atsi, | 1371 | get_atsi_latency (const struct GNUNET_ATS_Information *atsi, |
1372 | unsigned int atsi_count) | 1372 | unsigned int atsi_count) |
1373 | { | 1373 | { |
1374 | unsigned int i; | 1374 | unsigned int i; |
1375 | 1375 | ||
1376 | for (i=0;i<atsi_count;i++) | 1376 | for (i = 0; i < atsi_count; i++) |
1377 | if (ntohl (atsi[i].type) == GNUNET_ATS_QUALITY_NET_DELAY) | 1377 | if (ntohl (atsi[i].type) == GNUNET_ATS_QUALITY_NET_DELAY) |
1378 | return GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, | 1378 | return GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, |
1379 | ntohl (atsi->value)); | 1379 | ntohl (atsi->value)); |
1380 | GNUNET_break (0); | 1380 | GNUNET_break (0); |
1381 | /* how can we not have latency data? */ | 1381 | /* how can we not have latency data? */ |
1382 | return GNUNET_TIME_UNIT_SECONDS; | 1382 | return GNUNET_TIME_UNIT_SECONDS; |
@@ -1398,7 +1398,7 @@ static int | |||
1398 | handle_dv_data_message (void *cls, const struct GNUNET_PeerIdentity *peer, | 1398 | handle_dv_data_message (void *cls, const struct GNUNET_PeerIdentity *peer, |
1399 | const struct GNUNET_MessageHeader *message, | 1399 | const struct GNUNET_MessageHeader *message, |
1400 | const struct GNUNET_ATS_Information *atsi, | 1400 | const struct GNUNET_ATS_Information *atsi, |
1401 | unsigned int atsi_count) | 1401 | unsigned int atsi_count) |
1402 | { | 1402 | { |
1403 | const p2p_dv_MESSAGE_Data *incoming = (const p2p_dv_MESSAGE_Data *) message; | 1403 | const p2p_dv_MESSAGE_Data *incoming = (const p2p_dv_MESSAGE_Data *) message; |
1404 | const struct GNUNET_MessageHeader *packed_message; | 1404 | const struct GNUNET_MessageHeader *packed_message; |
@@ -2076,14 +2076,13 @@ static int | |||
2076 | handle_dv_gossip_message (void *cls, const struct GNUNET_PeerIdentity *peer, | 2076 | handle_dv_gossip_message (void *cls, const struct GNUNET_PeerIdentity *peer, |
2077 | const struct GNUNET_MessageHeader *message, | 2077 | const struct GNUNET_MessageHeader *message, |
2078 | const struct GNUNET_ATS_Information *atsi, | 2078 | const struct GNUNET_ATS_Information *atsi, |
2079 | unsigned int atsi_count); | 2079 | unsigned int atsi_count); |
2080 | 2080 | ||
2081 | static int | 2081 | static int |
2082 | handle_dv_disconnect_message (void *cls, const struct GNUNET_PeerIdentity *peer, | 2082 | handle_dv_disconnect_message (void *cls, const struct GNUNET_PeerIdentity *peer, |
2083 | const struct GNUNET_MessageHeader *message, | 2083 | const struct GNUNET_MessageHeader *message, |
2084 | const struct GNUNET_ATS_Information | 2084 | const struct GNUNET_ATS_Information *atsi, |
2085 | *atsi, | 2085 | unsigned int atsi_count); |
2086 | unsigned int atsi_count); | ||
2087 | /** End forward declarations **/ | 2086 | /** End forward declarations **/ |
2088 | 2087 | ||
2089 | 2088 | ||
@@ -2658,10 +2657,10 @@ addUpdateNeighbor (const struct GNUNET_PeerIdentity *peer, | |||
2658 | atsi[1].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY); | 2657 | atsi[1].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY); |
2659 | atsi[1].value = | 2658 | atsi[1].value = |
2660 | htonl ((uint32_t) referrer->pending_messages[i]. | 2659 | htonl ((uint32_t) referrer->pending_messages[i]. |
2661 | latency.rel_value); | 2660 | latency.rel_value); |
2662 | handle_dv_data_message (NULL, &referrer->pending_messages[i].sender, | 2661 | handle_dv_data_message (NULL, &referrer->pending_messages[i].sender, |
2663 | referrer->pending_messages[i].message, | 2662 | referrer->pending_messages[i].message, atsi, |
2664 | atsi, 2); | 2663 | 2); |
2665 | GNUNET_free (referrer->pending_messages[i].message); | 2664 | GNUNET_free (referrer->pending_messages[i].message); |
2666 | referrer->pending_messages[i].sender_id = 0; | 2665 | referrer->pending_messages[i].sender_id = 0; |
2667 | } | 2666 | } |
@@ -2732,9 +2731,8 @@ addUpdateNeighbor (const struct GNUNET_PeerIdentity *peer, | |||
2732 | static int | 2731 | static int |
2733 | handle_dv_disconnect_message (void *cls, const struct GNUNET_PeerIdentity *peer, | 2732 | handle_dv_disconnect_message (void *cls, const struct GNUNET_PeerIdentity *peer, |
2734 | const struct GNUNET_MessageHeader *message, | 2733 | const struct GNUNET_MessageHeader *message, |
2735 | const struct GNUNET_ATS_Information | 2734 | const struct GNUNET_ATS_Information *atsi, |
2736 | *atsi, | 2735 | unsigned int atsi_count) |
2737 | unsigned int atsi_count) | ||
2738 | { | 2736 | { |
2739 | struct DirectNeighbor *referrer; | 2737 | struct DirectNeighbor *referrer; |
2740 | struct DistantNeighbor *distant; | 2738 | struct DistantNeighbor *distant; |
@@ -2784,7 +2782,7 @@ static int | |||
2784 | handle_dv_gossip_message (void *cls, const struct GNUNET_PeerIdentity *peer, | 2782 | handle_dv_gossip_message (void *cls, const struct GNUNET_PeerIdentity *peer, |
2785 | const struct GNUNET_MessageHeader *message, | 2783 | const struct GNUNET_MessageHeader *message, |
2786 | const struct GNUNET_ATS_Information *atsi, | 2784 | const struct GNUNET_ATS_Information *atsi, |
2787 | unsigned int atsi_count) | 2785 | unsigned int atsi_count) |
2788 | { | 2786 | { |
2789 | struct DirectNeighbor *referrer; | 2787 | struct DirectNeighbor *referrer; |
2790 | p2p_dv_MESSAGE_NeighborInfo *enc_message = | 2788 | p2p_dv_MESSAGE_NeighborInfo *enc_message = |
@@ -3087,7 +3085,7 @@ process_peerinfo (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
3087 | static void | 3085 | static void |
3088 | handle_core_connect (void *cls, const struct GNUNET_PeerIdentity *peer, | 3086 | handle_core_connect (void *cls, const struct GNUNET_PeerIdentity *peer, |
3089 | const struct GNUNET_ATS_Information *atsi, | 3087 | const struct GNUNET_ATS_Information *atsi, |
3090 | unsigned int atsi_count) | 3088 | unsigned int atsi_count) |
3091 | { | 3089 | { |
3092 | struct DirectNeighbor *neighbor; | 3090 | struct DirectNeighbor *neighbor; |
3093 | struct DistantNeighbor *about; | 3091 | struct DistantNeighbor *about; |
@@ -3294,8 +3292,8 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
3294 | GNUNET_SERVER_add_handlers (server, plugin_handlers); | 3292 | GNUNET_SERVER_add_handlers (server, plugin_handlers); |
3295 | coreAPI = GNUNET_CORE_connect (cfg, 1, NULL, /* FIXME: anything we want to pass around? */ | 3293 | coreAPI = GNUNET_CORE_connect (cfg, 1, NULL, /* FIXME: anything we want to pass around? */ |
3296 | &core_init, &handle_core_connect, | 3294 | &core_init, &handle_core_connect, |
3297 | &handle_core_disconnect, NULL, GNUNET_NO, | 3295 | &handle_core_disconnect, NULL, GNUNET_NO, NULL, |
3298 | NULL, GNUNET_NO, core_handlers); | 3296 | GNUNET_NO, core_handlers); |
3299 | 3297 | ||
3300 | if (coreAPI == NULL) | 3298 | if (coreAPI == NULL) |
3301 | return; | 3299 | return; |