Compare commits
4 Commits
780a67a40d
...
bedbacddde
Author | SHA1 | Date | |
---|---|---|---|
bedbacddde | |||
cdc4284cb5 | |||
d6e5051b15 | |||
32a8dba185 |
@ -4,11 +4,9 @@ set -eux
|
||||
|
||||
git submodule update --init --recursive
|
||||
/src/workspace/tools/inject-repo c-toxcore
|
||||
# TODO(iphydf): Re-enable fuzz-test when https://github.com/tweag/rules_nixpkgs/issues/442 is fixed.
|
||||
cd /src/workspace && bazel test -k \
|
||||
--config=remote \
|
||||
--build_tag_filters=-haskell \
|
||||
--test_tag_filters=-haskell \
|
||||
--remote_download_minimal \
|
||||
--build_tag_filters=-haskell,-fuzz-test \
|
||||
--test_tag_filters=-haskell,-fuzz-test \
|
||||
-- \
|
||||
//c-toxcore/... \
|
||||
"$@"
|
||||
|
29
external/toxcore/c-toxcore/.circleci/config.yml
vendored
29
external/toxcore/c-toxcore/.circleci/config.yml
vendored
@ -7,11 +7,11 @@ workflows:
|
||||
jobs:
|
||||
# Dynamic analysis in the Bazel build
|
||||
- bazel-asan
|
||||
- bazel-msan
|
||||
- bazel-tsan
|
||||
# Dynamic analysis with CMake
|
||||
- asan
|
||||
- tsan
|
||||
- msan
|
||||
- ubsan
|
||||
# Static analysis
|
||||
- clang-analyze
|
||||
@ -29,6 +29,7 @@ jobs:
|
||||
steps:
|
||||
- checkout
|
||||
- run: .circleci/bazel-test
|
||||
//c-toxcore/...
|
||||
|
||||
bazel-tsan:
|
||||
working_directory: /tmp/cirrus-ci-build
|
||||
@ -38,11 +39,22 @@ jobs:
|
||||
steps:
|
||||
- checkout
|
||||
- run: .circleci/bazel-test
|
||||
//c-toxcore/...
|
||||
-//c-toxcore/auto_tests:conference_av_test
|
||||
-//c-toxcore/auto_tests:conference_test
|
||||
-//c-toxcore/auto_tests:onion_test
|
||||
-//c-toxcore/auto_tests:tox_many_test
|
||||
|
||||
bazel-msan:
|
||||
working_directory: /tmp/cirrus-ci-build
|
||||
docker:
|
||||
- image: toxchat/toktok-stack:latest-msan
|
||||
|
||||
steps:
|
||||
- checkout
|
||||
- run: .circleci/bazel-test
|
||||
//c-toxcore/auto_tests:lossless_packet_test
|
||||
|
||||
asan:
|
||||
working_directory: ~/work
|
||||
docker:
|
||||
@ -91,21 +103,6 @@ jobs:
|
||||
- run: git submodule update --init --recursive
|
||||
- run: CC=clang .circleci/cmake-ubsan
|
||||
|
||||
msan:
|
||||
working_directory: ~/work
|
||||
docker:
|
||||
- image: toxchat/toktok-stack:latest-msan
|
||||
|
||||
steps:
|
||||
- checkout
|
||||
- run: git submodule update --init --recursive
|
||||
- run: rm -rf /src/workspace/c-toxcore/* && mv * /src/workspace/c-toxcore/
|
||||
- run:
|
||||
cd /src/workspace && bazel test
|
||||
//c-toxcore/auto_tests:lossless_packet_test
|
||||
//c-toxcore/toxav/...
|
||||
//c-toxcore/toxcore/...
|
||||
|
||||
infer:
|
||||
working_directory: ~/work
|
||||
docker:
|
||||
|
8
external/toxcore/c-toxcore/.cirrus.yml
vendored
8
external/toxcore/c-toxcore/.cirrus.yml
vendored
@ -9,10 +9,9 @@ bazel-opt_task:
|
||||
- /src/workspace/tools/inject-repo c-toxcore
|
||||
test_all_script:
|
||||
- cd /src/workspace && bazel test -k
|
||||
--remote_http_cache=http://$CIRRUS_HTTP_CACHE_HOST
|
||||
--config=ci
|
||||
--build_tag_filters=-haskell
|
||||
--test_tag_filters=-haskell
|
||||
--remote_download_minimal
|
||||
--
|
||||
//c-toxcore/...
|
||||
-//c-toxcore/auto_tests:tcp_relay_test # TODO(robinlinden): Why does this pass locally but not in Cirrus?
|
||||
@ -27,10 +26,9 @@ bazel-dbg_task:
|
||||
- /src/workspace/tools/inject-repo c-toxcore
|
||||
test_all_script:
|
||||
- cd /src/workspace && bazel test -k
|
||||
--remote_http_cache=http://$CIRRUS_HTTP_CACHE_HOST
|
||||
--config=ci
|
||||
--build_tag_filters=-haskell
|
||||
--test_tag_filters=-haskell
|
||||
--remote_download_minimal
|
||||
--
|
||||
//c-toxcore/...
|
||||
-//c-toxcore/auto_tests:tcp_relay_test # TODO(robinlinden): Why does this pass locally but not in Cirrus?
|
||||
@ -45,7 +43,7 @@ cimple_task:
|
||||
- /src/workspace/tools/inject-repo c-toxcore
|
||||
test_all_script:
|
||||
- cd /src/workspace && bazel test -k
|
||||
--remote_http_cache=http://$CIRRUS_HTTP_CACHE_HOST
|
||||
--config=ci
|
||||
--build_tag_filters=haskell
|
||||
--test_tag_filters=haskell
|
||||
--
|
||||
|
@ -29,12 +29,26 @@ flaky_tests = {
|
||||
"tox_many_tcp_test": True,
|
||||
}
|
||||
|
||||
extra_args = {
|
||||
"proxy_test": ["$(location //c-toxcore/other/proxy)"],
|
||||
}
|
||||
|
||||
extra_data = {
|
||||
"proxy_test": ["//c-toxcore/other/proxy"],
|
||||
}
|
||||
|
||||
[cc_test(
|
||||
name = src[:-2],
|
||||
size = "small",
|
||||
srcs = [src],
|
||||
args = ["$(location %s)" % src] + ["$(location //c-toxcore/other/proxy)"],
|
||||
data = glob(["data/*"]) + ["//c-toxcore/other/proxy"],
|
||||
args = ["$(location %s)" % src] + extra_args.get(
|
||||
src[:-2],
|
||||
[],
|
||||
),
|
||||
data = glob(["data/*"]) + extra_data.get(
|
||||
src[:-2],
|
||||
[],
|
||||
),
|
||||
flaky = flaky_tests.get(
|
||||
src[:-2],
|
||||
False,
|
||||
|
@ -122,6 +122,12 @@ static void test_dht_getnodes(AutoTox *autotoxes)
|
||||
|
||||
tox_self_get_dht_id(autotoxes[i].tox, public_key_list[i]);
|
||||
tox_callback_dht_get_nodes_response(autotoxes[i].tox, getnodes_response_cb);
|
||||
|
||||
printf("Peer %zu dht closenode count total/annouce-capable: %d/%d\n",
|
||||
i,
|
||||
tox_dht_get_num_closelist(autotoxes[i].tox),
|
||||
tox_dht_get_num_closelist_announce_capable(autotoxes[i].tox)
|
||||
);
|
||||
}
|
||||
|
||||
while (!all_nodes_crawled(autotoxes, NUM_TOXES, public_key_list)) {
|
||||
|
@ -1 +1 @@
|
||||
4f5b47978dc26aed78719526f862a44693f821db12f5ff6d70b338d67fb6f784 /usr/local/bin/tox-bootstrapd
|
||||
9bec65f2a3093ebb49c3751dfad267482bc80d4b29ef9171f11d5ba53058d713 /usr/local/bin/tox-bootstrapd
|
||||
|
@ -306,7 +306,7 @@ void generate_event_impl(const std::string& event_name, std::vector<EventType> e
|
||||
f << " Tox_Event_" << event_name << " *event, Bin_Unpack *bu)\n{\n";
|
||||
f << " assert(event != nullptr);\n";
|
||||
if (event_types.size() > 1) {
|
||||
f << " if (!bin_unpack_array_fixed(bu, " << event_types.size() << ")) {\n return false;\n }\n\n";
|
||||
f << " if (!bin_unpack_array_fixed(bu, " << event_types.size() << ", nullptr)) {\n return false;\n }\n\n";
|
||||
}
|
||||
|
||||
bool first = true;
|
||||
|
@ -28,7 +28,7 @@ cc_library(
|
||||
|
||||
cc_fuzz_test(
|
||||
name = "bootstrap_fuzz_test",
|
||||
#size = "small",
|
||||
size = "small",
|
||||
srcs = ["bootstrap_harness.cc"],
|
||||
copts = ["-UNDEBUG"],
|
||||
corpus = ["//tools/toktok-fuzzer/corpus:bootstrap_fuzzer"],
|
||||
@ -43,7 +43,7 @@ cc_fuzz_test(
|
||||
|
||||
cc_fuzz_test(
|
||||
name = "e2e_fuzz_test",
|
||||
#size = "small",
|
||||
size = "small",
|
||||
srcs = ["e2e_fuzz_test.cc"],
|
||||
copts = ["-UNDEBUG"],
|
||||
corpus = ["//tools/toktok-fuzzer/corpus:e2e_fuzz_test"],
|
||||
@ -59,7 +59,7 @@ cc_fuzz_test(
|
||||
|
||||
cc_fuzz_test(
|
||||
name = "toxsave_fuzz_test",
|
||||
#size = "small",
|
||||
size = "small",
|
||||
srcs = ["toxsave_harness.cc"],
|
||||
copts = ["-UNDEBUG"],
|
||||
corpus = ["//tools/toktok-fuzzer/corpus:toxsave_fuzzer"],
|
||||
@ -92,7 +92,7 @@ fuzzing_binary(
|
||||
|
||||
cc_fuzz_test(
|
||||
name = "protodump_reduce",
|
||||
#size = "small",
|
||||
size = "small",
|
||||
srcs = ["protodump_reduce.cc"],
|
||||
copts = ["-UNDEBUG"],
|
||||
deps = [
|
||||
|
@ -22,6 +22,8 @@
|
||||
|
||||
const bool DEBUG = false;
|
||||
|
||||
static constexpr tox_mono_time_cb *get_self_clock = ![](Fuzz_System *self) { return self->clock; };
|
||||
|
||||
// TODO(iphydf): Put this somewhere shared.
|
||||
struct Network_Addr {
|
||||
struct sockaddr_storage addr;
|
||||
@ -182,7 +184,7 @@ Fuzz_System::Fuzz_System(Fuzz_Data &input)
|
||||
}
|
||||
, data(input)
|
||||
{
|
||||
sys->mono_time_callback = ![](Fuzz_System *self) { return self->clock; };
|
||||
sys->mono_time_callback = get_self_clock;
|
||||
sys->mono_time_user_data = this;
|
||||
sys->mem = mem.get();
|
||||
sys->ns = ns.get();
|
||||
@ -269,7 +271,7 @@ Null_System::Null_System()
|
||||
std::make_unique<Random>(Random{&null_random_funcs, this}),
|
||||
}
|
||||
{
|
||||
sys->mono_time_callback = ![](Fuzz_System *self) { return self->clock; };
|
||||
sys->mono_time_callback = get_self_clock;
|
||||
sys->mono_time_user_data = this;
|
||||
sys->mem = mem.get();
|
||||
sys->ns = ns.get();
|
||||
@ -400,7 +402,7 @@ Record_System::Record_System(Global &global, uint64_t seed, const char *name)
|
||||
, seed_(seed)
|
||||
, name_(name)
|
||||
{
|
||||
sys->mono_time_callback = ![](Fuzz_System *self) { return self->clock; };
|
||||
sys->mono_time_callback = get_self_clock;
|
||||
sys->mono_time_user_data = this;
|
||||
sys->mem = mem.get();
|
||||
sys->ns = ns.get();
|
||||
|
32
external/toxcore/c-toxcore/toxcore/DHT.c
vendored
32
external/toxcore/c-toxcore/toxcore/DHT.c
vendored
@ -533,8 +533,8 @@ int pack_nodes(const Logger *logger, uint8_t *data, uint16_t length, const Node_
|
||||
|
||||
#ifndef NDEBUG
|
||||
const uint32_t increment = ipp_size + CRYPTO_PUBLIC_KEY_SIZE;
|
||||
#endif
|
||||
assert(increment == PACKED_NODE_SIZE_IP4 || increment == PACKED_NODE_SIZE_IP6);
|
||||
#endif
|
||||
}
|
||||
|
||||
return packed_length;
|
||||
@ -565,8 +565,8 @@ int unpack_nodes(Node_format *nodes, uint16_t max_num_nodes, uint16_t *processed
|
||||
|
||||
#ifndef NDEBUG
|
||||
const uint32_t increment = ipp_size + CRYPTO_PUBLIC_KEY_SIZE;
|
||||
#endif
|
||||
assert(increment == PACKED_NODE_SIZE_IP4 || increment == PACKED_NODE_SIZE_IP6);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (processed_data_len != nullptr) {
|
||||
@ -2965,6 +2965,34 @@ bool dht_non_lan_connected(const DHT *dht)
|
||||
return false;
|
||||
}
|
||||
|
||||
uint16_t dht_get_num_closelist(const DHT *dht) {
|
||||
uint16_t num_valid_close_clients = 0;
|
||||
for (uint32_t i = 0; i < LCLIENT_LIST; ++i) {
|
||||
const Client_data *const client = dht_get_close_client(dht, i);
|
||||
|
||||
// check if client is valid
|
||||
if (!(assoc_timeout(dht->cur_time, &client->assoc4) && assoc_timeout(dht->cur_time, &client->assoc6))) {
|
||||
++num_valid_close_clients;
|
||||
}
|
||||
}
|
||||
|
||||
return num_valid_close_clients;
|
||||
}
|
||||
|
||||
uint16_t dht_get_num_closelist_announce_capable(const DHT *dht) {
|
||||
uint16_t num_valid_close_clients_with_cap = 0;
|
||||
for (uint32_t i = 0; i < LCLIENT_LIST; ++i) {
|
||||
const Client_data *const client = dht_get_close_client(dht, i);
|
||||
|
||||
// check if client is valid
|
||||
if (!(assoc_timeout(dht->cur_time, &client->assoc4) && assoc_timeout(dht->cur_time, &client->assoc6)) && client->announce_node) {
|
||||
++num_valid_close_clients_with_cap;
|
||||
}
|
||||
}
|
||||
|
||||
return num_valid_close_clients_with_cap;
|
||||
}
|
||||
|
||||
unsigned int ipport_self_copy(const DHT *dht, IP_Port *dest)
|
||||
{
|
||||
ipport_reset(dest);
|
||||
|
18
external/toxcore/c-toxcore/toxcore/DHT.h
vendored
18
external/toxcore/c-toxcore/toxcore/DHT.h
vendored
@ -515,6 +515,24 @@ bool dht_isconnected(const DHT *dht);
|
||||
non_null()
|
||||
bool dht_non_lan_connected(const DHT *dht);
|
||||
|
||||
/**
|
||||
* This function returns the ratio of close dht nodes that are known to support announce/store.
|
||||
* This function returns the number of DHT nodes in the closelist.
|
||||
*
|
||||
* @return number
|
||||
*/
|
||||
non_null()
|
||||
uint16_t dht_get_num_closelist(const DHT *dht);
|
||||
|
||||
/**
|
||||
* This function returns the number of DHT nodes in the closelist,
|
||||
* that are capable to store annouce data (introduced in version 0.2.18).
|
||||
*
|
||||
* @return number
|
||||
*/
|
||||
non_null()
|
||||
uint16_t dht_get_num_closelist_announce_capable(const DHT *dht);
|
||||
|
||||
/** @brief Attempt to add client with ip_port and public_key to the friends client list
|
||||
* and close_clientlist.
|
||||
*
|
||||
|
@ -2988,6 +2988,7 @@ static State_Load_Status load_nospam_keys(Messenger *m, const uint8_t *data, uin
|
||||
load_secret_key(m->net_crypto, data + sizeof(uint32_t) + CRYPTO_PUBLIC_KEY_SIZE);
|
||||
|
||||
if (!pk_equal(data + sizeof(uint32_t), nc_get_self_public_key(m->net_crypto))) {
|
||||
LOGGER_ERROR(m->log, "public key stored in savedata does not match its secret key");
|
||||
return STATE_LOAD_STATUS_ERROR;
|
||||
}
|
||||
|
||||
@ -3219,9 +3220,13 @@ static State_Load_Status groups_load(Messenger *m, const uint8_t *data, uint32_t
|
||||
|
||||
if (group_number < 0) {
|
||||
LOGGER_WARNING(m->log, "Failed to load group %u", i);
|
||||
// Can't recover trivially. We may need to skip over some data here.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
LOGGER_DEBUG(m->log, "Successfully loaded %u groups", gc_count_groups(m->group_handler));
|
||||
|
||||
bin_unpack_free(bu);
|
||||
|
||||
return STATE_LOAD_STATUS_CONTINUE;
|
||||
|
22
external/toxcore/c-toxcore/toxcore/bin_unpack.c
vendored
22
external/toxcore/c-toxcore/toxcore/bin_unpack.c
vendored
@ -73,10 +73,14 @@ bool bin_unpack_array(Bin_Unpack *bu, uint32_t *size)
|
||||
return cmp_read_array(&bu->ctx, size) && *size <= bu->bytes_size;
|
||||
}
|
||||
|
||||
bool bin_unpack_array_fixed(Bin_Unpack *bu, uint32_t required_size)
|
||||
bool bin_unpack_array_fixed(Bin_Unpack *bu, uint32_t required_size, uint32_t *actual_size)
|
||||
{
|
||||
uint32_t size;
|
||||
return cmp_read_array(&bu->ctx, &size) && size == required_size;
|
||||
uint32_t size = 0;
|
||||
const bool success = cmp_read_array(&bu->ctx, &size) && size == required_size;
|
||||
if (actual_size != nullptr) {
|
||||
*actual_size = size;
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
bool bin_unpack_bool(Bin_Unpack *bu, bool *val)
|
||||
@ -128,6 +132,18 @@ bool bin_unpack_bin(Bin_Unpack *bu, uint8_t **data_ptr, uint32_t *data_length_pt
|
||||
return true;
|
||||
}
|
||||
|
||||
bool bin_unpack_bin_max(Bin_Unpack *bu, uint8_t *data, uint16_t *data_length_ptr, uint16_t max_data_length)
|
||||
{
|
||||
uint32_t bin_size;
|
||||
if (!bin_unpack_bin_size(bu, &bin_size) || bin_size > max_data_length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
*data_length_ptr = bin_size;
|
||||
|
||||
return bin_unpack_bin_b(bu, data, bin_size);
|
||||
}
|
||||
|
||||
bool bin_unpack_bin_fixed(Bin_Unpack *bu, uint8_t *data, uint32_t data_length)
|
||||
{
|
||||
uint32_t bin_size;
|
||||
|
16
external/toxcore/c-toxcore/toxcore/bin_unpack.h
vendored
16
external/toxcore/c-toxcore/toxcore/bin_unpack.h
vendored
@ -45,10 +45,14 @@ void bin_unpack_free(Bin_Unpack *bu);
|
||||
non_null() bool bin_unpack_array(Bin_Unpack *bu, uint32_t *size);
|
||||
|
||||
/** @brief Start unpacking a fixed size MessagePack array.
|
||||
*
|
||||
* Fails if the array size is not the required size. If `actual_size` is passed a non-null
|
||||
* pointer, the array size is written there.
|
||||
*
|
||||
* @retval false if the packed array size is not exactly the required size.
|
||||
*/
|
||||
non_null() bool bin_unpack_array_fixed(Bin_Unpack *bu, uint32_t required_size);
|
||||
non_null(1) nullable(3)
|
||||
bool bin_unpack_array_fixed(Bin_Unpack *bu, uint32_t required_size, uint32_t *actual_size);
|
||||
|
||||
/** @brief Unpack a MessagePack bool. */
|
||||
non_null() bool bin_unpack_bool(Bin_Unpack *bu, bool *val);
|
||||
@ -71,10 +75,16 @@ non_null() bool bin_unpack_nil(Bin_Unpack *bu);
|
||||
* large allocation unless the input array was already that large.
|
||||
*/
|
||||
non_null() bool bin_unpack_bin(Bin_Unpack *bu, uint8_t **data_ptr, uint32_t *data_length_ptr);
|
||||
/** @brief Unpack a variable size MessagePack bin into a fixed size byte array.
|
||||
*
|
||||
* Stores unpacked data into `data` with its length stored in `data_length_ptr`. This function does
|
||||
* not allocate memory and requires that `max_data_length` is less than or equal to `sizeof(arr)`
|
||||
* when `arr` is passed as `data` pointer.
|
||||
*/
|
||||
non_null() bool bin_unpack_bin_max(Bin_Unpack *bu, uint8_t *data, uint16_t *data_length_ptr, uint16_t max_data_length);
|
||||
/** @brief Unpack a MessagePack bin of a fixed length into a pre-allocated byte array.
|
||||
*
|
||||
* Unlike the function above, this function does not allocate any memory, but requires the size to
|
||||
* be known up front.
|
||||
* Similar to the function above, but doesn't output the data length.
|
||||
*/
|
||||
non_null() bool bin_unpack_bin_fixed(Bin_Unpack *bu, uint8_t *data, uint32_t data_length);
|
||||
|
||||
|
@ -120,7 +120,7 @@ static bool tox_event_conference_invite_unpack(
|
||||
Tox_Event_Conference_Invite *event, Bin_Unpack *bu)
|
||||
{
|
||||
assert(event != nullptr);
|
||||
if (!bin_unpack_array_fixed(bu, 3)) {
|
||||
if (!bin_unpack_array_fixed(bu, 3, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ static bool tox_event_conference_message_unpack(
|
||||
Tox_Event_Conference_Message *event, Bin_Unpack *bu)
|
||||
{
|
||||
assert(event != nullptr);
|
||||
if (!bin_unpack_array_fixed(bu, 4)) {
|
||||
if (!bin_unpack_array_fixed(bu, 4, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ static bool tox_event_conference_peer_name_unpack(
|
||||
Tox_Event_Conference_Peer_Name *event, Bin_Unpack *bu)
|
||||
{
|
||||
assert(event != nullptr);
|
||||
if (!bin_unpack_array_fixed(bu, 3)) {
|
||||
if (!bin_unpack_array_fixed(bu, 3, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ static bool tox_event_conference_title_unpack(
|
||||
Tox_Event_Conference_Title *event, Bin_Unpack *bu)
|
||||
{
|
||||
assert(event != nullptr);
|
||||
if (!bin_unpack_array_fixed(bu, 3)) {
|
||||
if (!bin_unpack_array_fixed(bu, 3, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ static bool tox_event_file_chunk_request_unpack(
|
||||
Tox_Event_File_Chunk_Request *event, Bin_Unpack *bu)
|
||||
{
|
||||
assert(event != nullptr);
|
||||
if (!bin_unpack_array_fixed(bu, 4)) {
|
||||
if (!bin_unpack_array_fixed(bu, 4, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ static bool tox_event_file_recv_unpack(
|
||||
Tox_Event_File_Recv *event, Bin_Unpack *bu)
|
||||
{
|
||||
assert(event != nullptr);
|
||||
if (!bin_unpack_array_fixed(bu, 5)) {
|
||||
if (!bin_unpack_array_fixed(bu, 5, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ static bool tox_event_file_recv_chunk_unpack(
|
||||
Tox_Event_File_Recv_Chunk *event, Bin_Unpack *bu)
|
||||
{
|
||||
assert(event != nullptr);
|
||||
if (!bin_unpack_array_fixed(bu, 4)) {
|
||||
if (!bin_unpack_array_fixed(bu, 4, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ static bool tox_event_file_recv_control_unpack(
|
||||
Tox_Event_File_Recv_Control *event, Bin_Unpack *bu)
|
||||
{
|
||||
assert(event != nullptr);
|
||||
if (!bin_unpack_array_fixed(bu, 3)) {
|
||||
if (!bin_unpack_array_fixed(bu, 3, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ static bool tox_event_friend_connection_status_unpack(
|
||||
Tox_Event_Friend_Connection_Status *event, Bin_Unpack *bu)
|
||||
{
|
||||
assert(event != nullptr);
|
||||
if (!bin_unpack_array_fixed(bu, 2)) {
|
||||
if (!bin_unpack_array_fixed(bu, 2, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ static bool tox_event_friend_lossless_packet_unpack(
|
||||
Tox_Event_Friend_Lossless_Packet *event, Bin_Unpack *bu)
|
||||
{
|
||||
assert(event != nullptr);
|
||||
if (!bin_unpack_array_fixed(bu, 2)) {
|
||||
if (!bin_unpack_array_fixed(bu, 2, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ static bool tox_event_friend_lossy_packet_unpack(
|
||||
Tox_Event_Friend_Lossy_Packet *event, Bin_Unpack *bu)
|
||||
{
|
||||
assert(event != nullptr);
|
||||
if (!bin_unpack_array_fixed(bu, 2)) {
|
||||
if (!bin_unpack_array_fixed(bu, 2, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ static bool tox_event_friend_message_unpack(
|
||||
Tox_Event_Friend_Message *event, Bin_Unpack *bu)
|
||||
{
|
||||
assert(event != nullptr);
|
||||
if (!bin_unpack_array_fixed(bu, 3)) {
|
||||
if (!bin_unpack_array_fixed(bu, 3, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ static bool tox_event_friend_name_unpack(
|
||||
Tox_Event_Friend_Name *event, Bin_Unpack *bu)
|
||||
{
|
||||
assert(event != nullptr);
|
||||
if (!bin_unpack_array_fixed(bu, 2)) {
|
||||
if (!bin_unpack_array_fixed(bu, 2, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ static bool tox_event_friend_read_receipt_unpack(
|
||||
Tox_Event_Friend_Read_Receipt *event, Bin_Unpack *bu)
|
||||
{
|
||||
assert(event != nullptr);
|
||||
if (!bin_unpack_array_fixed(bu, 2)) {
|
||||
if (!bin_unpack_array_fixed(bu, 2, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ static bool tox_event_friend_request_unpack(
|
||||
Tox_Event_Friend_Request *event, Bin_Unpack *bu)
|
||||
{
|
||||
assert(event != nullptr);
|
||||
if (!bin_unpack_array_fixed(bu, 2)) {
|
||||
if (!bin_unpack_array_fixed(bu, 2, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ static bool tox_event_friend_status_unpack(
|
||||
Tox_Event_Friend_Status *event, Bin_Unpack *bu)
|
||||
{
|
||||
assert(event != nullptr);
|
||||
if (!bin_unpack_array_fixed(bu, 2)) {
|
||||
if (!bin_unpack_array_fixed(bu, 2, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ static bool tox_event_friend_status_message_unpack(
|
||||
Tox_Event_Friend_Status_Message *event, Bin_Unpack *bu)
|
||||
{
|
||||
assert(event != nullptr);
|
||||
if (!bin_unpack_array_fixed(bu, 2)) {
|
||||
if (!bin_unpack_array_fixed(bu, 2, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ static bool tox_event_friend_typing_unpack(
|
||||
Tox_Event_Friend_Typing *event, Bin_Unpack *bu)
|
||||
{
|
||||
assert(event != nullptr);
|
||||
if (!bin_unpack_array_fixed(bu, 2)) {
|
||||
if (!bin_unpack_array_fixed(bu, 2, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ static bool tox_event_group_custom_packet_unpack(
|
||||
Tox_Event_Group_Custom_Packet *event, Bin_Unpack *bu)
|
||||
{
|
||||
assert(event != nullptr);
|
||||
if (!bin_unpack_array_fixed(bu, 3)) {
|
||||
if (!bin_unpack_array_fixed(bu, 3, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ static bool tox_event_group_custom_private_packet_unpack(
|
||||
Tox_Event_Group_Custom_Private_Packet *event, Bin_Unpack *bu)
|
||||
{
|
||||
assert(event != nullptr);
|
||||
if (!bin_unpack_array_fixed(bu, 3)) {
|
||||
if (!bin_unpack_array_fixed(bu, 3, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,7 @@ static bool tox_event_group_invite_unpack(
|
||||
Tox_Event_Group_Invite *event, Bin_Unpack *bu)
|
||||
{
|
||||
assert(event != nullptr);
|
||||
if (!bin_unpack_array_fixed(bu, 3)) {
|
||||
if (!bin_unpack_array_fixed(bu, 3, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ static bool tox_event_group_join_fail_unpack(
|
||||
Tox_Event_Group_Join_Fail *event, Bin_Unpack *bu)
|
||||
{
|
||||
assert(event != nullptr);
|
||||
if (!bin_unpack_array_fixed(bu, 2)) {
|
||||
if (!bin_unpack_array_fixed(bu, 2, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -150,7 +150,7 @@ static bool tox_event_group_message_unpack(
|
||||
Tox_Event_Group_Message *event, Bin_Unpack *bu)
|
||||
{
|
||||
assert(event != nullptr);
|
||||
if (!bin_unpack_array_fixed(bu, 5)) {
|
||||
if (!bin_unpack_array_fixed(bu, 5, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ static bool tox_event_group_moderation_unpack(
|
||||
Tox_Event_Group_Moderation *event, Bin_Unpack *bu)
|
||||
{
|
||||
assert(event != nullptr);
|
||||
if (!bin_unpack_array_fixed(bu, 4)) {
|
||||
if (!bin_unpack_array_fixed(bu, 4, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ static bool tox_event_group_password_unpack(
|
||||
Tox_Event_Group_Password *event, Bin_Unpack *bu)
|
||||
{
|
||||
assert(event != nullptr);
|
||||
if (!bin_unpack_array_fixed(bu, 2)) {
|
||||
if (!bin_unpack_array_fixed(bu, 2, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -172,7 +172,7 @@ static bool tox_event_group_peer_exit_unpack(
|
||||
Tox_Event_Group_Peer_Exit *event, Bin_Unpack *bu)
|
||||
{
|
||||
assert(event != nullptr);
|
||||
if (!bin_unpack_array_fixed(bu, 5)) {
|
||||
if (!bin_unpack_array_fixed(bu, 5, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ static bool tox_event_group_peer_join_unpack(
|
||||
Tox_Event_Group_Peer_Join *event, Bin_Unpack *bu)
|
||||
{
|
||||
assert(event != nullptr);
|
||||
if (!bin_unpack_array_fixed(bu, 2)) {
|
||||
if (!bin_unpack_array_fixed(bu, 2, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ static bool tox_event_group_peer_limit_unpack(
|
||||
Tox_Event_Group_Peer_Limit *event, Bin_Unpack *bu)
|
||||
{
|
||||
assert(event != nullptr);
|
||||
if (!bin_unpack_array_fixed(bu, 2)) {
|
||||
if (!bin_unpack_array_fixed(bu, 2, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ static bool tox_event_group_peer_name_unpack(
|
||||
Tox_Event_Group_Peer_Name *event, Bin_Unpack *bu)
|
||||
{
|
||||
assert(event != nullptr);
|
||||
if (!bin_unpack_array_fixed(bu, 3)) {
|
||||
if (!bin_unpack_array_fixed(bu, 3, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ static bool tox_event_group_peer_status_unpack(
|
||||
Tox_Event_Group_Peer_Status *event, Bin_Unpack *bu)
|
||||
{
|
||||
assert(event != nullptr);
|
||||
if (!bin_unpack_array_fixed(bu, 3)) {
|
||||
if (!bin_unpack_array_fixed(bu, 3, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ static bool tox_event_group_privacy_state_unpack(
|
||||
Tox_Event_Group_Privacy_State *event, Bin_Unpack *bu)
|
||||
{
|
||||
assert(event != nullptr);
|
||||
if (!bin_unpack_array_fixed(bu, 2)) {
|
||||
if (!bin_unpack_array_fixed(bu, 2, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ static bool tox_event_group_private_message_unpack(
|
||||
Tox_Event_Group_Private_Message *event, Bin_Unpack *bu)
|
||||
{
|
||||
assert(event != nullptr);
|
||||
if (!bin_unpack_array_fixed(bu, 4)) {
|
||||
if (!bin_unpack_array_fixed(bu, 4, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ static bool tox_event_group_topic_unpack(
|
||||
Tox_Event_Group_Topic *event, Bin_Unpack *bu)
|
||||
{
|
||||
assert(event != nullptr);
|
||||
if (!bin_unpack_array_fixed(bu, 3)) {
|
||||
if (!bin_unpack_array_fixed(bu, 3, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ static bool tox_event_group_topic_lock_unpack(
|
||||
Tox_Event_Group_Topic_Lock *event, Bin_Unpack *bu)
|
||||
{
|
||||
assert(event != nullptr);
|
||||
if (!bin_unpack_array_fixed(bu, 2)) {
|
||||
if (!bin_unpack_array_fixed(bu, 2, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ static bool tox_event_group_voice_state_unpack(
|
||||
Tox_Event_Group_Voice_State *event, Bin_Unpack *bu)
|
||||
{
|
||||
assert(event != nullptr);
|
||||
if (!bin_unpack_array_fixed(bu, 2)) {
|
||||
if (!bin_unpack_array_fixed(bu, 2, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
4
external/toxcore/c-toxcore/toxcore/group.c
vendored
4
external/toxcore/c-toxcore/toxcore/group.c
vendored
@ -802,6 +802,7 @@ static int addpeer(Group_Chats *g_c, uint32_t groupnumber, const uint8_t *real_p
|
||||
|
||||
if (peer_index != -1) {
|
||||
if (!pk_equal(g->group[peer_index].real_pk, real_pk)) {
|
||||
LOGGER_ERROR(g_c->m->log, "peer public key is incorrect for peer %d", peer_number);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -3679,6 +3680,7 @@ static State_Load_Status load_conferences_helper(Group_Chats *g_c, const uint8_t
|
||||
|
||||
if (groupnumber == -1) {
|
||||
// If this fails there's a serious problem, don't bother with cleanup
|
||||
LOGGER_ERROR(g_c->m->log, "conference creation failed");
|
||||
return STATE_LOAD_STATUS_ERROR;
|
||||
}
|
||||
|
||||
@ -3696,6 +3698,7 @@ static State_Load_Status load_conferences_helper(Group_Chats *g_c, const uint8_t
|
||||
assert(ret);
|
||||
}
|
||||
|
||||
LOGGER_ERROR(g_c->m->log, "conference loading failed");
|
||||
return STATE_LOAD_STATUS_ERROR;
|
||||
}
|
||||
|
||||
@ -3705,6 +3708,7 @@ static State_Load_Status load_conferences_helper(Group_Chats *g_c, const uint8_t
|
||||
nullptr, true, false);
|
||||
|
||||
if (peer_index == -1) {
|
||||
LOGGER_ERROR(g_c->m->log, "adding peer %d failed", g->peer_number);
|
||||
return STATE_LOAD_STATUS_ERROR;
|
||||
}
|
||||
|
||||
|
@ -6961,12 +6961,12 @@ static bool ping_peer(const GC_Chat *chat, const GC_Connection *gconn)
|
||||
|
||||
if (!send_lossy_group_packet(chat, gconn, data, packed_len, GP_PING)) {
|
||||
free(data);
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
free(data);
|
||||
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
40
external/toxcore/c-toxcore/toxcore/group_pack.c
vendored
40
external/toxcore/c-toxcore/toxcore/group_pack.c
vendored
@ -22,7 +22,7 @@
|
||||
non_null()
|
||||
static bool load_unpack_state_values(GC_Chat *chat, Bin_Unpack *bu)
|
||||
{
|
||||
if (!bin_unpack_array_fixed(bu, 8)) {
|
||||
if (!bin_unpack_array_fixed(bu, 8, nullptr)) {
|
||||
LOGGER_ERROR(chat->log, "Group state values array malformed");
|
||||
return false;
|
||||
}
|
||||
@ -58,15 +58,23 @@ static bool load_unpack_state_values(GC_Chat *chat, Bin_Unpack *bu)
|
||||
non_null()
|
||||
static bool load_unpack_state_bin(GC_Chat *chat, Bin_Unpack *bu)
|
||||
{
|
||||
if (!bin_unpack_array_fixed(bu, 5)) {
|
||||
if (!bin_unpack_array_fixed(bu, 5, nullptr)) {
|
||||
LOGGER_ERROR(chat->log, "Group state binary array malformed");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(bin_unpack_bin_fixed(bu, chat->shared_state_sig, SIGNATURE_SIZE)
|
||||
&& bin_unpack_bin_fixed(bu, chat->shared_state.founder_public_key, EXT_PUBLIC_KEY_SIZE)
|
||||
&& bin_unpack_bin_fixed(bu, chat->shared_state.group_name, chat->shared_state.group_name_len)
|
||||
&& bin_unpack_bin_fixed(bu, chat->shared_state.password, chat->shared_state.password_length)
|
||||
if (!bin_unpack_bin_fixed(bu, chat->shared_state_sig, SIGNATURE_SIZE)) {
|
||||
LOGGER_ERROR(chat->log, "Failed to unpack shared state signature");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!bin_unpack_bin_fixed(bu, chat->shared_state.founder_public_key, EXT_PUBLIC_KEY_SIZE)) {
|
||||
LOGGER_ERROR(chat->log, "Failed to unpack founder public key");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(bin_unpack_bin_max(bu, chat->shared_state.group_name, &chat->shared_state.group_name_len, sizeof(chat->shared_state.group_name))
|
||||
&& bin_unpack_bin_max(bu, chat->shared_state.password, &chat->shared_state.password_length, sizeof(chat->shared_state.password))
|
||||
&& bin_unpack_bin_fixed(bu, chat->shared_state.mod_list_hash, MOD_MODERATION_HASH_SIZE))) {
|
||||
LOGGER_ERROR(chat->log, "Failed to unpack state binary data");
|
||||
return false;
|
||||
@ -78,7 +86,7 @@ static bool load_unpack_state_bin(GC_Chat *chat, Bin_Unpack *bu)
|
||||
non_null()
|
||||
static bool load_unpack_topic_info(GC_Chat *chat, Bin_Unpack *bu)
|
||||
{
|
||||
if (!bin_unpack_array_fixed(bu, 6)) {
|
||||
if (!bin_unpack_array_fixed(bu, 6, nullptr)) {
|
||||
LOGGER_ERROR(chat->log, "Group topic array malformed");
|
||||
return false;
|
||||
}
|
||||
@ -86,7 +94,7 @@ static bool load_unpack_topic_info(GC_Chat *chat, Bin_Unpack *bu)
|
||||
if (!(bin_unpack_u32(bu, &chat->topic_info.version)
|
||||
&& bin_unpack_u16(bu, &chat->topic_info.length)
|
||||
&& bin_unpack_u16(bu, &chat->topic_info.checksum)
|
||||
&& bin_unpack_bin_fixed(bu, chat->topic_info.topic, chat->topic_info.length)
|
||||
&& bin_unpack_bin_max(bu, chat->topic_info.topic, &chat->topic_info.length, sizeof(chat->topic_info.topic))
|
||||
&& bin_unpack_bin_fixed(bu, chat->topic_info.public_sig_key, SIG_PUBLIC_KEY_SIZE)
|
||||
&& bin_unpack_bin_fixed(bu, chat->topic_sig, SIGNATURE_SIZE))) {
|
||||
LOGGER_ERROR(chat->log, "Failed to unpack topic info");
|
||||
@ -99,8 +107,9 @@ static bool load_unpack_topic_info(GC_Chat *chat, Bin_Unpack *bu)
|
||||
non_null()
|
||||
static bool load_unpack_mod_list(GC_Chat *chat, Bin_Unpack *bu)
|
||||
{
|
||||
if (!bin_unpack_array_fixed(bu, 2)) {
|
||||
LOGGER_ERROR(chat->log, "Group mod list array malformed");
|
||||
uint32_t actual_size = 0;
|
||||
if (!bin_unpack_array_fixed(bu, 2, &actual_size)) {
|
||||
LOGGER_ERROR(chat->log, "Group mod list array malformed: %d != 2", actual_size);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -148,7 +157,7 @@ static bool load_unpack_mod_list(GC_Chat *chat, Bin_Unpack *bu)
|
||||
non_null()
|
||||
static bool load_unpack_keys(GC_Chat *chat, Bin_Unpack *bu)
|
||||
{
|
||||
if (!bin_unpack_array_fixed(bu, 4)) {
|
||||
if (!bin_unpack_array_fixed(bu, 4, nullptr)) {
|
||||
LOGGER_ERROR(chat->log, "Group keys array malformed");
|
||||
return false;
|
||||
}
|
||||
@ -167,7 +176,7 @@ static bool load_unpack_keys(GC_Chat *chat, Bin_Unpack *bu)
|
||||
non_null()
|
||||
static bool load_unpack_self_info(GC_Chat *chat, Bin_Unpack *bu)
|
||||
{
|
||||
if (!bin_unpack_array_fixed(bu, 4)) {
|
||||
if (!bin_unpack_array_fixed(bu, 4, nullptr)) {
|
||||
LOGGER_ERROR(chat->log, "Group self info array malformed");
|
||||
return false;
|
||||
}
|
||||
@ -214,7 +223,7 @@ static bool load_unpack_self_info(GC_Chat *chat, Bin_Unpack *bu)
|
||||
non_null()
|
||||
static bool load_unpack_saved_peers(GC_Chat *chat, Bin_Unpack *bu)
|
||||
{
|
||||
if (!bin_unpack_array_fixed(bu, 2)) {
|
||||
if (!bin_unpack_array_fixed(bu, 2, nullptr)) {
|
||||
LOGGER_ERROR(chat->log, "Group saved peers array malformed");
|
||||
return false;
|
||||
}
|
||||
@ -256,8 +265,9 @@ static bool load_unpack_saved_peers(GC_Chat *chat, Bin_Unpack *bu)
|
||||
|
||||
bool gc_load_unpack_group(GC_Chat *chat, Bin_Unpack *bu)
|
||||
{
|
||||
if (!bin_unpack_array_fixed(bu, 7)) {
|
||||
LOGGER_ERROR(chat->log, "Group info array malformed");
|
||||
uint32_t actual_size;
|
||||
if (!bin_unpack_array_fixed(bu, 7, &actual_size)) {
|
||||
LOGGER_ERROR(chat->log, "Group info array malformed: %d != 7", actual_size);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
2
external/toxcore/c-toxcore/toxcore/network.c
vendored
2
external/toxcore/c-toxcore/toxcore/network.c
vendored
@ -1086,7 +1086,7 @@ void networking_poll(const Networking_Core *net, void *userdata)
|
||||
}
|
||||
|
||||
IP_Port ip_port;
|
||||
uint8_t data[MAX_UDP_PACKET_SIZE];
|
||||
uint8_t data[MAX_UDP_PACKET_SIZE] = {0};
|
||||
uint32_t length;
|
||||
|
||||
while (receivepacket(net->ns, net->mem, net->log, net->sock, &ip_port, data, &length) != -1) {
|
||||
|
2
external/toxcore/c-toxcore/toxcore/state.c
vendored
2
external/toxcore/c-toxcore/toxcore/state.c
vendored
@ -52,7 +52,7 @@ int state_load(const Logger *log, state_load_cb *state_load_callback, void *oute
|
||||
}
|
||||
|
||||
case STATE_LOAD_STATUS_ERROR: {
|
||||
LOGGER_ERROR(log, "Error occcured in state file (type: %u).", type);
|
||||
LOGGER_ERROR(log, "Error occcured in state file (type: 0x%02x).", type);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
17
external/toxcore/c-toxcore/toxcore/tox_private.c
vendored
17
external/toxcore/c-toxcore/toxcore/tox_private.c
vendored
@ -149,3 +149,20 @@ bool tox_dht_get_nodes(const Tox *tox, const uint8_t *public_key, const char *ip
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
uint16_t tox_dht_get_num_closelist(const Tox *tox) {
|
||||
tox_lock(tox);
|
||||
const uint16_t num_total = dht_get_num_closelist(tox->m->dht);
|
||||
tox_unlock(tox);
|
||||
|
||||
return num_total;
|
||||
}
|
||||
|
||||
uint16_t tox_dht_get_num_closelist_announce_capable(const Tox *tox){
|
||||
tox_lock(tox);
|
||||
const uint16_t num_cap = dht_get_num_closelist_announce_capable(tox->m->dht);
|
||||
tox_unlock(tox);
|
||||
|
||||
return num_cap;
|
||||
}
|
||||
|
||||
|
16
external/toxcore/c-toxcore/toxcore/tox_private.h
vendored
16
external/toxcore/c-toxcore/toxcore/tox_private.h
vendored
@ -140,6 +140,22 @@ typedef enum Tox_Err_Dht_Get_Nodes {
|
||||
bool tox_dht_get_nodes(const Tox *tox, const uint8_t *public_key, const char *ip, uint16_t port,
|
||||
const uint8_t *target_public_key, Tox_Err_Dht_Get_Nodes *error);
|
||||
|
||||
/**
|
||||
* This function returns the ratio of close dht nodes that are known to support announce/store.
|
||||
* This function returns the number of DHT nodes in the closelist.
|
||||
*
|
||||
* @return number
|
||||
*/
|
||||
uint16_t tox_dht_get_num_closelist(const Tox *tox);
|
||||
|
||||
/**
|
||||
* This function returns the number of DHT nodes in the closelist,
|
||||
* that are capable to store annouce data (introduced in version 0.2.18).
|
||||
*
|
||||
* @return number
|
||||
*/
|
||||
uint16_t tox_dht_get_num_closelist_announce_capable(const Tox *tox);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user