Fixed build
This commit is contained in:
parent
bbeeecbc61
commit
c790c8bd08
7
bugs
7
bugs
@ -16,4 +16,9 @@ General:
|
|||||||
Tasks designer:
|
Tasks designer:
|
||||||
TeaCup steam animated
|
TeaCup steam animated
|
||||||
Client redesign dark [+ Chat system]
|
Client redesign dark [+ Chat system]
|
||||||
Redesign loading animation (Web)
|
Redesign loading animation (Web)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Notice:
|
||||||
|
electron-package-manager must be at 8.7.2 (Node 6 support)!
|
@ -84,11 +84,15 @@ export const handler = require( "teaclient_crash_handler");
|
|||||||
|
|
||||||
export function initialize_handler(component_name: string, requires_file: boolean) {
|
export function initialize_handler(component_name: string, requires_file: boolean) {
|
||||||
const start_path = requires_file ? (" " + path.join(__dirname, "..", "..")) : "";
|
const start_path = requires_file ? (" " + path.join(__dirname, "..", "..")) : "";
|
||||||
|
const success_arguments = process.argv[0] + start_path + " crash-handler success=1 dump_path=%crash_path%";
|
||||||
|
const error_arguments = process.argv[0] + start_path + " crash-handler success=0 error=%error_message%";
|
||||||
|
|
||||||
|
console.log("Setting up crash handler. Success callback: %s; Error callback: %s", success_arguments, error_arguments);
|
||||||
handler.setup_crash_handler(
|
handler.setup_crash_handler(
|
||||||
component_name,
|
component_name,
|
||||||
path.join((remote || electron).app.getPath('userData'), "crash_dumps"),
|
path.join((remote || electron).app.getPath('userData'), "crash_dumps"),
|
||||||
process.argv[0] + start_path + " crash-handler success=1 dump_path=%crash_path%",
|
success_arguments,
|
||||||
process.argv[0] + start_path + " crash-handler success=0 error=%error_message%"
|
error_arguments
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,6 @@ function(setup_nodejs)
|
|||||||
)
|
)
|
||||||
target_include_directories(${NAME} PUBLIC ${NODEJS_INCLUDE_DIRS})
|
target_include_directories(${NAME} PUBLIC ${NODEJS_INCLUDE_DIRS})
|
||||||
set_target_properties(${NAME} PROPERTIES CXX_STANDARD 17) #Needs to be overridden after _add_nodejs_module sets it to 11
|
set_target_properties(${NAME} PROPERTIES CXX_STANDARD 17) #Needs to be overridden after _add_nodejs_module sets it to 11
|
||||||
message("Add lib: ${NODEJS_LIBRARIES}")
|
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
add_custom_command(TARGET ${NAME} POST_BUILD
|
add_custom_command(TARGET ${NAME} POST_BUILD
|
||||||
|
Binary file not shown.
@ -83,8 +83,9 @@ include_directories(${DataPipes_INCLUDE_DIR})
|
|||||||
|
|
||||||
find_package(Libevent REQUIRED)
|
find_package(Libevent REQUIRED)
|
||||||
include_directories(${LIBEVENT_INCLUDE_DIRS})
|
include_directories(${LIBEVENT_INCLUDE_DIRS})
|
||||||
|
message("libevent include dir: ${LIBEVENT_INCLUDE_DIRS}")
|
||||||
|
message("libevent static libraries: ${LIBEVENT_STATIC_LIBRARIES}")
|
||||||
|
|
||||||
message(${TeaSpeak_SharedLib_ROOT_DIR})
|
|
||||||
find_package(TeaSpeak_SharedLib REQUIRED)
|
find_package(TeaSpeak_SharedLib REQUIRED)
|
||||||
include_directories(${TeaSpeak_SharedLib_INCLUDE_DIR})
|
include_directories(${TeaSpeak_SharedLib_INCLUDE_DIR})
|
||||||
|
|
||||||
@ -139,6 +140,7 @@ if (WIN32)
|
|||||||
set(REQUIRED_LIBRARIES ${REQUIRED_LIBRARIES} "Ws2_32.Lib")
|
set(REQUIRED_LIBRARIES ${REQUIRED_LIBRARIES} "Ws2_32.Lib")
|
||||||
else()
|
else()
|
||||||
set(REQUIRED_LIBRARIES ${REQUIRED_LIBRARIES}
|
set(REQUIRED_LIBRARIES ${REQUIRED_LIBRARIES}
|
||||||
|
libstdc++fs.a
|
||||||
asound
|
asound
|
||||||
jack
|
jack
|
||||||
pthread
|
pthread
|
||||||
@ -150,4 +152,8 @@ target_link_libraries(${MODULE_NAME} ${REQUIRED_LIBRARIES})
|
|||||||
target_compile_definitions(${MODULE_NAME} PUBLIC -DNODEJS_API)
|
target_compile_definitions(${MODULE_NAME} PUBLIC -DNODEJS_API)
|
||||||
|
|
||||||
add_executable(Audio-Test ${SOURCE_FILES} test/audio/main.cpp)
|
add_executable(Audio-Test ${SOURCE_FILES} test/audio/main.cpp)
|
||||||
target_link_libraries(Audio-Test ${REQUIRED_LIBRARIES})
|
target_link_libraries(Audio-Test ${REQUIRED_LIBRARIES})
|
||||||
|
|
||||||
|
#U SHA512_Final
|
||||||
|
#U SHA512_Init
|
||||||
|
#U SHA512_Update
|
@ -50,7 +50,12 @@ void testTomMath(){
|
|||||||
|
|
||||||
mp_int r{};
|
mp_int r{};
|
||||||
mp_init(&r);
|
mp_init(&r);
|
||||||
assert(mp_exptmod(&x, &exp, &n, &r) != CRYPT_OK); //if this method succeed than tommath failed. Unknown why but it is so
|
|
||||||
|
if(mp_exptmod(&x, &exp, &n, &r) != CRYPT_OK) {
|
||||||
|
Nan::ThrowError("Tomcrypt library is too modern. Use an oder one!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//assert(mp_exptmod(&x, &exp, &n, &r) != CRYPT_OK); //if this method succeed than tommath failed. Unknown why but it is so
|
||||||
|
|
||||||
mp_clear_multi(&x, &n, &exp, &r, nullptr);
|
mp_clear_multi(&x, &n, &exp, &r, nullptr);
|
||||||
}
|
}
|
||||||
@ -63,7 +68,7 @@ tc::audio::AudioOutput* global_audio_output;
|
|||||||
|
|
||||||
NAN_MODULE_INIT(init) {
|
NAN_MODULE_INIT(init) {
|
||||||
logger::initialize_node();
|
logger::initialize_node();
|
||||||
logger::error(category::general, "Hello World from C");
|
logger::info(category::general, "Hello World from C");
|
||||||
|
|
||||||
string error;
|
string error;
|
||||||
//TODO here
|
//TODO here
|
||||||
@ -72,6 +77,7 @@ NAN_MODULE_INIT(init) {
|
|||||||
|
|
||||||
std::thread(audio::devices).detach(); /* cache the devices */
|
std::thread(audio::devices).detach(); /* cache the devices */
|
||||||
|
|
||||||
|
logger::info(category::general, "Loading crypt modules");
|
||||||
std::string descriptors = "LTGE";
|
std::string descriptors = "LTGE";
|
||||||
{
|
{
|
||||||
int crypt_init = false;
|
int crypt_init = false;
|
||||||
@ -93,6 +99,7 @@ NAN_MODULE_INIT(init) {
|
|||||||
|
|
||||||
testTomMath();
|
testTomMath();
|
||||||
}
|
}
|
||||||
|
logger::info(category::general, "Crypt modules loaded");
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
evthread_use_windows_threads();
|
evthread_use_windows_threads();
|
||||||
|
@ -88,13 +88,15 @@ void ProtocolHandler::execute_tick() {
|
|||||||
if(this->connection_state == connection_state::INIT_LOW || this->connection_state == connection_state::INIT_HIGH) {
|
if(this->connection_state == connection_state::INIT_LOW || this->connection_state == connection_state::INIT_HIGH) {
|
||||||
if(this->connect_timestamp < now - seconds(15)) {
|
if(this->connect_timestamp < now - seconds(15)) {
|
||||||
this->handle->call_connect_result.call(this->handle->errors.register_error("timeout (" + to_string(this->connection_state) + ")"), true);
|
this->handle->call_connect_result.call(this->handle->errors.register_error("timeout (" + to_string(this->connection_state) + ")"), true);
|
||||||
this->close_connection();
|
this->handle->close_connection();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this->connection_state == connection_state::DISCONNECTING) {
|
if(this->connection_state == connection_state::DISCONNECTING) {
|
||||||
if(this->disconnect_timestamp < now - seconds(5)) { /* disconnect timeout */
|
if(this->disconnect_timestamp < now - seconds(5)) { /* disconnect timeout */
|
||||||
this->close_connection();
|
this->handle->close_connection();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +110,8 @@ void ProtocolHandler::execute_tick() {
|
|||||||
if(this->ping.ping_received_timestamp.time_since_epoch().count() > 0) {
|
if(this->ping.ping_received_timestamp.time_since_epoch().count() > 0) {
|
||||||
if(now - this->ping.ping_received_timestamp > seconds(30)) {
|
if(now - this->ping.ping_received_timestamp > seconds(30)) {
|
||||||
this->handle->execute_callback_disconnect.call(tr("ping timeout"), true);
|
this->handle->execute_callback_disconnect.call(tr("ping timeout"), true);
|
||||||
this->close_connection();
|
this->handle->close_connection();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
this->ping.ping_received_timestamp = now;
|
this->ping.ping_received_timestamp = now;
|
||||||
@ -504,7 +507,7 @@ void ProtocolHandler::send_acknowledge(uint16_t packet_id, bool low) {
|
|||||||
this->send_packet(packet);
|
this->send_packet(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProtocolHandler::close_connection() {
|
void ProtocolHandler::do_close_connection() {
|
||||||
this->connection_state = connection_state::DISCONNECTED;
|
this->connection_state = connection_state::DISCONNECTED;
|
||||||
for(auto& buffer : this->_packet_buffers) {
|
for(auto& buffer : this->_packet_buffers) {
|
||||||
lock_guard lock(buffer.buffer_lock);
|
lock_guard lock(buffer.buffer_lock);
|
||||||
|
@ -54,7 +54,7 @@ namespace tc {
|
|||||||
class ProtocolHandler {
|
class ProtocolHandler {
|
||||||
typedef ts::protocol::PacketRingBuffer<ts::protocol::ServerPacket, 86> packet_buffer_t;
|
typedef ts::protocol::PacketRingBuffer<ts::protocol::ServerPacket, 86> packet_buffer_t;
|
||||||
typedef std::array<packet_buffer_t, 8> packet_buffers_t;
|
typedef std::array<packet_buffer_t, 8> packet_buffers_t;
|
||||||
|
friend class ServerConnection;
|
||||||
public:
|
public:
|
||||||
ProtocolHandler(ServerConnection*);
|
ProtocolHandler(ServerConnection*);
|
||||||
~ProtocolHandler();
|
~ProtocolHandler();
|
||||||
@ -69,16 +69,17 @@ namespace tc {
|
|||||||
void send_packet(const std::shared_ptr<ts::protocol::ClientPacket>& /* packet */);
|
void send_packet(const std::shared_ptr<ts::protocol::ClientPacket>& /* packet */);
|
||||||
void send_command(const ts::Command& /* command */, const std::function<void(bool)> & /* acknowledge callback */ = NULL);
|
void send_command(const ts::Command& /* command */, const std::function<void(bool)> & /* acknowledge callback */ = NULL);
|
||||||
|
|
||||||
void send_acknowledge(uint16_t /* packet id */, bool /* low */);
|
|
||||||
|
|
||||||
void disconnect(const std::string& /* message */);
|
void disconnect(const std::string& /* message */);
|
||||||
void close_connection();
|
|
||||||
|
void send_acknowledge(uint16_t /* packet id */, bool /* low */);
|
||||||
|
|
||||||
ecc_key& get_identity_key() { return this->crypto.identity; }
|
ecc_key& get_identity_key() { return this->crypto.identity; }
|
||||||
|
|
||||||
connection_state::value connection_state = connection_state::INITIALIZING;
|
connection_state::value connection_state = connection_state::INITIALIZING;
|
||||||
server_type::value server_type = server_type::TEASPEAK;
|
server_type::value server_type = server_type::TEASPEAK;
|
||||||
private:
|
private:
|
||||||
|
void do_close_connection(); /* only call from ServerConnection. Close all connections via ServerConnection! */
|
||||||
|
|
||||||
void handlePacketCommand(const std::shared_ptr<ts::protocol::ServerPacket>&);
|
void handlePacketCommand(const std::shared_ptr<ts::protocol::ServerPacket>&);
|
||||||
void handlePacketAck(const std::shared_ptr<ts::protocol::ServerPacket>&);
|
void handlePacketAck(const std::shared_ptr<ts::protocol::ServerPacket>&);
|
||||||
void handlePacketVoice(const std::shared_ptr<ts::protocol::ServerPacket>&);
|
void handlePacketVoice(const std::shared_ptr<ts::protocol::ServerPacket>&);
|
||||||
|
@ -41,14 +41,9 @@ std::string ProtocolHandler::generate_client_initiv() {
|
|||||||
if(this->server_type != server_type::TEAMSPEAK) /* if TEAMSPEAK then TS3 has been enforced */
|
if(this->server_type != server_type::TEAMSPEAK) /* if TEAMSPEAK then TS3 has been enforced */
|
||||||
command.enableParm("teaspeak"); /* using "old" encryption system, we expect a teaspeak=1 within the response */
|
command.enableParm("teaspeak"); /* using "old" encryption system, we expect a teaspeak=1 within the response */
|
||||||
{
|
{
|
||||||
size_t buffer_length = 265 + 5;
|
size_t buffer_length = 265;
|
||||||
char buffer[265 + 5];
|
char buffer[265];
|
||||||
auto result = ecc_export((unsigned char *) buffer, (unsigned long*) &buffer_length, PK_PUBLIC, &this->crypto.identity);
|
auto result = ecc_export((unsigned char *) buffer, (unsigned long*) &buffer_length, PK_PUBLIC, &this->crypto.identity);
|
||||||
buffer[265] = rand();
|
|
||||||
buffer[266] = rand();
|
|
||||||
buffer[267] = rand();
|
|
||||||
buffer[268] = rand();
|
|
||||||
buffer[269] = rand();
|
|
||||||
if(result == CRYPT_OK)
|
if(result == CRYPT_OK)
|
||||||
command["omega"] = base64::encode(buffer, buffer_length);
|
command["omega"] = base64::encode(buffer, buffer_length);
|
||||||
else
|
else
|
||||||
@ -160,8 +155,8 @@ void ProtocolHandler::handleCommandInitIVExpend2(ts::Command &cmd) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int result;
|
int result, crypt_result;
|
||||||
if(ecc_verify_hash((u_char*) proof.data(), proof.length(), (u_char*) crypto_hash.data(), crypto_hash.length(), &result, &server_key) != CRYPT_OK || result != 1) {
|
if((crypt_result = ecc_verify_hash((u_char*) proof.data(), proof.length(), (u_char*) crypto_hash.data(), crypto_hash.length(), &result, &server_key)) != CRYPT_OK || result != 1) {
|
||||||
this->handle->call_connect_result.call(this->handle->errors.register_error(tr("failed to verify server integrity")), true);
|
this->handle->call_connect_result.call(this->handle->errors.register_error(tr("failed to verify server integrity")), true);
|
||||||
this->handle->close_connection();
|
this->handle->close_connection();
|
||||||
return;
|
return;
|
||||||
|
@ -141,6 +141,8 @@ void ServerConnection::event_loop() {
|
|||||||
auto best = this->next_tick;
|
auto best = this->next_tick;
|
||||||
if(this->next_resend < best)
|
if(this->next_resend < best)
|
||||||
best = this->next_resend;
|
best = this->next_resend;
|
||||||
|
if(this->event_loop_execute_connection_close)
|
||||||
|
return system_clock::time_point{};
|
||||||
return best;
|
return best;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -157,6 +159,10 @@ void ServerConnection::event_loop() {
|
|||||||
if(this->event_loop_exit)
|
if(this->event_loop_exit)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if(this->event_loop_execute_connection_close) {
|
||||||
|
this->close_connection();
|
||||||
|
this->event_loop_execute_connection_close = false;
|
||||||
|
}
|
||||||
auto date = chrono::system_clock::now();
|
auto date = chrono::system_clock::now();
|
||||||
if(this->next_tick <= date) {
|
if(this->next_tick <= date) {
|
||||||
this->next_tick = date + chrono::milliseconds(500);
|
this->next_tick = date + chrono::milliseconds(500);
|
||||||
@ -485,10 +491,22 @@ void ServerConnection::send_voice_data(const void *buffer, size_t buffer_length,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ServerConnection::close_connection() {
|
void ServerConnection::close_connection() {
|
||||||
|
if(this_thread::get_id() == this->socket->io_thread().get_id()) {
|
||||||
|
logger::debug(category::connection, tr("close_connection() called in IO thread. Closing connection within event loop!"));
|
||||||
|
lock_guard lock(this->disconnect_lock);
|
||||||
|
if(!this->event_loop_execute_connection_close) {
|
||||||
|
this->event_loop_execute_connection_close = true;
|
||||||
|
this->event_condition.notify_one();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
lock_guard lock(this->disconnect_lock);
|
lock_guard lock(this->disconnect_lock);
|
||||||
if(this->socket)
|
this->event_loop_execute_connection_close = false;
|
||||||
|
if(this->socket) {
|
||||||
this->socket->finalize();
|
this->socket->finalize();
|
||||||
this->protocol_handler->close_connection();
|
}
|
||||||
|
this->protocol_handler->do_close_connection();
|
||||||
this->socket = nullptr;
|
this->socket = nullptr;
|
||||||
this->call_disconnect_result.call(0, true);
|
this->call_disconnect_result.call(0, true);
|
||||||
}
|
}
|
||||||
|
@ -105,6 +105,8 @@ namespace tc {
|
|||||||
bool event_loop_exit = false; /* set to true if we want to exit */
|
bool event_loop_exit = false; /* set to true if we want to exit */
|
||||||
void event_loop();
|
void event_loop();
|
||||||
|
|
||||||
|
bool event_loop_execute_connection_close = false;
|
||||||
|
|
||||||
std::chrono::system_clock::time_point next_tick;
|
std::chrono::system_clock::time_point next_tick;
|
||||||
std::chrono::system_clock::time_point next_resend;
|
std::chrono::system_clock::time_point next_resend;
|
||||||
void execute_tick();
|
void execute_tick();
|
||||||
|
@ -42,11 +42,11 @@ bool UDPSocket::initialize() {
|
|||||||
this->event_write = event_new(this->io_base, this->file_descriptor, EV_WRITE, &UDPSocket::_callback_write, this);
|
this->event_write = event_new(this->io_base, this->file_descriptor, EV_WRITE, &UDPSocket::_callback_write, this);
|
||||||
event_add(this->event_read, nullptr);
|
event_add(this->event_read, nullptr);
|
||||||
|
|
||||||
this->io_thread = thread(&UDPSocket::_io_execute, this);
|
this->_io_thread = thread(&UDPSocket::_io_execute, this);
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
//TODO set thread name
|
//TODO set thread name
|
||||||
#else
|
#else
|
||||||
auto handle = this->io_thread.native_handle();
|
auto handle = this->_io_thread.native_handle();
|
||||||
pthread_setname_np(handle, "UDPSocket loop");
|
pthread_setname_np(handle, "UDPSocket loop");
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
@ -64,7 +64,7 @@ void UDPSocket::finalize() {
|
|||||||
this->event_write = nullptr;
|
this->event_write = nullptr;
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
|
|
||||||
assert(this_thread::get_id() != this->io_thread.get_id());
|
assert(this_thread::get_id() != this->_io_thread.get_id());
|
||||||
if(event_read)
|
if(event_read)
|
||||||
event_del_block(event_read);
|
event_del_block(event_read);
|
||||||
if(event_write)
|
if(event_write)
|
||||||
@ -81,8 +81,8 @@ void UDPSocket::finalize() {
|
|||||||
event_base_loopexit(io_base, nullptr);
|
event_base_loopexit(io_base, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this->io_thread.joinable())
|
if(this->_io_thread.joinable())
|
||||||
this->io_thread.join();
|
this->_io_thread.join();
|
||||||
|
|
||||||
if(io_base)
|
if(io_base)
|
||||||
event_base_free(io_base);
|
event_base_free(io_base);
|
||||||
|
@ -30,6 +30,8 @@ namespace tc {
|
|||||||
void send_message(const pipes::buffer_view& /* message */);
|
void send_message(const pipes::buffer_view& /* message */);
|
||||||
|
|
||||||
std::function<void(const pipes::buffer_view& /* message */)> on_data;
|
std::function<void(const pipes::buffer_view& /* message */)> on_data;
|
||||||
|
|
||||||
|
const std::thread& io_thread() { return this->_io_thread; }
|
||||||
private:
|
private:
|
||||||
static void _io_execute(void *_ptr_socket);
|
static void _io_execute(void *_ptr_socket);
|
||||||
static void _callback_read(evutil_socket_t, short, void*);
|
static void _callback_read(evutil_socket_t, short, void*);
|
||||||
@ -44,7 +46,7 @@ namespace tc {
|
|||||||
int file_descriptor = 0;
|
int file_descriptor = 0;
|
||||||
|
|
||||||
std::recursive_mutex io_lock;
|
std::recursive_mutex io_lock;
|
||||||
std::thread io_thread;
|
std::thread _io_thread;
|
||||||
event_base* io_base = nullptr;
|
event_base* io_base = nullptr;
|
||||||
|
|
||||||
event* event_read = nullptr;
|
event* event_read = nullptr;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
"start": "electron --js-flags='--expose-gc' --debug --dev-tools --disable-hardware-acceleration .",
|
"start": "electron --js-flags='--expose-gc' --debug --dev-tools --disable-hardware-acceleration .",
|
||||||
"start-d": "electron . --debug -t -su http://dev.clientapi.teaspeak.de/",
|
"start-d": "electron . --debug -t -su http://dev.clientapi.teaspeak.de/",
|
||||||
"start-n": "electron . -t -su http://null.teaspeak.de/",
|
"start-n": "electron . -t --no-single-instance -su http://null.teaspeak.de/",
|
||||||
"start-01": "electron . --updater-channel=test -u=http://dev.clientapi.teaspeak.de/ -d --updater-ui-loader_type=0 --updater-local-version=1.0.1",
|
"start-01": "electron . --updater-channel=test -u=http://dev.clientapi.teaspeak.de/ -d --updater-ui-loader_type=0 --updater-local-version=1.0.1",
|
||||||
"compile-sass": "sass --update .:.",
|
"compile-sass": "sass --update .:.",
|
||||||
"compile-tsc": "tsc",
|
"compile-tsc": "tsc",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user