diff options
author | Christian Grothoff <grothoff@gnunet.org> | 2022-03-12 04:01:02 +0100 |
---|---|---|
committer | Christian Grothoff <grothoff@gnunet.org> | 2022-03-12 04:01:02 +0100 |
commit | ff992f47e6528b00937c3951b812f6938e1ee21a (patch) | |
tree | 96917d63e24d2cc02b0e09a4e1dc29987541ffe8 /src/dht/gnunet-service-dht_neighbours.c | |
parent | 06f6791f2d55ab3a1b4ca4c3ba9ed5c315f8d79b (diff) | |
download | gnunet-ff992f47e6528b00937c3951b812f6938e1ee21a.tar.gz gnunet-ff992f47e6528b00937c3951b812f6938e1ee21a.zip |
revise block API to match latest DHT specs
Diffstat (limited to 'src/dht/gnunet-service-dht_neighbours.c')
-rw-r--r-- | src/dht/gnunet-service-dht_neighbours.c | 44 |
1 files changed, 20 insertions, 24 deletions
diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c index db4ecb34a..7e570d4f5 100644 --- a/src/dht/gnunet-service-dht_neighbours.c +++ b/src/dht/gnunet-service-dht_neighbours.c | |||
@@ -1821,6 +1821,16 @@ handle_dht_p2p_put (void *cls, | |||
1821 | GNUNET_NO); | 1821 | GNUNET_NO); |
1822 | return; | 1822 | return; |
1823 | } | 1823 | } |
1824 | if (GNUNET_NO == | ||
1825 | GNUNET_BLOCK_check_block (GDS_block_context, | ||
1826 | bd.type, | ||
1827 | bd.data, | ||
1828 | bd.data_size)) | ||
1829 | { | ||
1830 | GNUNET_break_op (0); | ||
1831 | return; | ||
1832 | } | ||
1833 | |||
1824 | GNUNET_STATISTICS_update (GDS_stats, | 1834 | GNUNET_STATISTICS_update (GDS_stats, |
1825 | "# P2P PUT requests received", | 1835 | "# P2P PUT requests received", |
1826 | 1, | 1836 | 1, |
@@ -1857,17 +1867,6 @@ handle_dht_p2p_put (void *cls, | |||
1857 | } | 1867 | } |
1858 | } | 1868 | } |
1859 | 1869 | ||
1860 | if (GNUNET_NO == | ||
1861 | GNUNET_BLOCK_check_block (GDS_block_context, | ||
1862 | bd.type, | ||
1863 | &bd.key, | ||
1864 | bd.data, | ||
1865 | bd.data_size)) | ||
1866 | { | ||
1867 | GNUNET_break_op (0); | ||
1868 | return; | ||
1869 | } | ||
1870 | |||
1871 | { | 1870 | { |
1872 | struct GNUNET_CONTAINER_BloomFilter *bf; | 1871 | struct GNUNET_CONTAINER_BloomFilter *bf; |
1873 | struct GNUNET_DHT_PathElement pp[putlen + 1]; | 1872 | struct GNUNET_DHT_PathElement pp[putlen + 1]; |
@@ -2465,6 +2464,15 @@ handle_dht_p2p_result (void *cls, | |||
2465 | bd.data_size = msize - (sizeof(struct PeerResultMessage) | 2464 | bd.data_size = msize - (sizeof(struct PeerResultMessage) |
2466 | + (get_path_length + bd.put_path_length) | 2465 | + (get_path_length + bd.put_path_length) |
2467 | * sizeof(struct GNUNET_DHT_PathElement)); | 2466 | * sizeof(struct GNUNET_DHT_PathElement)); |
2467 | if (GNUNET_OK != | ||
2468 | GNUNET_BLOCK_check_block (GDS_block_context, | ||
2469 | bd.type, | ||
2470 | bd.data, | ||
2471 | bd.data_size)) | ||
2472 | { | ||
2473 | GNUNET_break_op (0); | ||
2474 | return; | ||
2475 | } | ||
2468 | GNUNET_STATISTICS_update (GDS_stats, | 2476 | GNUNET_STATISTICS_update (GDS_stats, |
2469 | "# P2P RESULTS received", | 2477 | "# P2P RESULTS received", |
2470 | 1, | 2478 | 1, |
@@ -2475,7 +2483,6 @@ handle_dht_p2p_result (void *cls, | |||
2475 | GNUNET_NO); | 2483 | GNUNET_NO); |
2476 | { | 2484 | { |
2477 | enum GNUNET_GenericReturnValue ret; | 2485 | enum GNUNET_GenericReturnValue ret; |
2478 | const struct GNUNET_HashCode *pquery; | ||
2479 | 2486 | ||
2480 | ret = GNUNET_BLOCK_get_key (GDS_block_context, | 2487 | ret = GNUNET_BLOCK_get_key (GDS_block_context, |
2481 | bd.type, | 2488 | bd.type, |
@@ -2484,18 +2491,7 @@ handle_dht_p2p_result (void *cls, | |||
2484 | &bd.key); | 2491 | &bd.key); |
2485 | if (GNUNET_NO == ret) | 2492 | if (GNUNET_NO == ret) |
2486 | { | 2493 | { |
2487 | GNUNET_break_op (0); | 2494 | bd.key = prm->key; |
2488 | return; | ||
2489 | } | ||
2490 | pquery = (GNUNET_OK == ret) ? &bd.key : &prm->key; | ||
2491 | if (GNUNET_OK != | ||
2492 | GNUNET_BLOCK_check_block (GDS_block_context, | ||
2493 | bd.type, | ||
2494 | pquery, | ||
2495 | bd.data, | ||
2496 | bd.data_size)) | ||
2497 | { | ||
2498 | GNUNET_break_op (0); | ||
2499 | return; | 2495 | return; |
2500 | } | 2496 | } |
2501 | } | 2497 | } |