Some minor refactoring, removed jemalloc and added the address sanitize

This commit is contained in:
WolverinDEV 2021-01-24 10:34:19 +01:00
parent 9784ce9351
commit ffd5b64177
6 changed files with 26 additions and 12 deletions

View File

@ -10,6 +10,7 @@ set(TEASPEAK_SERVER ON)
#set(MEMORY_DEBUG_FLAGS " -fsanitize=leak -fsanitize=address -fstack-protector-all ")
#set(MEMORY_DEBUG_FLAGS "-fsanitize=address -fstack-protector-all")
#set(MEMORY_DEBUG_FLAGS "-fstack-protector-all")
set(MEMORY_DEBUG_FLAGS " -fsanitize=address ")
if (NOT BUILD_OS_ARCH)
set(BUILD_OS_ARCH $ENV{build_os_arch})

View File

@ -295,17 +295,17 @@ bool LicenseServer::handlePacketPropertyUpdate(shared_ptr<ConnectedClient> &clie
this->manager->logStatistic(client->key, client->unique_identifier, client->address(), pkt);
//TODO test stuff if its possible!
ts::proto::license::WebCertificate* web_certificate{nullptr};
ts::proto::license::WebCertificate* proto_web_certificate{nullptr};
if(pkt.has_web_cert_revision()) {
logMessage(LOG_GENERAL, "[CLIENT][" + client->address() + "] -------------------------------");
logMessage(LOG_GENERAL, "[CLIENT][" + client->address() + "] Web cert revision : " + hex::hex(pkt.web_cert_revision()));
auto cert = this->web_certificate;
if(cert && cert->revision != pkt.web_cert_revision()) {
web_certificate = new ts::proto::license::WebCertificate{};
web_certificate->set_key(cert->key);
web_certificate->set_certificate(cert->certificate);
web_certificate->set_revision(cert->revision);
proto_web_certificate = new ts::proto::license::WebCertificate{};
proto_web_certificate->set_key(cert->key);
proto_web_certificate->set_certificate(cert->certificate);
proto_web_certificate->set_revision(cert->revision);
}
}
@ -314,7 +314,7 @@ bool LicenseServer::handlePacketPropertyUpdate(shared_ptr<ConnectedClient> &clie
response.set_reset_speach(pkt.speach_total() < 0);
response.set_speach_total_remote(pkt.speach_total());
response.set_speach_varianz_corrector(0);
response.set_allocated_web_certificate(web_certificate);
response.set_allocated_web_certificate(proto_web_certificate);
client->sendPacket(protocol::packet{protocol::PACKET_SERVER_PROPERTY_ADJUSTMENT, response});
this->disconnectClient(client, "finished");

View File

@ -293,7 +293,7 @@ target_link_libraries(TeaSpeakServer
breakpad::static
protobuf::libprotobuf
jemalloc::shared
#jemalloc::shared
tomcrypt::static
tommath::static

View File

@ -194,6 +194,7 @@ int main(int argc, char** argv) {
return 0;
}
#endif
CLIParser arguments(argc, argv);
SSL_load_error_strings();
OpenSSL_add_ssl_algorithms();
@ -297,6 +298,13 @@ int main(int argc, char** argv) {
}
}
/*
{
void* ptr = malloc(1234);
free(ptr);
free(ptr);
}
*/
/*
std::string error;
if(!interaction::waitForAttach(error)){
cerr << "Rsult: " << error << endl;

View File

@ -62,8 +62,9 @@ PacketProcessResult PacketDecoder::process_incoming_data(ClientPacketParser &pac
#endif
#endif
auto result = this->decode_incoming_packet(error, packet_parser);
if(result != PacketProcessResult::SUCCESS)
if(result != PacketProcessResult::SUCCESS) {
return result;
}
#ifdef LOG_INCOMPING_PACKET_FRAGMENTS
debugMessage(lstream << CLIENT_LOG_PREFIX << "Recived packet. PacketId: " << packet->packetId() << " PacketType: " << packet->type().name() << " Flags: " << packet->flags() << " - " << packet->data() << endl);
@ -108,13 +109,15 @@ PacketProcessResult PacketDecoder::process_incoming_data(ClientPacketParser &pac
ReassembledCommand* command{nullptr};
CommandReassembleResult assemble_result;
do {
if(!queue_lock.owns_lock())
if(!queue_lock.owns_lock()) {
queue_lock.lock();
}
assemble_result = this->try_reassemble_ordered_packet(fragment_buffer, queue_lock, command);
if(assemble_result == CommandReassembleResult::SUCCESS || assemble_result == CommandReassembleResult::MORE_COMMANDS_PENDING)
if(assemble_result == CommandReassembleResult::SUCCESS || assemble_result == CommandReassembleResult::MORE_COMMANDS_PENDING) {
this->callback_decoded_command(this->callback_argument, command);
}
if(command) {
/* ownership hasn't transferred */

View File

@ -71,14 +71,16 @@ std::string VoiceClientConnection::log_prefix() {
}
void VoiceClientConnection::triggerWrite() {
if(this->current_client->voice_server)
if(this->current_client->voice_server) {
this->current_client->voice_server->triggerWrite(dynamic_pointer_cast<VoiceClient>(this->current_client->_this.lock()));
}
}
void VoiceClientConnection::handle_incoming_datagram(const pipes::buffer_view& buffer) {
ClientPacketParser packet_parser{buffer};
if(!packet_parser.valid())
if(!packet_parser.valid()) {
return;
}
#ifndef CONNECTION_NO_STATISTICS
if(this->current_client) {