Compare commits
9 Commits
e4f6f5eb22
...
master
Author | SHA1 | Date | |
---|---|---|---|
3567aba4db | |||
9b07cb4dce | |||
c89bba25a3 | |||
f9bc83811c | |||
5c4bb1aa42 | |||
2a143a4c2e | |||
3072d2936e | |||
7458841417 | |||
2b3ee3316a |
1
.github/FUNDING.yml
vendored
Normal file
1
.github/FUNDING.yml
vendored
Normal file
@ -0,0 +1 @@
|
||||
github: Green-Sky
|
6
.github/workflows/cd.yml
vendored
6
.github/workflows/cd.yml
vendored
@ -21,7 +21,7 @@ jobs:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install Dependencies
|
||||
run: vcpkg install libsodium:x64-windows pthreads:x64-windows
|
||||
run: vcpkg install libsodium:x64-windows-static pthreads:x64-windows-static
|
||||
|
||||
# setup vs env
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
@ -29,14 +29,14 @@ jobs:
|
||||
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
|
||||
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: windows_msvc_x86-64
|
||||
name: ${{ github.event.repository.name }}-windows-msvc-x86_64
|
||||
# TODO: do propper packing
|
||||
path: |
|
||||
${{github.workspace}}/build/bin/
|
||||
|
@ -36,7 +36,7 @@ if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL
|
||||
)
|
||||
|
||||
if (NOT WIN32)
|
||||
link_libraries(-fsanitize=address,undefined)
|
||||
#link_libraries(-fsanitize=address,undefined)
|
||||
#link_libraries(-fsanitize=undefined)
|
||||
endif()
|
||||
elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
|
||||
|
2
external/tox_ngc_ext/tox_ngc_ext
vendored
2
external/tox_ngc_ext/tox_ngc_ext
vendored
Submodule external/tox_ngc_ext/tox_ngc_ext updated: 2b186a3071...026bf080c3
2
external/tox_ngc_ft1/tox_ngc_ft1
vendored
2
external/tox_ngc_ft1/tox_ngc_ft1
vendored
Submodule external/tox_ngc_ft1/tox_ngc_ft1 updated: 27aeb03a61...08a083f346
2
external/toxcore/CMakeLists.txt
vendored
2
external/toxcore/CMakeLists.txt
vendored
@ -91,6 +91,8 @@ add_library(toxcore STATIC
|
||||
${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
|
||||
|
2
external/toxcore/c-toxcore
vendored
2
external/toxcore/c-toxcore
vendored
Submodule external/toxcore/c-toxcore updated: 172f279dc0...24b54722ae
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
#include <vector>
|
||||
|
||||
// returns the 20bytes sha1 hash
|
||||
|
@ -176,10 +176,10 @@ void ReceiveStartSHA1::onFT1ReceiveDataSHA1Info(uint32_t group_number, uint32_t
|
||||
std::cerr << "ReceiveStartSHA1 received info's hash does not match!, discarding\n";
|
||||
_transfer.reset();
|
||||
_sha1_info_data.clear();
|
||||
} else {
|
||||
std::cout << "ReceiveStartSHA1 info tansfer finished " << group_number << ":" << peer_number << "." << int(transfer_id) << "\n";
|
||||
_done = true;
|
||||
}
|
||||
|
||||
std::cout << "ReceiveStartSHA1 info tansfer finished " << group_number << ":" << peer_number << "." << int(transfer_id) << "\n";
|
||||
_done = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include <unordered_map>
|
||||
#include <map>
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
#include <random>
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
#include <tox/tox.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
// 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);
|
||||
|
||||
@ -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_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
|
||||
|
||||
|
@ -212,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) {
|
||||
saveToxProfile();
|
||||
}
|
||||
@ -249,9 +268,20 @@ void ToxClient::onToxSelfConnectionStatus(TOX_CONNECTION connection_status) {
|
||||
}
|
||||
|
||||
if (connection_status != TOX_CONNECTION::TOX_CONNECTION_NONE && !_join_group_after_dht_connect.empty()) {
|
||||
// TODO: error checking
|
||||
tox_group_join(_tox, _join_group_after_dht_connect.data(), nullptr, 0, nullptr, 0, nullptr);
|
||||
std::cout << "TCL joining group " << bin2hex(_join_group_after_dht_connect) << "\n";
|
||||
Tox_Err_Group_Join err;
|
||||
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";
|
||||
_groups[new_group_number] = {};
|
||||
} else {
|
||||
std::cerr << "TCL error joining group failed " << err << "\n";
|
||||
}
|
||||
_join_group_after_dht_connect.clear();
|
||||
}
|
||||
|
||||
|
@ -87,6 +87,7 @@ struct ToxClient {
|
||||
bool _tox_profile_dirty {false}; // set in callbacks
|
||||
|
||||
std::vector<uint8_t> _join_group_after_dht_connect;
|
||||
float _rejoin_group_timer {4.f * 60.f};
|
||||
|
||||
std::unique_ptr<StateI> _state;
|
||||
|
||||
|
Reference in New Issue
Block a user