Compare commits

..

18 Commits

Author SHA1 Message Date
3567aba4db change cd output name 2023-10-15 16:40:48 +02:00
9b07cb4dce compile fixes for toxcore and gcc12 2023-10-15 16:34:07 +02:00
c89bba25a3 update toxcore dep, so clone works again 2023-10-15 15:57:26 +02:00
f9bc83811c properly handle broken info 2023-08-10 01:32:24 +02:00
5c4bb1aa42 update packet ids 2023-08-06 18:36:21 +02:00
2a143a4c2e remove extra include 2023-06-17 15:47:59 +02:00
3072d2936e fix connecting via chatid 2023-06-16 22:31:00 +02:00
7458841417 cd: switch to static deps 2023-06-16 20:21:10 +02:00
2b3ee3316a msvc fixes 2023-06-16 17:16:50 +02:00
622c9d9d96 add github cd 2023-06-16 16:55:26 +02:00
caa913fa51 small update 2023-06-16 02:05:27 +02:00
261c487cf2 update deps 2023-03-12 18:49:26 +01:00
086fc52e92 dynamic timeouts and minor cleanups 2023-03-12 01:26:23 +01:00
cd6141ee00 updated ft with experimental cca 2023-01-31 02:02:01 +01:00
5fa8dc712a actually use --ft_ options *facepalm* 2023-01-22 22:07:22 +01:00
e0d4c4d1e1 more strict sending 2023-01-22 17:21:03 +01:00
de247c9e91 actually set group name 2023-01-20 00:00:57 +01:00
20c41e1a02 tweak defaults, better peer connection state tracking (none :P) 2023-01-19 23:35:30 +01:00
19 changed files with 386 additions and 249 deletions

1
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1 @@
github: Green-Sky

43
.github/workflows/cd.yml vendored Normal file
View File

@ -0,0 +1,43 @@
name: ContinuousDelivery
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
BUILD_TYPE: Release
jobs:
windows:
timeout-minutes: 15
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Dependencies
run: vcpkg install libsodium:x64-windows-static pthreads:x64-windows-static
# setup vs env
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64
- name: Configure CMake
run: cmake -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j 4
- uses: actions/upload-artifact@v3
with:
name: ${{ github.event.repository.name }}-windows-msvc-x86_64
# TODO: do propper packing
path: |
${{github.workspace}}/build/bin/

View File

@ -36,7 +36,7 @@ if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL
) )
if (NOT WIN32) if (NOT WIN32)
link_libraries(-fsanitize=address,undefined) #link_libraries(-fsanitize=address,undefined)
#link_libraries(-fsanitize=undefined) #link_libraries(-fsanitize=undefined)
endif() endif()
elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC") elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")

View File

@ -13,7 +13,7 @@ this will print this tools tox_id and the generated info_hash
this will first download the info using the info_hash and then all the file chunks listed in the info this will first download the info using the info_hash and then all the file chunks listed in the info
while simultaneously resharing allready downloaded chunks and info (swarming) while simultaneously resharing allready downloaded chunks and info (swarming)
to increase the amount of parallel chunk down/up loads, you can increase the value with the -I and -O option. the default for -I is 32 and for -O 16, which are relatively low numbers, which in practice can get you up to ~400KiB/s. to increase the amount of parallel chunk down/up loads, you can increase the value with the -I and -O option. the default for -I is 32 and for -O 16, which are relatively low numbers, which in practice can get you up to ~700KiB/s.
## Usage ## Usage
@ -54,9 +54,7 @@ $ tox_ngc_ft1_tool
FT1: FT1:
--ft_ack_per_packet --ft_ack_per_packet
--ft_init_retry_timeout_after --ft_init_retry_timeout_after
--ft_sending_resend_without_ack_after
--ft_sending_give_up_after --ft_sending_give_up_after
--ft_packet_window_size
transfer logic: transfer logic:
-I <max_incoming_transfers> -I <max_incoming_transfers>

View File

@ -3,6 +3,9 @@ cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
add_library(tox_ngc_ft1 STATIC add_library(tox_ngc_ft1 STATIC
./tox_ngc_ft1/ngc_ft1.h ./tox_ngc_ft1/ngc_ft1.h
./tox_ngc_ft1/ngc_ft1.cpp ./tox_ngc_ft1/ngc_ft1.cpp
./tox_ngc_ft1/ledbat.hpp
./tox_ngc_ft1/ledbat.cpp
) )
target_include_directories(tox_ngc_ft1 PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/tox_ngc_ft1") target_include_directories(tox_ngc_ft1 PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/tox_ngc_ft1")

View File

@ -2,6 +2,198 @@ cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include(./toxcore.cmake) set(TOX_DIR "${CMAKE_CURRENT_SOURCE_DIR}/c-toxcore/")
# TODO: shared
add_library(toxcore STATIC
${TOX_DIR}third_party/cmp/cmp.c
${TOX_DIR}third_party/cmp/cmp.h
${TOX_DIR}toxcore/announce.c
${TOX_DIR}toxcore/announce.h
${TOX_DIR}toxcore/bin_pack.c
${TOX_DIR}toxcore/bin_pack.h
${TOX_DIR}toxcore/bin_unpack.c
${TOX_DIR}toxcore/bin_unpack.h
${TOX_DIR}toxcore/ccompat.c
${TOX_DIR}toxcore/ccompat.h
${TOX_DIR}toxcore/crypto_core.c
${TOX_DIR}toxcore/crypto_core.h
${TOX_DIR}toxcore/DHT.c
${TOX_DIR}toxcore/DHT.h
${TOX_DIR}toxcore/events/conference_connected.c
${TOX_DIR}toxcore/events/conference_invite.c
${TOX_DIR}toxcore/events/conference_message.c
${TOX_DIR}toxcore/events/conference_peer_list_changed.c
${TOX_DIR}toxcore/events/conference_peer_name.c
${TOX_DIR}toxcore/events/conference_title.c
${TOX_DIR}toxcore/events/events_alloc.c
${TOX_DIR}toxcore/events/events_alloc.h
${TOX_DIR}toxcore/events/file_chunk_request.c
${TOX_DIR}toxcore/events/file_recv.c
${TOX_DIR}toxcore/events/file_recv_chunk.c
${TOX_DIR}toxcore/events/file_recv_control.c
${TOX_DIR}toxcore/events/friend_connection_status.c
${TOX_DIR}toxcore/events/friend_lossless_packet.c
${TOX_DIR}toxcore/events/friend_lossy_packet.c
${TOX_DIR}toxcore/events/friend_message.c
${TOX_DIR}toxcore/events/friend_name.c
${TOX_DIR}toxcore/events/friend_read_receipt.c
${TOX_DIR}toxcore/events/friend_request.c
${TOX_DIR}toxcore/events/friend_status.c
${TOX_DIR}toxcore/events/friend_status_message.c
${TOX_DIR}toxcore/events/friend_typing.c
${TOX_DIR}toxcore/events/self_connection_status.c
#${TOX_DIR}toxcore/events/group_custom_packet.c
#${TOX_DIR}toxcore/events/group_custom_private_packet.c
#${TOX_DIR}toxcore/events/group_invite.c
#${TOX_DIR}toxcore/events/group_join_fail.c
#${TOX_DIR}toxcore/events/group_message.c
#${TOX_DIR}toxcore/events/group_moderation.c
#${TOX_DIR}toxcore/events/group_password.c
#${TOX_DIR}toxcore/events/group_peer_exit.c
#${TOX_DIR}toxcore/events/group_peer_join.c
#${TOX_DIR}toxcore/events/group_peer_limit.c
#${TOX_DIR}toxcore/events/group_peer_name.c
#${TOX_DIR}toxcore/events/group_peer_status.c
#${TOX_DIR}toxcore/events/group_privacy_state.c
#${TOX_DIR}toxcore/events/group_private_message.c
#${TOX_DIR}toxcore/events/group_self_join.c
#${TOX_DIR}toxcore/events/group_topic.c
#${TOX_DIR}toxcore/events/group_topic_lock.c
#${TOX_DIR}toxcore/events/group_voice_state.c
${TOX_DIR}toxcore/forwarding.c
${TOX_DIR}toxcore/forwarding.h
${TOX_DIR}toxcore/friend_connection.c
${TOX_DIR}toxcore/friend_connection.h
${TOX_DIR}toxcore/friend_requests.c
${TOX_DIR}toxcore/friend_requests.h
${TOX_DIR}toxcore/group.c
${TOX_DIR}toxcore/group.h
${TOX_DIR}toxcore/group_announce.c
${TOX_DIR}toxcore/group_announce.h
${TOX_DIR}toxcore/group_moderation.c
${TOX_DIR}toxcore/group_moderation.h
${TOX_DIR}toxcore/group_chats.c
${TOX_DIR}toxcore/group_chats.h
${TOX_DIR}toxcore/group_common.h
${TOX_DIR}toxcore/group_connection.c
${TOX_DIR}toxcore/group_connection.h
${TOX_DIR}toxcore/group_onion_announce.c
${TOX_DIR}toxcore/group_onion_announce.h
${TOX_DIR}toxcore/group_pack.c
${TOX_DIR}toxcore/group_pack.h
${TOX_DIR}toxcore/LAN_discovery.c
${TOX_DIR}toxcore/LAN_discovery.h
${TOX_DIR}toxcore/list.c
${TOX_DIR}toxcore/list.h
${TOX_DIR}toxcore/logger.c
${TOX_DIR}toxcore/logger.h
${TOX_DIR}toxcore/Messenger.c
${TOX_DIR}toxcore/Messenger.h
${TOX_DIR}toxcore/mem.c
${TOX_DIR}toxcore/mem.h
${TOX_DIR}toxcore/mono_time.c
${TOX_DIR}toxcore/mono_time.h
${TOX_DIR}toxcore/net_crypto.c
${TOX_DIR}toxcore/net_crypto.h
${TOX_DIR}toxcore/network.c
${TOX_DIR}toxcore/network.h
${TOX_DIR}toxcore/onion_announce.c
${TOX_DIR}toxcore/onion_announce.h
${TOX_DIR}toxcore/onion.c
${TOX_DIR}toxcore/onion_client.c
${TOX_DIR}toxcore/onion_client.h
${TOX_DIR}toxcore/onion.h
${TOX_DIR}toxcore/ping_array.c
${TOX_DIR}toxcore/ping_array.h
${TOX_DIR}toxcore/ping.c
${TOX_DIR}toxcore/ping.h
${TOX_DIR}toxcore/shared_key_cache.c
${TOX_DIR}toxcore/shared_key_cache.h
${TOX_DIR}toxcore/state.c
${TOX_DIR}toxcore/state.h
${TOX_DIR}toxcore/TCP_client.c
${TOX_DIR}toxcore/TCP_client.h
${TOX_DIR}toxcore/TCP_common.c
${TOX_DIR}toxcore/TCP_common.h
${TOX_DIR}toxcore/TCP_connection.c
${TOX_DIR}toxcore/TCP_connection.h
${TOX_DIR}toxcore/TCP_server.c
${TOX_DIR}toxcore/TCP_server.h
${TOX_DIR}toxcore/timed_auth.c
${TOX_DIR}toxcore/timed_auth.h
${TOX_DIR}toxcore/tox_api.c
${TOX_DIR}toxcore/tox.c
${TOX_DIR}toxcore/tox_dispatch.c
${TOX_DIR}toxcore/tox_dispatch.h
${TOX_DIR}toxcore/tox_events.c
${TOX_DIR}toxcore/tox_events.h
${TOX_DIR}toxcore/tox.h
${TOX_DIR}toxcore/tox_private.c
${TOX_DIR}toxcore/tox_private.h
${TOX_DIR}toxcore/tox_unpack.c
${TOX_DIR}toxcore/tox_unpack.h
${TOX_DIR}toxcore/util.c
${TOX_DIR}toxcore/util.h
)
# HACK: "install" api headers into self
# this is dirty, should be binary dir
# TODO: add the others
configure_file(
${TOX_DIR}toxcore/tox.h
${TOX_DIR}tox/tox.h
@ONLY
)
configure_file(
${TOX_DIR}toxcore/tox_events.h
${TOX_DIR}tox/tox_events.h
@ONLY
)
target_include_directories(toxcore PRIVATE "${TOX_DIR}toxcore")
target_include_directories(toxcore PUBLIC "${TOX_DIR}")
target_compile_definitions(toxcore PUBLIC USE_IPV6=1)
#target_compile_definitions(toxcore PUBLIC MIN_LOGGER_LEVEL=LOGGER_LEVEL_DEBUG)
target_compile_definitions(toxcore PUBLIC MIN_LOGGER_LEVEL=LOGGER_LEVEL_INFO)
find_package(unofficial-sodium CONFIG QUIET)
find_package(sodium QUIET)
if(unofficial-sodium_FOUND) # vcpkg
if(TARGET unofficial-sodium::sodium)
target_link_libraries(toxcore unofficial-sodium::sodium)
endif()
if(TARGET unofficial-sodium::sodium_config_public)
target_link_libraries(toxcore unofficial-sodium::sodium_config_public)
endif()
elseif(sodium_FOUND)
target_link_libraries(toxcore sodium)
else()
message(SEND_ERROR "missing libsodium")
endif()
if(WIN32)
target_link_libraries(toxcore ws2_32 iphlpapi)
endif()
find_package(pthreads QUIET)
if(TARGET PThreads4W::PThreads4W)
target_link_libraries(toxcore PThreads4W::PThreads4W)
else()
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
target_link_libraries(toxcore Threads::Threads)
endif()
add_executable(DHT_Bootstrap EXCLUDE_FROM_ALL
${TOX_DIR}other/DHT_bootstrap.c
${TOX_DIR}other/bootstrap_node_packets.h
${TOX_DIR}other/bootstrap_node_packets.c
${TOX_DIR}testing/misc_tools.h
${TOX_DIR}testing/misc_tools.c
)
target_link_libraries(DHT_Bootstrap toxcore)

View File

@ -1,159 +0,0 @@
set(TOX_DIR "${CMAKE_CURRENT_SOURCE_DIR}/c-toxcore/")
# TODO: shared
add_library(toxcore STATIC
${TOX_DIR}third_party/cmp/cmp.c
${TOX_DIR}third_party/cmp/cmp.h
${TOX_DIR}toxcore/announce.c
${TOX_DIR}toxcore/announce.h
${TOX_DIR}toxcore/bin_pack.c
${TOX_DIR}toxcore/bin_pack.h
${TOX_DIR}toxcore/bin_unpack.c
${TOX_DIR}toxcore/bin_unpack.h
${TOX_DIR}toxcore/ccompat.c
${TOX_DIR}toxcore/ccompat.h
${TOX_DIR}toxcore/crypto_core.c
${TOX_DIR}toxcore/crypto_core.h
${TOX_DIR}toxcore/DHT.c
${TOX_DIR}toxcore/DHT.h
${TOX_DIR}toxcore/events/conference_connected.c
${TOX_DIR}toxcore/events/conference_invite.c
${TOX_DIR}toxcore/events/conference_message.c
${TOX_DIR}toxcore/events/conference_peer_list_changed.c
${TOX_DIR}toxcore/events/conference_peer_name.c
${TOX_DIR}toxcore/events/conference_title.c
${TOX_DIR}toxcore/events/events_alloc.c
${TOX_DIR}toxcore/events/events_alloc.h
${TOX_DIR}toxcore/events/file_chunk_request.c
${TOX_DIR}toxcore/events/file_recv.c
${TOX_DIR}toxcore/events/file_recv_chunk.c
${TOX_DIR}toxcore/events/file_recv_control.c
${TOX_DIR}toxcore/events/friend_connection_status.c
${TOX_DIR}toxcore/events/friend_lossless_packet.c
${TOX_DIR}toxcore/events/friend_lossy_packet.c
${TOX_DIR}toxcore/events/friend_message.c
${TOX_DIR}toxcore/events/friend_name.c
${TOX_DIR}toxcore/events/friend_read_receipt.c
${TOX_DIR}toxcore/events/friend_request.c
${TOX_DIR}toxcore/events/friend_status.c
${TOX_DIR}toxcore/events/friend_status_message.c
${TOX_DIR}toxcore/events/friend_typing.c
${TOX_DIR}toxcore/events/self_connection_status.c
${TOX_DIR}toxcore/forwarding.c
${TOX_DIR}toxcore/forwarding.h
${TOX_DIR}toxcore/friend_connection.c
${TOX_DIR}toxcore/friend_connection.h
${TOX_DIR}toxcore/friend_requests.c
${TOX_DIR}toxcore/friend_requests.h
${TOX_DIR}toxcore/group.c
${TOX_DIR}toxcore/group.h
${TOX_DIR}toxcore/group_announce.c
${TOX_DIR}toxcore/group_announce.h
${TOX_DIR}toxcore/group_moderation.c
${TOX_DIR}toxcore/group_moderation.h
${TOX_DIR}toxcore/group_chats.c
${TOX_DIR}toxcore/group_chats.h
${TOX_DIR}toxcore/group_common.h
${TOX_DIR}toxcore/group_connection.c
${TOX_DIR}toxcore/group_connection.h
${TOX_DIR}toxcore/group_onion_announce.c
${TOX_DIR}toxcore/group_onion_announce.h
${TOX_DIR}toxcore/group_pack.c
${TOX_DIR}toxcore/group_pack.h
${TOX_DIR}toxcore/LAN_discovery.c
${TOX_DIR}toxcore/LAN_discovery.h
${TOX_DIR}toxcore/list.c
${TOX_DIR}toxcore/list.h
${TOX_DIR}toxcore/logger.c
${TOX_DIR}toxcore/logger.h
${TOX_DIR}toxcore/Messenger.c
${TOX_DIR}toxcore/Messenger.h
${TOX_DIR}toxcore/mono_time.c
${TOX_DIR}toxcore/mono_time.h
${TOX_DIR}toxcore/net_crypto.c
${TOX_DIR}toxcore/net_crypto.h
${TOX_DIR}toxcore/network.c
${TOX_DIR}toxcore/network.h
${TOX_DIR}toxcore/onion_announce.c
${TOX_DIR}toxcore/onion_announce.h
${TOX_DIR}toxcore/onion.c
${TOX_DIR}toxcore/onion_client.c
${TOX_DIR}toxcore/onion_client.h
${TOX_DIR}toxcore/onion.h
${TOX_DIR}toxcore/ping_array.c
${TOX_DIR}toxcore/ping_array.h
${TOX_DIR}toxcore/ping.c
${TOX_DIR}toxcore/ping.h
${TOX_DIR}toxcore/shared_key_cache.c
${TOX_DIR}toxcore/shared_key_cache.h
${TOX_DIR}toxcore/state.c
${TOX_DIR}toxcore/state.h
${TOX_DIR}toxcore/TCP_client.c
${TOX_DIR}toxcore/TCP_client.h
${TOX_DIR}toxcore/TCP_common.c
${TOX_DIR}toxcore/TCP_common.h
${TOX_DIR}toxcore/TCP_connection.c
${TOX_DIR}toxcore/TCP_connection.h
${TOX_DIR}toxcore/TCP_server.c
${TOX_DIR}toxcore/TCP_server.h
${TOX_DIR}toxcore/timed_auth.c
${TOX_DIR}toxcore/timed_auth.h
${TOX_DIR}toxcore/tox_api.c
${TOX_DIR}toxcore/tox.c
${TOX_DIR}toxcore/tox_dispatch.c
${TOX_DIR}toxcore/tox_dispatch.h
${TOX_DIR}toxcore/tox_events.c
${TOX_DIR}toxcore/tox_events.h
${TOX_DIR}toxcore/tox.h
${TOX_DIR}toxcore/tox_private.c
${TOX_DIR}toxcore/tox_private.h
${TOX_DIR}toxcore/tox_unpack.c
${TOX_DIR}toxcore/tox_unpack.h
${TOX_DIR}toxcore/util.c
${TOX_DIR}toxcore/util.h
)
# HACK: "install" api headers into self
# this is dirty, should be binary dir
# TODO: add the others
configure_file(
${TOX_DIR}toxcore/tox.h
${TOX_DIR}tox/tox.h
@ONLY
)
target_include_directories(toxcore PRIVATE "${TOX_DIR}toxcore")
target_include_directories(toxcore PUBLIC "${TOX_DIR}")
target_compile_definitions(toxcore PUBLIC USE_IPV6=1)
#target_compile_definitions(toxcore PUBLIC MIN_LOGGER_LEVEL=LOGGER_LEVEL_DEBUG)
target_compile_definitions(toxcore PUBLIC MIN_LOGGER_LEVEL=LOGGER_LEVEL_INFO)
find_package(unofficial-sodium CONFIG QUIET)
find_package(sodium QUIET)
if(unofficial-sodium_FOUND) # vcpkg
target_link_libraries(toxcore unofficial-sodium::sodium unofficial-sodium::sodium_config_public)
elseif(sodium_FOUND)
target_link_libraries(toxcore sodium)
else()
message(SEND_ERROR "missing libsodium")
endif()
if(WIN32)
target_link_libraries(toxcore ws2_32 iphlpapi)
endif()
find_package(Threads REQUIRED)
target_link_libraries(toxcore Threads::Threads)
add_executable(DHT_Bootstrap EXCLUDE_FROM_ALL
${TOX_DIR}other/DHT_bootstrap.c
${TOX_DIR}other/bootstrap_node_packets.h
${TOX_DIR}other/bootstrap_node_packets.c
${TOX_DIR}testing/misc_tools.h
${TOX_DIR}testing/misc_tools.c
)
target_link_libraries(DHT_Bootstrap toxcore)

View File

@ -119,9 +119,7 @@ CommandLine::CommandLine(int argc, char** argv) {
std::cout << "CL set tox_port to " << tox_port << "\n"; std::cout << "CL set tox_port to " << tox_port << "\n";
} else if (parser.parseParam("--ft_ack_per_packet", ft_acks_per_packet)) { } else if (parser.parseParam("--ft_ack_per_packet", ft_acks_per_packet)) {
} else if (parser.parseParam("--ft_init_retry_timeout_after", ft_init_retry_timeout_after)) { } else if (parser.parseParam("--ft_init_retry_timeout_after", ft_init_retry_timeout_after)) {
} else if (parser.parseParam("--ft_sending_resend_without_ack_after", ft_sending_resend_without_ack_after)) {
} else if (parser.parseParam("--ft_sending_give_up_after", ft_sending_give_up_after)) { } else if (parser.parseParam("--ft_sending_give_up_after", ft_sending_give_up_after)) {
} else if (parser.parseParam("--ft_packet_window_size", ft_packet_window_size)) {
} else if (parser.parseParam("-I", max_incoming_transfers)) { } else if (parser.parseParam("-I", max_incoming_transfers)) {
} else if (parser.parseParam("-O", max_outgoing_transfers)) { } else if (parser.parseParam("-O", max_outgoing_transfers)) {
} else { } else {
@ -177,9 +175,7 @@ void CommandLine::printHelp(void) {
<< " FT1:\n" << " FT1:\n"
<< " --ft_ack_per_packet\n" << " --ft_ack_per_packet\n"
<< " --ft_init_retry_timeout_after\n" << " --ft_init_retry_timeout_after\n"
<< " --ft_sending_resend_without_ack_after\n"
<< " --ft_sending_give_up_after\n" << " --ft_sending_give_up_after\n"
<< " --ft_packet_window_size\n"
<< "\n" << "\n"
<< " transfer logic:\n" << " transfer logic:\n"
<< " -I <max_incoming_transfers>\n" << " -I <max_incoming_transfers>\n"

View File

@ -57,15 +57,11 @@ struct CommandLine {
// advanced FT1: // advanced FT1:
// --ft_ack_per_packet // --ft_ack_per_packet
size_t ft_acks_per_packet {5}; size_t ft_acks_per_packet {3};
// --ft_init_retry_timeout_after // --ft_init_retry_timeout_after
float ft_init_retry_timeout_after {10.f}; float ft_init_retry_timeout_after {5.f};
// --ft_sending_resend_without_ack_after
float ft_sending_resend_without_ack_after {5.f};
// --ft_sending_give_up_after // --ft_sending_give_up_after
float ft_sending_give_up_after {30.f}; float ft_sending_give_up_after {30.f};
// --ft_packet_window_size
size_t ft_packet_window_size {5};
// ---- TODO ---- // ---- TODO ----
@ -73,7 +69,7 @@ struct CommandLine {
// -I max_incoming_transfers // -I max_incoming_transfers
size_t max_incoming_transfers {32}; size_t max_incoming_transfers {32};
// -O max_outgoing_transfers // -O max_outgoing_transfers
size_t max_outgoing_transfers {16}; size_t max_outgoing_transfers {8};
// -u request chunks only from UDP-direct peers // -u request chunks only from UDP-direct peers
bool request_only_from_udp_peer {false}; bool request_only_from_udp_peer {false};

View File

@ -1,6 +1,7 @@
#pragma once #pragma once
#include <cstdint> #include <cstdint>
#include <cstddef>
#include <vector> #include <vector>
// returns the 20bytes sha1 hash // returns the 20bytes sha1 hash

View File

@ -47,22 +47,25 @@ bool ReceiveStartSHA1::iterate(float delta) {
} }
} else if (_time_since_last_request >= 15.f) { // blast ever 15sec } else if (_time_since_last_request >= 15.f) { // blast ever 15sec
_time_since_last_request = 0.f; _time_since_last_request = 0.f;
// TODO: select random and try, not blas
// ... and we are blasing
_tcl.forEachGroup([this](const uint32_t group_number) { _tcl.forEachGroup([this](const uint32_t group_number) {
_tcl.forEachGroupPeer(group_number, [this, group_number](uint32_t peer_number, Tox_Connection connection_status) { _tcl.forEachGroupPeer(group_number, [this, group_number](uint32_t peer_number) {
_tcl.sendFT1RequestPrivate( _tcl.sendFT1RequestPrivate(
group_number, peer_number, group_number, peer_number,
NGC_FT1_file_kind::HASH_SHA1_INFO, NGC_FT1_file_kind::HASH_SHA1_INFO,
_sha1_info_hash.data.data(), _sha1_info_hash.size() _sha1_info_hash.data.data(), _sha1_info_hash.size()
); );
std::cout << "ReceiveStartSHA1 sendig info request to " << group_number << ":" << peer_number << " over " << (connection_status == Tox_Connection::TOX_CONNECTION_TCP ? "tcp" : "udp") <<"\n"; std::cout
<< "ReceiveStartSHA1 sendig info request to "
<< group_number << ":" << peer_number
<< " over " << (_tcl.getGroupPeerConnectionStatus(group_number, peer_number) == Tox_Connection::TOX_CONNECTION_TCP ? "tcp" : "udp")
<< "\n"
;
}); });
}); });
} }
// if not transfer, request from random peer (equal dist!!) // if not transfer, request from random peer (equal dist!!)
// TODO: return true if done
return _done; return _done;
} }
@ -173,12 +176,12 @@ void ReceiveStartSHA1::onFT1ReceiveDataSHA1Info(uint32_t group_number, uint32_t
std::cerr << "ReceiveStartSHA1 received info's hash does not match!, discarding\n"; std::cerr << "ReceiveStartSHA1 received info's hash does not match!, discarding\n";
_transfer.reset(); _transfer.reset();
_sha1_info_data.clear(); _sha1_info_data.clear();
} } else {
std::cout << "ReceiveStartSHA1 info tansfer finished " << group_number << ":" << peer_number << "." << int(transfer_id) << "\n"; std::cout << "ReceiveStartSHA1 info tansfer finished " << group_number << ":" << peer_number << "." << int(transfer_id) << "\n";
_done = true; _done = true;
} }
} }
}
void ReceiveStartSHA1::onFT1SendDataSHA1Info(uint32_t, uint32_t, uint8_t, size_t, uint8_t*, size_t) { void ReceiveStartSHA1::onFT1SendDataSHA1Info(uint32_t, uint32_t, uint8_t, size_t, uint8_t*, size_t) {
// we cant send what we dont have // we cant send what we dont have

View File

@ -30,8 +30,9 @@ SHA1::SHA1(
{ {
assert(_have_chunk.size() == _sha1_info.chunks.size()); assert(_have_chunk.size() == _sha1_info.chunks.size());
_udp_only = cl.request_only_from_udp_peer;
_max_concurrent_in = cl.max_incoming_transfers; _max_concurrent_in = cl.max_incoming_transfers;
_max_concurrent_out = cl.max_incoming_transfers; _max_concurrent_out = cl.max_outgoing_transfers;
// build lookup table // build lookup table
for (size_t i = _sha1_info.chunks.size(); i > 0; i--) { for (size_t i = _sha1_info.chunks.size(); i > 0; i--) {
@ -144,6 +145,7 @@ bool SHA1::iterate(float delta) {
// send init to _queue_requested_info // send init to _queue_requested_info
const auto [group_number, peer_number] = _queue_requested_info.front(); const auto [group_number, peer_number] = _queue_requested_info.front();
if (_tcl.getGroupPeerConnectionStatus(group_number, peer_number) != TOX_CONNECTION_NONE) {
uint8_t transfer_id {0}; uint8_t transfer_id {0};
if (_tcl.sendFT1InitPrivate( if (_tcl.sendFT1InitPrivate(
@ -161,9 +163,15 @@ bool SHA1::iterate(float delta) {
_queue_requested_info.pop_front(); _queue_requested_info.pop_front();
} }
}
} else if (!_queue_requested_chunk.empty()) { // then check for chunk requests } else if (!_queue_requested_chunk.empty()) { // then check for chunk requests
const auto [group_number, peer_number, chunk_hash, _] = _queue_requested_chunk.front(); const auto [group_number, peer_number, chunk_hash, _] = _queue_requested_chunk.front();
if (_tcl.getGroupPeerConnectionStatus(group_number, peer_number) != TOX_CONNECTION_NONE) {
if (!chunkIndex(chunk_hash).has_value()) {
std::cerr << "!chunkIndex(chunk_hash).has_value()\n";
exit(1);
}
size_t chunk_index = chunkIndex(chunk_hash).value(); size_t chunk_index = chunkIndex(chunk_hash).value();
size_t chunk_file_size = chunkSize(chunk_index); size_t chunk_file_size = chunkSize(chunk_index);
@ -187,6 +195,7 @@ bool SHA1::iterate(float delta) {
} }
} }
} }
}
// update speeds and targets // update speeds and targets
_peer_speed_mesurement_interval_timer += delta; _peer_speed_mesurement_interval_timer += delta;
@ -194,12 +203,21 @@ bool SHA1::iterate(float delta) {
_peer_speed_mesurement_interval_timer = 0.f; // we lose some time here, but precision is not the issue _peer_speed_mesurement_interval_timer = 0.f; // we lose some time here, but precision is not the issue
_peer_in_bytes_array_index = (_peer_in_bytes_array_index + 1) % _peer_speed_mesurement_interval_count; _peer_in_bytes_array_index = (_peer_in_bytes_array_index + 1) % _peer_speed_mesurement_interval_count;
for (const auto& [peer, array] : _peer_in_bytes_array) { //for (const auto& [peer, array] : _peer_in_bytes_array) {
for (auto it = _peer_in_bytes_array.begin(); it != _peer_in_bytes_array.end();) {
const auto& [peer, array] = *it;
float avg {0.f}; float avg {0.f};
for (size_t i = 0; i < array.size(); i++) { for (size_t i = 0; i < array.size(); i++) {
avg += array[i]; avg += array[i];
} }
if (avg == 0.f || _tcl.getGroupPeerConnectionStatus(peer.first, peer.second) == Tox_Connection::TOX_CONNECTION_NONE) {
_peer_in_speed.erase(peer);
it = _peer_in_bytes_array.erase(it);
continue;
}
// if 6 mesurment every 0.5sec -> avg is over 3sec -> /3 for /s // if 6 mesurment every 0.5sec -> avg is over 3sec -> /3 for /s
avg /= _peer_speed_mesurement_interval * _peer_speed_mesurement_interval_count; avg /= _peer_speed_mesurement_interval * _peer_speed_mesurement_interval_count;
@ -207,12 +225,14 @@ bool SHA1::iterate(float delta) {
_peer_in_bytes_array[peer][_peer_in_bytes_array_index] = 0; _peer_in_bytes_array[peer][_peer_in_bytes_array_index] = 0;
_peer_in_speed[peer] = avg; _peer_in_speed[peer] = avg;
it++;
} }
_peer_in_targets.clear(); _peer_in_targets.clear();
_tcl.forEachGroup([this](uint32_t group_number) { _tcl.forEachGroup([this](uint32_t group_number) {
_tcl.forEachGroupPeer(group_number, [group_number, this](uint32_t peer_number, Tox_Connection connection_status) { _tcl.forEachGroupPeer(group_number, [group_number, this](uint32_t peer_number) {
if (connection_status == Tox_Connection::TOX_CONNECTION_UDP || !_udp_only) { if (!_udp_only || _tcl.getGroupPeerConnectionStatus(group_number, peer_number) == Tox_Connection::TOX_CONNECTION_UDP) {
_peer_in_targets.push_back({group_number, peer_number}); _peer_in_targets.push_back({group_number, peer_number});
} }
}); });
@ -272,14 +292,21 @@ bool SHA1::iterate(float delta) {
float up_kibs {(bytes_up_since / 1024.f) / log_interval}; float up_kibs {(bytes_up_since / 1024.f) / log_interval};
float down_kibs {(bytes_down_since / 1024.f) / log_interval}; float down_kibs {(bytes_down_since / 1024.f) / log_interval};
std::cout << std::string(40, '-') << "\n";
std::cout << "SHA1 speed down: " << down_kibs << "KiB/s up: " << up_kibs << "KiB/s\n"; std::cout << "SHA1 speed down: " << down_kibs << "KiB/s up: " << up_kibs << "KiB/s\n";
std::cout << "SHA1 total down: " << _bytes_down / 1024 << "KiB up: " << _bytes_up / 1024 << "KiB\n"; std::cout << "SHA1 total down: " << _bytes_down / 1024 << "KiB up: " << _bytes_up / 1024 << "KiB\n";
std::cout << "SHA1 cwq:" << _chunk_want_queue.size() << " cwqr:" << _chunks_requested.size() << " trc:" << _transfers_receiving_chunk.size() << " tsc:" << _transfers_sending_chunk.size() << "\n"; std::cout << "SHA1 cwq:" << _chunk_want_queue.size() << " cwqr:" << _chunks_requested.size() << " trc:" << _transfers_receiving_chunk.size() << " tsc:" << _transfers_sending_chunk.size() << "\n";
std::cout << "SHA1 peer down speeds:\n"; std::cout << "SHA1 peer down speeds:\n";
for (const auto& [peer, speed] : _peer_in_speed) { for (const auto& [peer, speed] : _peer_in_speed) {
std::cout << " " << peer.first << ":" << peer.second << "(" << _tcl.getGroupPeerName(peer.first, peer.second) << ")" << "\t" << speed / 1024.f << "KiB/s\n"; std::cout
<< " " << peer.first << ":" << peer.second
<< " " << (_tcl.getGroupPeerConnectionStatus(peer.first, peer.second) == Tox_Connection::TOX_CONNECTION_TCP ? "tcp" : "udp")
<< " (" << _tcl.getGroupPeerName(peer.first, peer.second) << ")"
<< " " << speed / 1024.f << "KiB/s\n"
;
} }
std::cout << std::string(40, '-') << "\n";
} }
// TODO: unmap and remap the file every couple of minutes to keep ram usage down? // TODO: unmap and remap the file every couple of minutes to keep ram usage down?

View File

@ -9,6 +9,7 @@
#include <unordered_map> #include <unordered_map>
#include <map> #include <map>
#include <optional>
#include <vector> #include <vector>
#include <deque> #include <deque>
#include <random> #include <random>
@ -57,9 +58,13 @@ struct SHA1 final : public StateI {
size_t chunkSize(size_t chunk_index) const; size_t chunkSize(size_t chunk_index) const;
bool haveChunk(const SHA1Digest& hash) const; bool haveChunk(const SHA1Digest& hash) const;
private: public: // config
bool _udp_only {false}; bool _udp_only {false};
size_t _max_concurrent_in {32};
size_t _max_concurrent_out {16};
private:
mio::mmap_sink _file_map; // writable if not all mio::mmap_sink _file_map; // writable if not all
const FTInfoSHA1 _sha1_info; const FTInfoSHA1 _sha1_info;
const std::vector<uint8_t> _sha1_info_data; const std::vector<uint8_t> _sha1_info_data;
@ -79,11 +84,7 @@ struct SHA1 final : public StateI {
// chunk_index -> time since request // chunk_index -> time since request
std::map<size_t, float> _chunks_requested; std::map<size_t, float> _chunks_requested;
size_t _max_concurrent_in {32};
size_t _max_concurrent_out {16};
std::minstd_rand _rng {1337}; std::minstd_rand _rng {1337};
std::uniform_int_distribution<size_t> _distrib;
std::unordered_map<SHA1Digest, size_t> _chunk_hash_to_index; std::unordered_map<SHA1Digest, size_t> _chunk_hash_to_index;
@ -114,7 +115,6 @@ struct SHA1 final : public StateI {
// _peer_in_speed feeds directly into _peer_in_targets_dist // _peer_in_speed feeds directly into _peer_in_targets_dist
std::vector<std::pair<uint32_t, uint32_t>> _peer_in_targets; std::vector<std::pair<uint32_t, uint32_t>> _peer_in_targets;
std::discrete_distribution<size_t> _peer_in_targets_dist; std::discrete_distribution<size_t> _peer_in_targets_dist;
}; };
} // States } // States

View File

@ -2,6 +2,8 @@
#include <tox/tox.h> #include <tox/tox.h>
extern "C" {
// logging // logging
void log_cb(Tox *tox, TOX_LOG_LEVEL level, const char *file, uint32_t line, const char *func, const char *message, void *user_data); void log_cb(Tox *tox, TOX_LOG_LEVEL level, const char *file, uint32_t line, const char *func, const char *message, void *user_data);
@ -52,3 +54,5 @@ bool ft1_recv_init_sha1_chunk_cb(Tox *tox, uint32_t group_number, uint32_t peer_
void ft1_recv_data_sha1_chunk_cb(Tox *tox, uint32_t group_number, uint32_t peer_number, uint8_t transfer_id, size_t data_offset, const uint8_t* data, size_t data_size, void* user_data); void ft1_recv_data_sha1_chunk_cb(Tox *tox, uint32_t group_number, uint32_t peer_number, uint8_t transfer_id, size_t data_offset, const uint8_t* data, size_t data_size, void* user_data);
void ft1_send_data_sha1_chunk_cb(Tox *tox, uint32_t group_number, uint32_t peer_number, uint8_t transfer_id, size_t data_offset, uint8_t* data, size_t data_size, void* user_data); void ft1_send_data_sha1_chunk_cb(Tox *tox, uint32_t group_number, uint32_t peer_number, uint8_t transfer_id, size_t data_offset, uint8_t* data, size_t data_size, void* user_data);
} // extern C

View File

@ -122,11 +122,9 @@ ToxClient::ToxClient(const CommandLine& cl) :
_ext_ctx = NGC_EXT_new(); _ext_ctx = NGC_EXT_new();
NGC_FT1_options ft1_options {}; NGC_FT1_options ft1_options {};
ft1_options.acks_per_packet = 5; ft1_options.acks_per_packet = cl.ft_acks_per_packet;
ft1_options.init_retry_timeout_after = 10.f; ft1_options.init_retry_timeout_after = cl.ft_init_retry_timeout_after;
ft1_options.sending_resend_without_ack_after = 5.f; ft1_options.sending_give_up_after = cl.ft_sending_give_up_after;
ft1_options.sending_give_up_after = 30.f;
ft1_options.packet_window_size = 10;
_ft1_ctx = NGC_FT1_new(&ft1_options); _ft1_ctx = NGC_FT1_new(&ft1_options);
NGC_FT1_register_ext(_ft1_ctx, _ext_ctx); NGC_FT1_register_ext(_ft1_ctx, _ext_ctx);
@ -214,6 +212,25 @@ bool ToxClient::iterate(void) {
} }
} }
_rejoin_group_timer -= time_delta;
if (_rejoin_group_timer <= 0.f) {
_rejoin_group_timer = 6.f * 60.f;
forEachGroup([this](const uint32_t group_number) {
// is connected or trying to connect
if (!tox_group_is_connected(_tox, group_number, nullptr)) {
std::cerr << "TCL disconnected group " << group_number << "\n";
return;
}
// never seen another peer
if (_groups.at(group_number).empty()) {
tox_group_reconnect(_tox, group_number, nullptr);
std::cerr << "TCL reconnecting empty group " << group_number << "\n";
}
});
}
if (_tox_profile_dirty) { if (_tox_profile_dirty) {
saveToxProfile(); saveToxProfile();
} }
@ -238,6 +255,10 @@ std::string_view ToxClient::getGroupPeerName(uint32_t group_number, uint32_t pee
} }
} }
TOX_CONNECTION ToxClient::getGroupPeerConnectionStatus(uint32_t group_number, uint32_t peer_number) const {
return tox_group_peer_get_connection_status(_tox, group_number, peer_number, nullptr);
}
void ToxClient::onToxSelfConnectionStatus(TOX_CONNECTION connection_status) { void ToxClient::onToxSelfConnectionStatus(TOX_CONNECTION connection_status) {
std::cout << "TCL self status: "; std::cout << "TCL self status: ";
switch (connection_status) { switch (connection_status) {
@ -247,9 +268,20 @@ void ToxClient::onToxSelfConnectionStatus(TOX_CONNECTION connection_status) {
} }
if (connection_status != TOX_CONNECTION::TOX_CONNECTION_NONE && !_join_group_after_dht_connect.empty()) { if (connection_status != TOX_CONNECTION::TOX_CONNECTION_NONE && !_join_group_after_dht_connect.empty()) {
// TODO: error checking Tox_Err_Group_Join err;
tox_group_join(_tox, _join_group_after_dht_connect.data(), nullptr, 0, nullptr, 0, nullptr); uint32_t new_group_number = tox_group_join(
_tox,
_join_group_after_dht_connect.data(),
reinterpret_cast<const uint8_t*>(_self_name.data()), _self_name.size(),
nullptr, 0,
&err
);
if (err == TOX_ERR_GROUP_JOIN_OK) {
std::cout << "TCL joining group " << bin2hex(_join_group_after_dht_connect) << "\n"; std::cout << "TCL joining group " << bin2hex(_join_group_after_dht_connect) << "\n";
_groups[new_group_number] = {};
} else {
std::cerr << "TCL error joining group failed " << err << "\n";
}
_join_group_after_dht_connect.clear(); _join_group_after_dht_connect.clear();
} }
@ -269,14 +301,14 @@ void ToxClient::onToxGroupPeerName(uint32_t group_number, uint32_t peer_id, std:
_groups[group_number][peer_id].name = name; _groups[group_number][peer_id].name = name;
} }
void ToxClient::onToxGroupPeerConnection(uint32_t group_number, uint32_t peer_id, TOX_CONNECTION connection_status) { //void ToxClient::onToxGroupPeerConnection(uint32_t group_number, uint32_t peer_id, TOX_CONNECTION connection_status) {
std::cout << "TCL peer " << group_number << ":" << peer_id << " status: "; //std::cout << "TCL peer " << group_number << ":" << peer_id << " status: ";
switch (connection_status) { //switch (connection_status) {
case TOX_CONNECTION::TOX_CONNECTION_NONE: std::cout << "offline\n"; break; //case TOX_CONNECTION::TOX_CONNECTION_NONE: std::cout << "offline\n"; break;
case TOX_CONNECTION::TOX_CONNECTION_TCP: std::cout << "TCP-relayed\n"; break; //case TOX_CONNECTION::TOX_CONNECTION_TCP: std::cout << "TCP-relayed\n"; break;
case TOX_CONNECTION::TOX_CONNECTION_UDP: std::cout << "UDP-direct\n"; break; //case TOX_CONNECTION::TOX_CONNECTION_UDP: std::cout << "UDP-direct\n"; break;
} //}
} //}
void ToxClient::onToxGroupCustomPacket(uint32_t group_number, uint32_t peer_id, const uint8_t *data, size_t length) { void ToxClient::onToxGroupCustomPacket(uint32_t group_number, uint32_t peer_id, const uint8_t *data, size_t length) {
// TODO: signal private? // TODO: signal private?
@ -310,7 +342,7 @@ void ToxClient::onToxGroupPeerJoin(uint32_t group_number, uint32_t peer_id) {
tmp_name.push_back('\0'); // make sure its null terminated tmp_name.push_back('\0'); // make sure its null terminated
_groups[group_number][peer_id] = { _groups[group_number][peer_id] = {
tox_group_peer_get_connection_status(_tox, group_number, peer_id, nullptr), //tox_group_peer_get_connection_status(_tox, group_number, peer_id, nullptr),
reinterpret_cast<const char*>(tmp_name.data()) reinterpret_cast<const char*>(tmp_name.data())
}; };
@ -325,6 +357,7 @@ void ToxClient::onToxGroupPeerExit(uint32_t group_number, uint32_t peer_id, Tox_
void ToxClient::onToxGroupSelfJoin(uint32_t group_number) { void ToxClient::onToxGroupSelfJoin(uint32_t group_number) {
std::cout << "TCL group self join " << group_number << "\n"; std::cout << "TCL group self join " << group_number << "\n";
tox_group_self_set_name(_tox, group_number, reinterpret_cast<const uint8_t*>(_self_name.data()), _self_name.size(), nullptr);
// ??? // ???
// can be triggered after other peers already joined o.o // can be triggered after other peers already joined o.o
_tox_profile_dirty = true; _tox_profile_dirty = true;

View File

@ -34,6 +34,7 @@ struct ToxClient {
std::string getOwnAddress(void) const; std::string getOwnAddress(void) const;
std::string_view getGroupPeerName(uint32_t group_number, uint32_t peer_number) const; std::string_view getGroupPeerName(uint32_t group_number, uint32_t peer_number) const;
TOX_CONNECTION getGroupPeerConnectionStatus(uint32_t group_number, uint32_t peer_number) const;
template<typename FN> template<typename FN>
void forEachGroup(FN&& fn) const { void forEachGroup(FN&& fn) const {
@ -46,8 +47,7 @@ struct ToxClient {
void forEachGroupPeer(uint32_t group_number, FN&& fn) const { void forEachGroupPeer(uint32_t group_number, FN&& fn) const {
if (_groups.count(group_number)) { if (_groups.count(group_number)) {
for (const auto& [peer_number, peer] : _groups.at(group_number)) { for (const auto& [peer_number, peer] : _groups.at(group_number)) {
const auto& [connection_status, name] = peer; fn(peer_number);
fn(peer_number, connection_status);
} }
} }
} }
@ -56,7 +56,7 @@ struct ToxClient {
void onToxSelfConnectionStatus(TOX_CONNECTION connection_status); void onToxSelfConnectionStatus(TOX_CONNECTION connection_status);
void onToxFriendRequest(const uint8_t* public_key, std::string_view message); void onToxFriendRequest(const uint8_t* public_key, std::string_view message);
void onToxGroupPeerName(uint32_t group_number, uint32_t peer_id, std::string_view name); void onToxGroupPeerName(uint32_t group_number, uint32_t peer_id, std::string_view name);
void onToxGroupPeerConnection(uint32_t group_number, uint32_t peer_id, TOX_CONNECTION connection_status); //void onToxGroupPeerConnection(uint32_t group_number, uint32_t peer_id, TOX_CONNECTION connection_status);
void onToxGroupCustomPacket(uint32_t group_number, uint32_t peer_id, const uint8_t *data, size_t length); void onToxGroupCustomPacket(uint32_t group_number, uint32_t peer_id, const uint8_t *data, size_t length);
void onToxGroupCustomPrivatePacket(uint32_t group_number, uint32_t peer_id, const uint8_t *data, size_t length); void onToxGroupCustomPrivatePacket(uint32_t group_number, uint32_t peer_id, const uint8_t *data, size_t length);
void onToxGroupInvite(uint32_t friend_number, const uint8_t* invite_data, size_t invite_length, std::string_view group_name); void onToxGroupInvite(uint32_t friend_number, const uint8_t* invite_data, size_t invite_length, std::string_view group_name);
@ -87,15 +87,14 @@ struct ToxClient {
bool _tox_profile_dirty {false}; // set in callbacks bool _tox_profile_dirty {false}; // set in callbacks
std::vector<uint8_t> _join_group_after_dht_connect; std::vector<uint8_t> _join_group_after_dht_connect;
float _rejoin_group_timer {4.f * 60.f};
std::unique_ptr<StateI> _state; std::unique_ptr<StateI> _state;
// key groupid, value set of peer ids
//std::map<uint32_t, std::set<uint32_t>> _groups;
struct Peer { struct Peer {
Tox_Connection connection_status {Tox_Connection::TOX_CONNECTION_NONE};
std::string name; std::string name;
}; };
// key groupid, key peerid
std::map<uint32_t, std::map<uint32_t, Peer>> _groups; std::map<uint32_t, std::map<uint32_t, Peer>> _groups;
}; };