Fixed some bugs

This commit is contained in:
WolverinDEV
2019-10-20 12:09:28 +02:00
parent 0c6fd1f864
commit 0bedf6c42a
21 changed files with 147 additions and 86 deletions
@@ -76,10 +76,8 @@ void VoiceClientConnection::handleDatagramReceived(const pipes::buffer_view& buf
#endif
#endif
auto packet = std::make_unique<ClientPacket>(buffer);
//packet
auto packet = ClientPacket::from_buffer(buffer);
//packet->type().type()
auto packet_type = packet->type();
auto packet_id = packet->packetId();
auto ordered = packet_type.type() == protocol::COMMAND || packet_type.type() == protocol::COMMAND_LOW;
@@ -427,7 +425,7 @@ unique_ptr<protocol::ClientPacket> VoiceClientConnection::next_reassembled_packe
);
}
final_packet = make_unique<ClientPacket>(packet_buffer);
final_packet = ClientPacket::from_buffer(packet_buffer);
final_packet->setCompressed(final_packet->has_flag(PacketFlag::Compressed));
} else {
final_packet = buffer->pop_front();
@@ -455,12 +453,13 @@ void VoiceClientConnection::sendPacket(const shared_ptr<protocol::ServerPacket>&
shared_ptr<protocol::ServerPacket> packet;
if(copy) {
packet.reset(new protocol::ServerPacket(original_packet->buffer().dup(buffer::allocate_buffer(original_packet->buffer().length()))));
packet = protocol::ServerPacket::from_buffer(original_packet->buffer().dup(buffer::allocate_buffer(original_packet->buffer().length())));
if(original_packet->getListener())
packet->setListener(std::move(original_packet->getListener()));
packet->memory_state.flags = original_packet->memory_state.flags;
} else
} else {
packet = original_packet;
}
if(prepare_directly) {
vector<pipes::buffer> buffers;