aboutsummaryrefslogtreecommitdiff
path: root/src/dht/gnunet-service-dht_clients.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dht/gnunet-service-dht_clients.c')
-rw-r--r--src/dht/gnunet-service-dht_clients.c58
1 files changed, 37 insertions, 21 deletions
diff --git a/src/dht/gnunet-service-dht_clients.c b/src/dht/gnunet-service-dht_clients.c
index fdcc31f13..c0c0b9a33 100644
--- a/src/dht/gnunet-service-dht_clients.c
+++ b/src/dht/gnunet-service-dht_clients.c
@@ -917,13 +917,13 @@ forward_reply (void *cls,
917 917
918 LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG, 918 LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG,
919 "CLIENT-RESULT %s\n", 919 "CLIENT-RESULT %s\n",
920 GNUNET_h2s_full (&frc->bd->key)); 920 GNUNET_h2s_full (&bd->key));
921 if ( (record->type != GNUNET_BLOCK_TYPE_ANY) && 921 if ( (record->type != GNUNET_BLOCK_TYPE_ANY) &&
922 (record->type != frc->bd->type) ) 922 (record->type != bd->type) )
923 { 923 {
924 LOG (GNUNET_ERROR_TYPE_DEBUG, 924 LOG (GNUNET_ERROR_TYPE_DEBUG,
925 "Record type mismatch, not passing request for key %s to local client\n", 925 "Record type mismatch, not passing request for key %s to local client\n",
926 GNUNET_h2s (&frc->bd->key)); 926 GNUNET_h2s (&bd->key));
927 GNUNET_STATISTICS_update (GDS_stats, 927 GNUNET_STATISTICS_update (GDS_stats,
928 "# Key match, type mismatches in REPLY to CLIENT", 928 "# Key match, type mismatches in REPLY to CLIENT",
929 1, 929 1,
@@ -931,7 +931,7 @@ forward_reply (void *cls,
931 return GNUNET_YES; /* type mismatch */ 931 return GNUNET_YES; /* type mismatch */
932 } 932 }
933 if ( (0 == (record->msg_options & GNUNET_DHT_RO_FIND_APPROXIMATE)) && 933 if ( (0 == (record->msg_options & GNUNET_DHT_RO_FIND_APPROXIMATE)) &&
934 (0 != GNUNET_memcmp (&frc->bd->key, 934 (0 != GNUNET_memcmp (&bd->key,
935 query_hash)) ) 935 query_hash)) )
936 { 936 {
937 GNUNET_STATISTICS_update (GDS_stats, 937 GNUNET_STATISTICS_update (GDS_stats,
@@ -940,8 +940,8 @@ forward_reply (void *cls,
940 GNUNET_NO); 940 GNUNET_NO);
941 return GNUNET_YES; /* type mismatch */ 941 return GNUNET_YES; /* type mismatch */
942 } 942 }
943 GNUNET_CRYPTO_hash (frc->bd->data, 943 GNUNET_CRYPTO_hash (bd->data,
944 frc->bd->data_size, 944 bd->data_size,
945 &ch); 945 &ch);
946 for (unsigned int i = 0; i < record->seen_replies_count; i++) 946 for (unsigned int i = 0; i < record->seen_replies_count; i++)
947 if (0 == 947 if (0 ==
@@ -950,7 +950,7 @@ forward_reply (void *cls,
950 { 950 {
951 LOG (GNUNET_ERROR_TYPE_DEBUG, 951 LOG (GNUNET_ERROR_TYPE_DEBUG,
952 "Duplicate reply, not passing request for key %s to local client\n", 952 "Duplicate reply, not passing request for key %s to local client\n",
953 GNUNET_h2s (&frc->bd->key)); 953 GNUNET_h2s (&bd->key));
954 GNUNET_STATISTICS_update (GDS_stats, 954 GNUNET_STATISTICS_update (GDS_stats,
955 "# Duplicate REPLIES to CLIENT request dropped", 955 "# Duplicate REPLIES to CLIENT request dropped",
956 1, 956 1,
@@ -961,15 +961,15 @@ forward_reply (void *cls,
961 = GNUNET_BLOCK_check_reply (GDS_block_context, 961 = GNUNET_BLOCK_check_reply (GDS_block_context,
962 record->type, 962 record->type,
963 NULL, 963 NULL,
964 &frc->bd->key, 964 &bd->key,
965 record->xquery, 965 record->xquery,
966 record->xquery_size, 966 record->xquery_size,
967 frc->bd->data, 967 bd->data,
968 frc->bd->data_size); 968 bd->data_size);
969 LOG (GNUNET_ERROR_TYPE_DEBUG, 969 LOG (GNUNET_ERROR_TYPE_DEBUG,
970 "Evaluation result is %d for key %s for local client's query\n", 970 "Evaluation result is %d for key %s for local client's query\n",
971 (int) eval, 971 (int) eval,
972 GNUNET_h2s (&frc->bd->key)); 972 GNUNET_h2s (&bd->key));
973 switch (eval) 973 switch (eval)
974 { 974 {
975 case GNUNET_BLOCK_REPLY_OK_LAST: 975 case GNUNET_BLOCK_REPLY_OK_LAST:
@@ -996,19 +996,35 @@ forward_reply (void *cls,
996 "# RESULTS queued for clients", 996 "# RESULTS queued for clients",
997 1, 997 1,
998 GNUNET_NO); 998 GNUNET_NO);
999 xsize += (frc->get_path_length + frc->bd->put_path_length) 999 xsize += (frc->get_path_length + bd->put_path_length)
1000 * sizeof(struct GNUNET_DHT_PathElement); 1000 * sizeof(struct GNUNET_DHT_PathElement);
1001 if (truncated) 1001 if (truncated)
1002 xsize += sizeof (struct GNUNET_PeerIdentity); 1002 xsize += sizeof (struct GNUNET_PeerIdentity);
1003
1004#if SUPER_REDUNDANT_CHECK
1005 GNUNET_break (0 ==
1006 GNUNET_DHT_verify_path (bd->data,
1007 bd->data_size,
1008 bd->expiration_time,
1009 truncated
1010 ? &bd->trunc_peer
1011 : NULL,
1012 bd->put_path,
1013 bd->put_path_length,
1014 frc->get_path,
1015 frc->get_path_length,
1016 &GDS_my_identity));
1017#endif
1018
1003 env = GNUNET_MQ_msg_extra (reply, 1019 env = GNUNET_MQ_msg_extra (reply,
1004 xsize, 1020 xsize,
1005 GNUNET_MESSAGE_TYPE_DHT_CLIENT_RESULT); 1021 GNUNET_MESSAGE_TYPE_DHT_CLIENT_RESULT);
1006 reply->type = htonl (frc->bd->type); 1022 reply->type = htonl (bd->type);
1007 reply->options = htonl (bd->ro); 1023 reply->options = htonl (bd->ro);
1008 reply->get_path_length = htonl (frc->get_path_length); 1024 reply->get_path_length = htonl (frc->get_path_length);
1009 reply->put_path_length = htonl (frc->bd->put_path_length); 1025 reply->put_path_length = htonl (bd->put_path_length);
1010 reply->unique_id = record->unique_id; 1026 reply->unique_id = record->unique_id;
1011 reply->expiration = GNUNET_TIME_absolute_hton (frc->bd->expiration_time); 1027 reply->expiration = GNUNET_TIME_absolute_hton (bd->expiration_time);
1012 reply->key = *query_hash; 1028 reply->key = *query_hash;
1013 if (truncated) 1029 if (truncated)
1014 { 1030 {
@@ -1025,16 +1041,16 @@ forward_reply (void *cls,
1025 paths = (struct GNUNET_DHT_PathElement *) &reply[1]; 1041 paths = (struct GNUNET_DHT_PathElement *) &reply[1];
1026 } 1042 }
1027 GNUNET_memcpy (paths, 1043 GNUNET_memcpy (paths,
1028 frc->bd->put_path, 1044 bd->put_path,
1029 sizeof(struct GNUNET_DHT_PathElement) 1045 sizeof(struct GNUNET_DHT_PathElement)
1030 * frc->bd->put_path_length); 1046 * bd->put_path_length);
1031 GNUNET_memcpy (&paths[frc->bd->put_path_length], 1047 GNUNET_memcpy (&paths[bd->put_path_length],
1032 frc->get_path, 1048 frc->get_path,
1033 sizeof(struct GNUNET_DHT_PathElement) 1049 sizeof(struct GNUNET_DHT_PathElement)
1034 * frc->get_path_length); 1050 * frc->get_path_length);
1035 GNUNET_memcpy (&paths[frc->get_path_length + frc->bd->put_path_length], 1051 GNUNET_memcpy (&paths[frc->get_path_length + bd->put_path_length],
1036 frc->bd->data, 1052 bd->data,
1037 frc->bd->data_size); 1053 bd->data_size);
1038 LOG (GNUNET_ERROR_TYPE_DEBUG, 1054 LOG (GNUNET_ERROR_TYPE_DEBUG,
1039 "Sending reply to query %s for client %p\n", 1055 "Sending reply to query %s for client %p\n",
1040 GNUNET_h2s (query_hash), 1056 GNUNET_h2s (query_hash),