Merge branch 'master' of https://git.did.science/WolverinDEV/TeaSpeak-Client
This commit is contained in:
		
						commit
						a39f573a5f
					
				| @ -110,7 +110,7 @@ if (MSVC) | ||||
| 	foreach(CompilerFlag ${CompilerFlags}) | ||||
| 		string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}") | ||||
| 	endforeach() | ||||
| 	add_compile_options("/EHa") #We require exception handling | ||||
| 	add_compile_options("/EHsc") #We require exception handling | ||||
| else() | ||||
| 	#This is a bad thing here! | ||||
| 	function(resolve_library VARIABLE FALLBACK PATHS) | ||||
|  | ||||
| @ -8,6 +8,7 @@ | ||||
| 
 | ||||
| #include <experimental/filesystem> | ||||
| #include <iostream> | ||||
| #include <thread> | ||||
| #include "base64.h" | ||||
| 
 | ||||
| using namespace std; | ||||
| @ -151,12 +152,12 @@ bool crash_callback(const fs::path& source_file, CrashContext* context, const st | ||||
| 	return succeeded; | ||||
| } | ||||
| 
 | ||||
| bool signal::setup(std::unique_ptr<CrashContext>& context) { | ||||
| extern void create_minidump(struct _EXCEPTION_POINTERS* apExceptionInfo); | ||||
| 
 | ||||
| bool signal::setup(std::unique_ptr<CrashContext>& context) { | ||||
| #ifndef WIN32 | ||||
| 	global_crash_handler = make_unique<google_breakpad::ExceptionHandler>(google_breakpad::MinidumpDescriptor("/tmp"), nullptr, breakpad_crash_callback, nullptr, true, -1); | ||||
| #else | ||||
|     //SetUnhandledExceptionFilter(unhandled_handler);
 | ||||
|     global_crash_handler = AddVectoredExceptionHandler(0, unhandled_handler); /* this only works! */ | ||||
| #endif | ||||
| 	crash_context = move(context); | ||||
| @ -173,6 +174,7 @@ void signal::finalize() { | ||||
| #else | ||||
| 	if(global_crash_handler) | ||||
|         RemoveVectoredExceptionHandler(global_crash_handler); | ||||
| 
 | ||||
|     global_crash_handler = nullptr; | ||||
| #endif | ||||
| 	crash_context.reset(); | ||||
|  | ||||
| @ -85,6 +85,25 @@ void create_minidump(struct _EXCEPTION_POINTERS* apExceptionInfo) | ||||
| } | ||||
| 
 | ||||
| LONG WINAPI unhandled_handler(struct _EXCEPTION_POINTERS* apExceptionInfo) { | ||||
|     auto code = apExceptionInfo->ExceptionRecord->ExceptionCode; | ||||
|     auto crash = false; | ||||
|     switch(code) { | ||||
|         case EXCEPTION_ACCESS_VIOLATION: | ||||
|         case EXCEPTION_ILLEGAL_INSTRUCTION: | ||||
|         case EXCEPTION_STACK_OVERFLOW: | ||||
|         case EXCEPTION_FLT_DIVIDE_BY_ZERO: | ||||
|         case EXCEPTION_INT_DIVIDE_BY_ZERO: | ||||
|         case EXCEPTION_IN_PAGE_ERROR: | ||||
|         case EXCEPTION_NONCONTINUABLE_EXCEPTION: | ||||
|             crash = true; | ||||
|             break; | ||||
|         default: | ||||
|             crash = false; | ||||
|     } | ||||
| 
 | ||||
|     if(!crash) | ||||
|         return EXCEPTION_CONTINUE_SEARCH; | ||||
| 
 | ||||
|     create_minidump(apExceptionInfo); | ||||
|     exit(1); | ||||
|     return EXCEPTION_EXECUTE_HANDLER; | ||||
|  | ||||
| @ -155,7 +155,7 @@ void ProtocolHandler::progress_packet(const pipes::buffer_view &buffer) { | ||||
| 		return; | ||||
| 	} | ||||
| 
 | ||||
| 	auto packet = std::make_shared<ServerPacket>(buffer); | ||||
| 	auto packet = std::shared_ptr<ts::protocol::ServerPacket>(ts::protocol::ServerPacket::from_buffer(buffer).release()); | ||||
| 	auto packet_type = packet->type(); | ||||
| 	auto packet_id = packet->packetId(); | ||||
| 	auto ordered = packet_type.type() == protocol::COMMAND || packet_type.type() == protocol::COMMAND_LOW; | ||||
| @ -502,9 +502,10 @@ void ProtocolHandler::send_acknowledge(uint16_t packet_id, bool low) { | ||||
| 	char buffer[2]; | ||||
| 	le2be16(packet_id, buffer); | ||||
| 	auto packet = make_shared<protocol::ClientPacket>(low ? protocol::PacketTypeInfo::AckLow : protocol::PacketTypeInfo::Ack, 0, pipes::buffer_view{buffer, 2}); | ||||
| 	if(this->connection_state >= connection_state::CONNECTING) | ||||
| 		;//packet->toggle(protocol::PacketFlag::NewProtocol, !low);
 | ||||
| 		//LivingBots DDOS protection dont want a new protocol here!
 | ||||
| 	if(this->connection_state >= connection_state::CONNECTING) { | ||||
|         ;//packet->toggle(protocol::PacketFlag::NewProtocol, !low);
 | ||||
|         //LivingBots DDOS protection dont want a new protocol here!
 | ||||
| 	} | ||||
| 	this->send_packet(packet); | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -553,7 +553,7 @@ static shared_ptr<ts::protocol::ClientPacket> shuffle_cached_packet; | ||||
| #endif | ||||
| void ServerConnection::send_voice_data(const void *buffer, size_t buffer_length, uint8_t codec, bool head) { | ||||
| 	auto _buffer = pipes::buffer{ts::protocol::ClientPacket::META_SIZE + buffer_length + 3}; | ||||
| 	auto packet = make_shared<ts::protocol::ClientPacket>(_buffer); | ||||
| 	auto packet = ts::protocol::ClientPacket::from_buffer(_buffer); | ||||
| 	memset(&_buffer[ts::protocol::ClientPacket::META_MAC_SIZE], 0, ts::protocol::ClientPacket::META_HEADER_SIZE); /* reset all header data */ | ||||
| 	packet->type(ts::protocol::PacketTypeInfo::Voice); | ||||
| 
 | ||||
| @ -581,7 +581,7 @@ void ServerConnection::send_voice_data(const void *buffer, size_t buffer_length, | ||||
| 		shuffle_cached_packet = packet; | ||||
| 	} | ||||
| #else | ||||
| 	this->protocol_handler->send_packet(packet); | ||||
| 	this->protocol_handler->send_packet(std::shared_ptr<ts::protocol::ClientPacket>(packet.release())); | ||||
| #endif | ||||
| } | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user