diff options
Diffstat (limited to 'src/dht/dht_api.c')
-rw-r--r-- | src/dht/dht_api.c | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/src/dht/dht_api.c b/src/dht/dht_api.c index 66eaf1064..42ddc7b60 100644 --- a/src/dht/dht_api.c +++ b/src/dht/dht_api.c | |||
@@ -319,7 +319,7 @@ send_get_known_results (struct GNUNET_DHT_GetHandle *gh, | |||
319 | unsigned int max; | 319 | unsigned int max; |
320 | unsigned int transmission_offset; | 320 | unsigned int transmission_offset; |
321 | 321 | ||
322 | max = (GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (*msg)) | 322 | max = (GNUNET_MAX_MESSAGE_SIZE - sizeof (*msg)) |
323 | / sizeof (struct GNUNET_HashCode); | 323 | / sizeof (struct GNUNET_HashCode); |
324 | transmission_offset = transmission_offset_start; | 324 | transmission_offset = transmission_offset_start; |
325 | while (transmission_offset < gh->seen_results_end) | 325 | while (transmission_offset < gh->seen_results_end) |
@@ -503,7 +503,7 @@ check_monitor_get (void *cls, | |||
503 | uint16_t msize = ntohs (msg->header.size) - sizeof (*msg); | 503 | uint16_t msize = ntohs (msg->header.size) - sizeof (*msg); |
504 | 504 | ||
505 | if ( (plen > UINT16_MAX) || | 505 | if ( (plen > UINT16_MAX) || |
506 | (plen * sizeof (struct GNUNET_HashCode) != msize) ) | 506 | (plen * sizeof (struct GNUNET_PeerIdentity) != msize) ) |
507 | { | 507 | { |
508 | GNUNET_break (0); | 508 | GNUNET_break (0); |
509 | return GNUNET_SYSERR; | 509 | return GNUNET_SYSERR; |
@@ -704,9 +704,9 @@ check_client_result (void *cls, | |||
704 | sizeof (struct GNUNET_PeerIdentity) * (get_path_length + put_path_length); | 704 | sizeof (struct GNUNET_PeerIdentity) * (get_path_length + put_path_length); |
705 | if ( (msize < meta_length) || | 705 | if ( (msize < meta_length) || |
706 | (get_path_length > | 706 | (get_path_length > |
707 | GNUNET_SERVER_MAX_MESSAGE_SIZE / sizeof (struct GNUNET_PeerIdentity)) || | 707 | GNUNET_MAX_MESSAGE_SIZE / sizeof (struct GNUNET_PeerIdentity)) || |
708 | (put_path_length > | 708 | (put_path_length > |
709 | GNUNET_SERVER_MAX_MESSAGE_SIZE / sizeof (struct GNUNET_PeerIdentity)) ) | 709 | GNUNET_MAX_MESSAGE_SIZE / sizeof (struct GNUNET_PeerIdentity)) ) |
710 | { | 710 | { |
711 | GNUNET_break (0); | 711 | GNUNET_break (0); |
712 | return GNUNET_SYSERR; | 712 | return GNUNET_SYSERR; |
@@ -754,12 +754,25 @@ process_client_result (void *cls, | |||
754 | meta_length = | 754 | meta_length = |
755 | sizeof (struct GNUNET_PeerIdentity) * (get_path_length + put_path_length); | 755 | sizeof (struct GNUNET_PeerIdentity) * (get_path_length + put_path_length); |
756 | data_length = msize - meta_length; | 756 | data_length = msize - meta_length; |
757 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
758 | "Giving %u byte reply for %s to application\n", | ||
759 | (unsigned int) data_length, | ||
760 | GNUNET_h2s (key)); | ||
761 | put_path = (const struct GNUNET_PeerIdentity *) &crm[1]; | 757 | put_path = (const struct GNUNET_PeerIdentity *) &crm[1]; |
762 | get_path = &put_path[put_path_length]; | 758 | get_path = &put_path[put_path_length]; |
759 | { | ||
760 | char *pp; | ||
761 | char *gp; | ||
762 | |||
763 | gp = GNUNET_STRINGS_pp2s (get_path, | ||
764 | get_path_length); | ||
765 | pp = GNUNET_STRINGS_pp2s (put_path, | ||
766 | put_path_length); | ||
767 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
768 | "Giving %u byte reply for %s to application (GP: %s, PP: %s)\n", | ||
769 | (unsigned int) data_length, | ||
770 | GNUNET_h2s (key), | ||
771 | gp, | ||
772 | pp); | ||
773 | GNUNET_free (gp); | ||
774 | GNUNET_free (pp); | ||
775 | } | ||
763 | data = &get_path[get_path_length]; | 776 | data = &get_path[get_path_length]; |
764 | /* remember that we've seen this result */ | 777 | /* remember that we've seen this result */ |
765 | GNUNET_CRYPTO_hash (data, | 778 | GNUNET_CRYPTO_hash (data, |
@@ -985,8 +998,8 @@ GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle, | |||
985 | struct GNUNET_DHT_PutHandle *ph; | 998 | struct GNUNET_DHT_PutHandle *ph; |
986 | 999 | ||
987 | msize = sizeof (struct GNUNET_DHT_ClientPutMessage) + size; | 1000 | msize = sizeof (struct GNUNET_DHT_ClientPutMessage) + size; |
988 | if ((msize >= GNUNET_SERVER_MAX_MESSAGE_SIZE) || | 1001 | if ((msize >= GNUNET_MAX_MESSAGE_SIZE) || |
989 | (size >= GNUNET_SERVER_MAX_MESSAGE_SIZE)) | 1002 | (size >= GNUNET_MAX_MESSAGE_SIZE)) |
990 | { | 1003 | { |
991 | GNUNET_break (0); | 1004 | GNUNET_break (0); |
992 | return NULL; | 1005 | return NULL; |
@@ -1077,8 +1090,8 @@ GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle, | |||
1077 | size_t msize; | 1090 | size_t msize; |
1078 | 1091 | ||
1079 | msize = sizeof (struct GNUNET_DHT_ClientGetMessage) + xquery_size; | 1092 | msize = sizeof (struct GNUNET_DHT_ClientGetMessage) + xquery_size; |
1080 | if ((msize >= GNUNET_SERVER_MAX_MESSAGE_SIZE) || | 1093 | if ((msize >= GNUNET_MAX_MESSAGE_SIZE) || |
1081 | (xquery_size >= GNUNET_SERVER_MAX_MESSAGE_SIZE)) | 1094 | (xquery_size >= GNUNET_MAX_MESSAGE_SIZE)) |
1082 | { | 1095 | { |
1083 | GNUNET_break (0); | 1096 | GNUNET_break (0); |
1084 | return NULL; | 1097 | return NULL; |