diff options
Diffstat (limited to 'src/dht/gnunet-service-dht_neighbours.c')
-rw-r--r-- | src/dht/gnunet-service-dht_neighbours.c | 153 |
1 files changed, 120 insertions, 33 deletions
diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c index 773ad8983..7b1efff1f 100644 --- a/src/dht/gnunet-service-dht_neighbours.c +++ b/src/dht/gnunet-service-dht_neighbours.c | |||
@@ -870,6 +870,11 @@ handle_core_disconnect (void *cls, | |||
870 | GNUNET_CONTAINER_multipeermap_remove (all_connected_peers, | 870 | GNUNET_CONTAINER_multipeermap_remove (all_connected_peers, |
871 | peer, | 871 | peer, |
872 | to_remove)); | 872 | to_remove)); |
873 | if (0 == GNUNET_CONTAINER_multipeermap_size (all_connected_peers)) | ||
874 | { | ||
875 | GNUNET_SCHEDULER_cancel (find_peer_task); | ||
876 | find_peer_task = NULL; | ||
877 | } | ||
873 | GNUNET_CRYPTO_hash (peer, | 878 | GNUNET_CRYPTO_hash (peer, |
874 | sizeof (struct GNUNET_PeerIdentity), | 879 | sizeof (struct GNUNET_PeerIdentity), |
875 | &phash); | 880 | &phash); |
@@ -894,6 +899,9 @@ handle_core_disconnect (void *cls, | |||
894 | GNUNET_CONTAINER_DLL_remove (to_remove->head, | 899 | GNUNET_CONTAINER_DLL_remove (to_remove->head, |
895 | to_remove->tail, | 900 | to_remove->tail, |
896 | pos); | 901 | pos); |
902 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
903 | "Dropping message of type %u due to disconnect\n", | ||
904 | ntohs (pos->msg->type)); | ||
897 | discarded++; | 905 | discarded++; |
898 | GNUNET_free (pos); | 906 | GNUNET_free (pos); |
899 | } | 907 | } |
@@ -927,6 +935,9 @@ core_transmit_notify (void *cls, | |||
927 | size_t off; | 935 | size_t off; |
928 | size_t msize; | 936 | size_t msize; |
929 | 937 | ||
938 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
939 | "DHT ctn called with buffer of %u bytes\n", | ||
940 | (unsigned int) size); | ||
930 | peer->th = NULL; | 941 | peer->th = NULL; |
931 | while ((NULL != (pending = peer->head)) && | 942 | while ((NULL != (pending = peer->head)) && |
932 | (0 == GNUNET_TIME_absolute_get_remaining (pending->timeout).rel_value_us)) | 943 | (0 == GNUNET_TIME_absolute_get_remaining (pending->timeout).rel_value_us)) |
@@ -936,24 +947,35 @@ core_transmit_notify (void *cls, | |||
936 | ("# Messages dropped (CORE timeout)"), | 947 | ("# Messages dropped (CORE timeout)"), |
937 | 1, | 948 | 1, |
938 | GNUNET_NO); | 949 | GNUNET_NO); |
950 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
951 | "Dropping message of type %u due to timeout\n", | ||
952 | ntohs (pending->msg->type)); | ||
939 | peer->pending_count--; | 953 | peer->pending_count--; |
940 | GNUNET_CONTAINER_DLL_remove (peer->head, peer->tail, pending); | 954 | GNUNET_CONTAINER_DLL_remove (peer->head, |
955 | peer->tail, | ||
956 | pending); | ||
941 | GNUNET_free (pending); | 957 | GNUNET_free (pending); |
942 | } | 958 | } |
943 | if (NULL == pending) | 959 | if (NULL == pending) |
944 | { | 960 | { |
945 | /* no messages pending */ | 961 | /* no messages pending */ |
962 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
963 | "No messages pending\n"); | ||
946 | return 0; | 964 | return 0; |
947 | } | 965 | } |
948 | if (NULL == buf) | 966 | if (NULL == buf) |
949 | { | 967 | { |
968 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
969 | "Got NULL buffer, trying again\n"); | ||
950 | peer->th = | 970 | peer->th = |
951 | GNUNET_CORE_notify_transmit_ready (core_api, GNUNET_NO, | 971 | GNUNET_CORE_notify_transmit_ready (core_api, GNUNET_NO, |
952 | GNUNET_CORE_PRIO_BEST_EFFORT, | 972 | GNUNET_CORE_PRIO_BEST_EFFORT, |
953 | GNUNET_TIME_absolute_get_remaining | 973 | GNUNET_TIME_absolute_get_remaining |
954 | (pending->timeout), &peer->id, | 974 | (pending->timeout), |
975 | &peer->id, | ||
955 | ntohs (pending->msg->size), | 976 | ntohs (pending->msg->size), |
956 | &core_transmit_notify, peer); | 977 | &core_transmit_notify, |
978 | peer); | ||
957 | GNUNET_break (NULL != peer->th); | 979 | GNUNET_break (NULL != peer->th); |
958 | return 0; | 980 | return 0; |
959 | } | 981 | } |
@@ -965,7 +987,13 @@ core_transmit_notify (void *cls, | |||
965 | gettext_noop | 987 | gettext_noop |
966 | ("# Bytes transmitted to other peers"), msize, | 988 | ("# Bytes transmitted to other peers"), msize, |
967 | GNUNET_NO); | 989 | GNUNET_NO); |
968 | memcpy (&cbuf[off], pending->msg, msize); | 990 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
991 | "Transmitting message of type %u to %s\n", | ||
992 | ntohs (pending->msg->type), | ||
993 | GNUNET_i2s (&peer->id)); | ||
994 | memcpy (&cbuf[off], | ||
995 | pending->msg, | ||
996 | msize); | ||
969 | off += msize; | 997 | off += msize; |
970 | peer->pending_count--; | 998 | peer->pending_count--; |
971 | GNUNET_CONTAINER_DLL_remove (peer->head, | 999 | GNUNET_CONTAINER_DLL_remove (peer->head, |
@@ -973,6 +1001,11 @@ core_transmit_notify (void *cls, | |||
973 | pending); | 1001 | pending); |
974 | GNUNET_free (pending); | 1002 | GNUNET_free (pending); |
975 | } | 1003 | } |
1004 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1005 | "%u bytes fit in %u bytes available, next message is %u bytes\n", | ||
1006 | (unsigned int) off, | ||
1007 | (unsigned int) size, | ||
1008 | (NULL != peer->head) ? ntohs (peer->head->msg->size) : 0); | ||
976 | if (NULL != (pending = peer->head)) | 1009 | if (NULL != (pending = peer->head)) |
977 | { | 1010 | { |
978 | /* technically redundant, but easier to read and | 1011 | /* technically redundant, but easier to read and |
@@ -1006,7 +1039,10 @@ process_peer_queue (struct PeerInfo *peer) | |||
1006 | if (NULL == (pending = peer->head)) | 1039 | if (NULL == (pending = peer->head)) |
1007 | return; | 1040 | return; |
1008 | if (NULL != peer->th) | 1041 | if (NULL != peer->th) |
1009 | return; | 1042 | { |
1043 | GNUNET_CORE_notify_transmit_ready_cancel (peer->th); | ||
1044 | peer->th = NULL; | ||
1045 | } | ||
1010 | GNUNET_STATISTICS_update (GDS_stats, | 1046 | GNUNET_STATISTICS_update (GDS_stats, |
1011 | gettext_noop | 1047 | gettext_noop |
1012 | ("# Bytes of bandwidth requested from core"), | 1048 | ("# Bytes of bandwidth requested from core"), |
@@ -1445,7 +1481,8 @@ GDS_NEIGHBOURS_handle_put (enum GNUNET_BLOCK_Type type, | |||
1445 | GNUNET_assert (NULL != bf); | 1481 | GNUNET_assert (NULL != bf); |
1446 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1482 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1447 | "Adding myself (%s) to PUT bloomfilter for %s\n", | 1483 | "Adding myself (%s) to PUT bloomfilter for %s\n", |
1448 | GNUNET_i2s (&my_identity), GNUNET_h2s (key)); | 1484 | GNUNET_i2s (&my_identity), |
1485 | GNUNET_h2s (key)); | ||
1449 | GNUNET_CONTAINER_bloomfilter_add (bf, &my_identity_hash); | 1486 | GNUNET_CONTAINER_bloomfilter_add (bf, &my_identity_hash); |
1450 | GNUNET_STATISTICS_update (GDS_stats, gettext_noop ("# PUT requests routed"), | 1487 | GNUNET_STATISTICS_update (GDS_stats, gettext_noop ("# PUT requests routed"), |
1451 | 1, GNUNET_NO); | 1488 | 1, GNUNET_NO); |
@@ -1492,8 +1529,10 @@ GDS_NEIGHBOURS_handle_put (enum GNUNET_BLOCK_Type type, | |||
1492 | continue; | 1529 | continue; |
1493 | } | 1530 | } |
1494 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1531 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1495 | "Routing PUT for %s after %u hops to %s\n", GNUNET_h2s (key), | 1532 | "Routing PUT for %s after %u hops to %s\n", |
1496 | (unsigned int) hop_count, GNUNET_i2s (&target->id)); | 1533 | GNUNET_h2s (key), |
1534 | (unsigned int) hop_count, | ||
1535 | GNUNET_i2s (&target->id)); | ||
1497 | pending = GNUNET_malloc (sizeof (struct P2PPendingMessage) + msize); | 1536 | pending = GNUNET_malloc (sizeof (struct P2PPendingMessage) + msize); |
1498 | pending->importance = 0; /* FIXME */ | 1537 | pending->importance = 0; /* FIXME */ |
1499 | pending->timeout = expiration_time; | 1538 | pending->timeout = expiration_time; |
@@ -1521,10 +1560,15 @@ GDS_NEIGHBOURS_handle_put (enum GNUNET_BLOCK_Type type, | |||
1521 | pp = (struct GNUNET_PeerIdentity *) &ppm[1]; | 1560 | pp = (struct GNUNET_PeerIdentity *) &ppm[1]; |
1522 | memcpy (pp, put_path, | 1561 | memcpy (pp, put_path, |
1523 | sizeof (struct GNUNET_PeerIdentity) * put_path_length); | 1562 | sizeof (struct GNUNET_PeerIdentity) * put_path_length); |
1524 | memcpy (&pp[put_path_length], data, data_size); | 1563 | memcpy (&pp[put_path_length], |
1525 | GNUNET_CONTAINER_DLL_insert_tail (target->head, target->tail, pending); | 1564 | data, |
1565 | data_size); | ||
1566 | GNUNET_CONTAINER_DLL_insert_tail (target->head, | ||
1567 | target->tail, | ||
1568 | pending); | ||
1526 | target->pending_count++; | 1569 | target->pending_count++; |
1527 | process_peer_queue (target); | 1570 | if (pending == target->head) |
1571 | process_peer_queue (target); | ||
1528 | } | 1572 | } |
1529 | GNUNET_free (targets); | 1573 | GNUNET_free (targets); |
1530 | return (skip_count < target_count) ? GNUNET_OK : GNUNET_NO; | 1574 | return (skip_count < target_count) ? GNUNET_OK : GNUNET_NO; |
@@ -1579,8 +1623,10 @@ GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type, | |||
1579 | &targets); | 1623 | &targets); |
1580 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1624 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1581 | "Adding myself (%s) to GET bloomfilter for %s\n", | 1625 | "Adding myself (%s) to GET bloomfilter for %s\n", |
1582 | GNUNET_i2s (&my_identity), GNUNET_h2s (key)); | 1626 | GNUNET_i2s (&my_identity), |
1583 | GNUNET_CONTAINER_bloomfilter_add (peer_bf, &my_identity_hash); | 1627 | GNUNET_h2s (key)); |
1628 | GNUNET_CONTAINER_bloomfilter_add (peer_bf, | ||
1629 | &my_identity_hash); | ||
1584 | if (0 == target_count) | 1630 | if (0 == target_count) |
1585 | { | 1631 | { |
1586 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1632 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -1616,8 +1662,10 @@ GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type, | |||
1616 | continue; | 1662 | continue; |
1617 | } | 1663 | } |
1618 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1664 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1619 | "Routing GET for %s after %u hops to %s\n", GNUNET_h2s (key), | 1665 | "Routing GET for %s after %u hops to %s\n", |
1620 | (unsigned int) hop_count, GNUNET_i2s (&target->id)); | 1666 | GNUNET_h2s (key), |
1667 | (unsigned int) hop_count, | ||
1668 | GNUNET_i2s (&target->id)); | ||
1621 | pending = GNUNET_malloc (sizeof (struct P2PPendingMessage) + msize); | 1669 | pending = GNUNET_malloc (sizeof (struct P2PPendingMessage) + msize); |
1622 | pending->importance = 0; /* FIXME */ | 1670 | pending->importance = 0; /* FIXME */ |
1623 | pending->timeout = GNUNET_TIME_relative_to_absolute (GET_TIMEOUT); | 1671 | pending->timeout = GNUNET_TIME_relative_to_absolute (GET_TIMEOUT); |
@@ -1650,9 +1698,12 @@ GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type, | |||
1650 | &xq | 1698 | &xq |
1651 | [xquery_size], | 1699 | [xquery_size], |
1652 | reply_bf_size)); | 1700 | reply_bf_size)); |
1653 | GNUNET_CONTAINER_DLL_insert_tail (target->head, target->tail, pending); | 1701 | GNUNET_CONTAINER_DLL_insert_tail (target->head, |
1702 | target->tail, | ||
1703 | pending); | ||
1654 | target->pending_count++; | 1704 | target->pending_count++; |
1655 | process_peer_queue (target); | 1705 | if (pending == target->head) |
1706 | process_peer_queue (target); | ||
1656 | } | 1707 | } |
1657 | GNUNET_free (targets); | 1708 | GNUNET_free (targets); |
1658 | return (skip_count < target_count) ? GNUNET_OK : GNUNET_NO; | 1709 | return (skip_count < target_count) ? GNUNET_OK : GNUNET_NO; |
@@ -1712,16 +1763,28 @@ GDS_NEIGHBOURS_handle_reply (const struct GNUNET_PeerIdentity *target, | |||
1712 | if (NULL == pi) | 1763 | if (NULL == pi) |
1713 | { | 1764 | { |
1714 | /* peer disconnected in the meantime, drop reply */ | 1765 | /* peer disconnected in the meantime, drop reply */ |
1766 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1767 | "No matching peer for reply for key %s\n", | ||
1768 | GNUNET_h2s (key)); | ||
1715 | return; | 1769 | return; |
1716 | } | 1770 | } |
1717 | if (pi->pending_count >= MAXIMUM_PENDING_PER_PEER) | 1771 | if (pi->pending_count >= MAXIMUM_PENDING_PER_PEER) |
1718 | { | 1772 | { |
1719 | /* skip */ | 1773 | /* skip */ |
1720 | GNUNET_STATISTICS_update (GDS_stats, gettext_noop ("# P2P messages dropped due to full queue"), | 1774 | GNUNET_STATISTICS_update (GDS_stats, |
1721 | 1, GNUNET_NO); | 1775 | gettext_noop ("# P2P messages dropped due to full queue"), |
1776 | 1, | ||
1777 | GNUNET_NO); | ||
1778 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1779 | "Peer queue full, ignoring reply for key %s\n", | ||
1780 | GNUNET_h2s (key)); | ||
1722 | return; | 1781 | return; |
1723 | } | 1782 | } |
1724 | 1783 | ||
1784 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1785 | "Forwarding reply for key %s to peer %s\n", | ||
1786 | GNUNET_h2s (key), | ||
1787 | GNUNET_i2s (target)); | ||
1725 | GNUNET_STATISTICS_update (GDS_stats, | 1788 | GNUNET_STATISTICS_update (GDS_stats, |
1726 | gettext_noop | 1789 | gettext_noop |
1727 | ("# RESULT messages queued for transmission"), 1, | 1790 | ("# RESULT messages queued for transmission"), 1, |
@@ -1739,12 +1802,18 @@ GDS_NEIGHBOURS_handle_reply (const struct GNUNET_PeerIdentity *target, | |||
1739 | prm->expiration_time = GNUNET_TIME_absolute_hton (expiration_time); | 1802 | prm->expiration_time = GNUNET_TIME_absolute_hton (expiration_time); |
1740 | prm->key = *key; | 1803 | prm->key = *key; |
1741 | paths = (struct GNUNET_PeerIdentity *) &prm[1]; | 1804 | paths = (struct GNUNET_PeerIdentity *) &prm[1]; |
1742 | memcpy (paths, put_path, | 1805 | memcpy (paths, |
1806 | put_path, | ||
1743 | put_path_length * sizeof (struct GNUNET_PeerIdentity)); | 1807 | put_path_length * sizeof (struct GNUNET_PeerIdentity)); |
1744 | memcpy (&paths[put_path_length], get_path, | 1808 | memcpy (&paths[put_path_length], |
1809 | get_path, | ||
1745 | get_path_length * sizeof (struct GNUNET_PeerIdentity)); | 1810 | get_path_length * sizeof (struct GNUNET_PeerIdentity)); |
1746 | memcpy (&paths[put_path_length + get_path_length], data, data_size); | 1811 | memcpy (&paths[put_path_length + get_path_length], |
1747 | GNUNET_CONTAINER_DLL_insert (pi->head, pi->tail, pending); | 1812 | data, |
1813 | data_size); | ||
1814 | GNUNET_CONTAINER_DLL_insert (pi->head, | ||
1815 | pi->tail, | ||
1816 | pending); | ||
1748 | pi->pending_count++; | 1817 | pi->pending_count++; |
1749 | process_peer_queue (pi); | 1818 | process_peer_queue (pi); |
1750 | } | 1819 | } |
@@ -1760,10 +1829,14 @@ static void | |||
1760 | core_init (void *cls, | 1829 | core_init (void *cls, |
1761 | const struct GNUNET_PeerIdentity *identity) | 1830 | const struct GNUNET_PeerIdentity *identity) |
1762 | { | 1831 | { |
1832 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
1833 | "CORE called, I am %s\n", | ||
1834 | GNUNET_i2s (identity)); | ||
1763 | my_identity = *identity; | 1835 | my_identity = *identity; |
1764 | GNUNET_CRYPTO_hash (identity, | 1836 | GNUNET_CRYPTO_hash (identity, |
1765 | sizeof (struct GNUNET_PeerIdentity), | 1837 | sizeof (struct GNUNET_PeerIdentity), |
1766 | &my_identity_hash); | 1838 | &my_identity_hash); |
1839 | GDS_CLIENTS_init (); | ||
1767 | } | 1840 | } |
1768 | 1841 | ||
1769 | 1842 | ||
@@ -1778,7 +1851,8 @@ core_init (void *cls, | |||
1778 | * #GNUNET_SYSERR to close it (signal serious error) | 1851 | * #GNUNET_SYSERR to close it (signal serious error) |
1779 | */ | 1852 | */ |
1780 | static int | 1853 | static int |
1781 | handle_dht_p2p_put (void *cls, const struct GNUNET_PeerIdentity *peer, | 1854 | handle_dht_p2p_put (void *cls, |
1855 | const struct GNUNET_PeerIdentity *peer, | ||
1782 | const struct GNUNET_MessageHeader *message) | 1856 | const struct GNUNET_MessageHeader *message) |
1783 | { | 1857 | { |
1784 | const struct PeerPutMessage *put; | 1858 | const struct PeerPutMessage *put; |
@@ -1811,10 +1885,12 @@ handle_dht_p2p_put (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1811 | return GNUNET_YES; | 1885 | return GNUNET_YES; |
1812 | } | 1886 | } |
1813 | GNUNET_STATISTICS_update (GDS_stats, | 1887 | GNUNET_STATISTICS_update (GDS_stats, |
1814 | gettext_noop ("# P2P PUT requests received"), 1, | 1888 | gettext_noop ("# P2P PUT requests received"), |
1889 | 1, | ||
1815 | GNUNET_NO); | 1890 | GNUNET_NO); |
1816 | GNUNET_STATISTICS_update (GDS_stats, | 1891 | GNUNET_STATISTICS_update (GDS_stats, |
1817 | gettext_noop ("# P2P PUT bytes received"), msize, | 1892 | gettext_noop ("# P2P PUT bytes received"), |
1893 | msize, | ||
1818 | GNUNET_NO); | 1894 | GNUNET_NO); |
1819 | put_path = (const struct GNUNET_PeerIdentity *) &put[1]; | 1895 | put_path = (const struct GNUNET_PeerIdentity *) &put[1]; |
1820 | payload = &put_path[putlen]; | 1896 | payload = &put_path[putlen]; |
@@ -1833,10 +1909,14 @@ handle_dht_p2p_put (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1833 | tmp = GNUNET_strdup (GNUNET_i2s (&my_identity)); | 1909 | tmp = GNUNET_strdup (GNUNET_i2s (&my_identity)); |
1834 | LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG, | 1910 | LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG, |
1835 | "R5N PUT %s: %s->%s (%u, %u=>%u)\n", | 1911 | "R5N PUT %s: %s->%s (%u, %u=>%u)\n", |
1836 | GNUNET_h2s (&put->key), GNUNET_i2s (peer), tmp, | 1912 | GNUNET_h2s (&put->key), |
1913 | GNUNET_i2s (peer), | ||
1914 | tmp, | ||
1837 | ntohl(put->hop_count), | 1915 | ntohl(put->hop_count), |
1838 | GNUNET_CRYPTO_hash_matching_bits (&phash, &put->key), | 1916 | GNUNET_CRYPTO_hash_matching_bits (&phash, |
1839 | GNUNET_CRYPTO_hash_matching_bits (&my_identity_hash, &put->key) | 1917 | &put->key), |
1918 | GNUNET_CRYPTO_hash_matching_bits (&my_identity_hash, | ||
1919 | &put->key) | ||
1840 | ); | 1920 | ); |
1841 | GNUNET_free (tmp); | 1921 | GNUNET_free (tmp); |
1842 | } | 1922 | } |
@@ -1848,6 +1928,7 @@ handle_dht_p2p_put (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1848 | if (0 != memcmp (&test_key, &put->key, sizeof (struct GNUNET_HashCode))) | 1928 | if (0 != memcmp (&test_key, &put->key, sizeof (struct GNUNET_HashCode))) |
1849 | { | 1929 | { |
1850 | char *put_s = GNUNET_strdup (GNUNET_h2s_full (&put->key)); | 1930 | char *put_s = GNUNET_strdup (GNUNET_h2s_full (&put->key)); |
1931 | |||
1851 | GNUNET_break_op (0); | 1932 | GNUNET_break_op (0); |
1852 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1933 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
1853 | "PUT with key `%s' for block with key %s\n", | 1934 | "PUT with key `%s' for block with key %s\n", |
@@ -1889,7 +1970,8 @@ handle_dht_p2p_put (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1889 | } | 1970 | } |
1890 | } | 1971 | } |
1891 | 1972 | ||
1892 | bf = GNUNET_CONTAINER_bloomfilter_init (put->bloomfilter, DHT_BLOOM_SIZE, | 1973 | bf = GNUNET_CONTAINER_bloomfilter_init (put->bloomfilter, |
1974 | DHT_BLOOM_SIZE, | ||
1893 | GNUNET_CONSTANTS_BLOOMFILTER_K); | 1975 | GNUNET_CONSTANTS_BLOOMFILTER_K); |
1894 | GNUNET_break_op (GNUNET_YES == | 1976 | GNUNET_break_op (GNUNET_YES == |
1895 | GNUNET_CONTAINER_bloomfilter_test (bf, &phash)); | 1977 | GNUNET_CONTAINER_bloomfilter_test (bf, &phash)); |
@@ -2025,8 +2107,12 @@ handle_find_peer (const struct GNUNET_PeerIdentity *sender, | |||
2025 | return; /* no non-masked peer available */ | 2107 | return; /* no non-masked peer available */ |
2026 | if (peer == NULL) | 2108 | if (peer == NULL) |
2027 | peer = bucket->head; | 2109 | peer = bucket->head; |
2028 | GNUNET_CRYPTO_hash (&peer->id, sizeof (struct GNUNET_PeerIdentity), &phash); | 2110 | GNUNET_CRYPTO_hash (&peer->id, |
2029 | GNUNET_BLOCK_mingle_hash (&phash, bf_mutator, &mhash); | 2111 | sizeof (struct GNUNET_PeerIdentity), |
2112 | &phash); | ||
2113 | GNUNET_BLOCK_mingle_hash (&phash, | ||
2114 | bf_mutator, | ||
2115 | &mhash); | ||
2030 | hello = GDS_HELLO_get (&peer->id); | 2116 | hello = GDS_HELLO_get (&peer->id); |
2031 | } | 2117 | } |
2032 | while ((hello == NULL) || | 2118 | while ((hello == NULL) || |
@@ -2067,7 +2153,8 @@ handle_dht_p2p_get (void *cls, | |||
2067 | int forwarded; | 2153 | int forwarded; |
2068 | 2154 | ||
2069 | GNUNET_break (0 != | 2155 | GNUNET_break (0 != |
2070 | memcmp (peer, &my_identity, | 2156 | memcmp (peer, |
2157 | &my_identity, | ||
2071 | sizeof (struct GNUNET_PeerIdentity))); | 2158 | sizeof (struct GNUNET_PeerIdentity))); |
2072 | /* parse and validate message */ | 2159 | /* parse and validate message */ |
2073 | msize = ntohs (message->size); | 2160 | msize = ntohs (message->size); |