diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-01-16 20:03:37 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2022-02-19 12:41:01 +0100 |
commit | e5f00fda52a45ebd22716debf0d9af36fb6fce0a (patch) | |
tree | 1bfbc2c21510fafc912bcb5a0c82b87418fc6248 /src/dht/gnunet-service-dht_neighbours.c | |
parent | 980eec8b79b63b445530cd42778a772e8a67b820 (diff) | |
download | gnunet-e5f00fda52a45ebd22716debf0d9af36fb6fce0a.tar.gz gnunet-e5f00fda52a45ebd22716debf0d9af36fb6fce0a.zip |
-DHT: get tests to pass
Diffstat (limited to 'src/dht/gnunet-service-dht_neighbours.c')
-rw-r--r-- | src/dht/gnunet-service-dht_neighbours.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c index fc025fa18..63307dea2 100644 --- a/src/dht/gnunet-service-dht_neighbours.c +++ b/src/dht/gnunet-service-dht_neighbours.c | |||
@@ -1604,6 +1604,7 @@ GDS_NEIGHBOURS_handle_reply (struct PeerInfo *pi, | |||
1604 | prm->header.type = htons (GNUNET_MESSAGE_TYPE_DHT_P2P_RESULT); | 1604 | prm->header.type = htons (GNUNET_MESSAGE_TYPE_DHT_P2P_RESULT); |
1605 | prm->header.size = htons (sizeof (buf)); | 1605 | prm->header.size = htons (sizeof (buf)); |
1606 | prm->type = htonl (bd->type); | 1606 | prm->type = htonl (bd->type); |
1607 | prm->reserved = htonl (0); | ||
1607 | prm->put_path_length = htonl (ppl); | 1608 | prm->put_path_length = htonl (ppl); |
1608 | prm->get_path_length = htonl (get_path_length); | 1609 | prm->get_path_length = htonl (get_path_length); |
1609 | prm->expiration_time = GNUNET_TIME_absolute_hton (bd->expiration_time); | 1610 | prm->expiration_time = GNUNET_TIME_absolute_hton (bd->expiration_time); |
@@ -1668,14 +1669,15 @@ check_dht_p2p_put (void *cls, | |||
1668 | /** | 1669 | /** |
1669 | * Core handler for p2p put requests. | 1670 | * Core handler for p2p put requests. |
1670 | * | 1671 | * |
1671 | * @param cls closure with the `struct PeerInfo` of the sender | 1672 | * @param cls closure with the `struct Target` of the sender |
1672 | * @param message message | 1673 | * @param message message |
1673 | */ | 1674 | */ |
1674 | static void | 1675 | static void |
1675 | handle_dht_p2p_put (void *cls, | 1676 | handle_dht_p2p_put (void *cls, |
1676 | const struct PeerPutMessage *put) | 1677 | const struct PeerPutMessage *put) |
1677 | { | 1678 | { |
1678 | struct PeerInfo *peer = cls; | 1679 | struct Target *t = cls; |
1680 | struct PeerInfo *peer = t->pi; | ||
1679 | uint16_t msize = ntohs (put->header.size); | 1681 | uint16_t msize = ntohs (put->header.size); |
1680 | enum GNUNET_DHT_RouteOption options | 1682 | enum GNUNET_DHT_RouteOption options |
1681 | = (enum GNUNET_DHT_RouteOption) ntohl (put->options); | 1683 | = (enum GNUNET_DHT_RouteOption) ntohl (put->options); |
@@ -1982,7 +1984,7 @@ handle_local_result (void *cls, | |||
1982 | /** | 1984 | /** |
1983 | * Check validity of p2p get request. | 1985 | * Check validity of p2p get request. |
1984 | * | 1986 | * |
1985 | * @param cls closure with the `struct PeerInfo` of the sender | 1987 | * @param cls closure with the `struct Target` of the sender |
1986 | * @param get the message | 1988 | * @param get the message |
1987 | * @return #GNUNET_OK if the message is well-formed | 1989 | * @return #GNUNET_OK if the message is well-formed |
1988 | */ | 1990 | */ |
@@ -2006,14 +2008,15 @@ check_dht_p2p_get (void *cls, | |||
2006 | /** | 2008 | /** |
2007 | * Core handler for p2p get requests. | 2009 | * Core handler for p2p get requests. |
2008 | * | 2010 | * |
2009 | * @param cls closure with the `struct PeerInfo` of the sender | 2011 | * @param cls closure with the `struct Target` of the sender |
2010 | * @param get the message | 2012 | * @param get the message |
2011 | */ | 2013 | */ |
2012 | static void | 2014 | static void |
2013 | handle_dht_p2p_get (void *cls, | 2015 | handle_dht_p2p_get (void *cls, |
2014 | const struct PeerGetMessage *get) | 2016 | const struct PeerGetMessage *get) |
2015 | { | 2017 | { |
2016 | struct PeerInfo *peer = cls; | 2018 | struct Target *t = cls; |
2019 | struct PeerInfo *peer = t->pi; | ||
2017 | uint16_t msize = ntohs (get->header.size); | 2020 | uint16_t msize = ntohs (get->header.size); |
2018 | uint32_t xquery_size = ntohl (get->xquery_size); | 2021 | uint32_t xquery_size = ntohl (get->xquery_size); |
2019 | uint32_t hop_count = ntohl (get->hop_count); | 2022 | uint32_t hop_count = ntohl (get->hop_count); |
@@ -2295,7 +2298,8 @@ static void | |||
2295 | handle_dht_p2p_result (void *cls, | 2298 | handle_dht_p2p_result (void *cls, |
2296 | const struct PeerResultMessage *prm) | 2299 | const struct PeerResultMessage *prm) |
2297 | { | 2300 | { |
2298 | struct PeerInfo *peer = cls; | 2301 | struct Target *t = cls; |
2302 | struct PeerInfo *peer = t->pi; | ||
2299 | uint16_t msize = ntohs (prm->header.size); | 2303 | uint16_t msize = ntohs (prm->header.size); |
2300 | uint32_t get_path_length = ntohl (prm->get_path_length); | 2304 | uint32_t get_path_length = ntohl (prm->get_path_length); |
2301 | struct GDS_DATACACHE_BlockData bd = { | 2305 | struct GDS_DATACACHE_BlockData bd = { |
@@ -2433,7 +2437,8 @@ static void | |||
2433 | handle_dht_p2p_hello (void *cls, | 2437 | handle_dht_p2p_hello (void *cls, |
2434 | const struct GNUNET_MessageHeader *hello) | 2438 | const struct GNUNET_MessageHeader *hello) |
2435 | { | 2439 | { |
2436 | struct PeerInfo *peer = cls; | 2440 | struct Target *t = cls; |
2441 | struct PeerInfo *peer = t->pi; | ||
2437 | 2442 | ||
2438 | GNUNET_free (peer->hello); | 2443 | GNUNET_free (peer->hello); |
2439 | peer->hello_size = 0; | 2444 | peer->hello_size = 0; |
@@ -2517,7 +2522,6 @@ GDS_NEIGHBOURS_broadcast (const struct GNUNET_MessageHeader *msg) | |||
2517 | if (count >= bucket_size) | 2522 | if (count >= bucket_size) |
2518 | break; /* we only consider first #bucket_size entries per bucket */ | 2523 | break; /* we only consider first #bucket_size entries per bucket */ |
2519 | count++; | 2524 | count++; |
2520 | GNUNET_break (0); | ||
2521 | do_send (pos, | 2525 | do_send (pos, |
2522 | msg); | 2526 | msg); |
2523 | } | 2527 | } |