Fixed a possible crash
This commit is contained in:
parent
e80afb1145
commit
6605a440bd
|
@ -62,6 +62,9 @@ void PacketEncoder::send_packet(ts::protocol::OutgoingServerPacket *packet) {
|
|||
packet->set_packet_id(full_id & 0xFFFFU);
|
||||
packet->generation = full_id >> 16U;
|
||||
|
||||
auto category = stats::ConnectionStatistics::category::from_type(packet->packet_type());
|
||||
this->callback_connection_stats(this->callback_data, category, packet->packet_length() + 96); /* 96 for the UDP packet overhead */
|
||||
|
||||
{
|
||||
std::lock_guard qlock{this->write_queue_mutex};
|
||||
*this->encrypt_queue_tail = packet;
|
||||
|
@ -69,9 +72,6 @@ void PacketEncoder::send_packet(ts::protocol::OutgoingServerPacket *packet) {
|
|||
}
|
||||
|
||||
this->callback_request_write(this->callback_data);
|
||||
|
||||
auto category = stats::ConnectionStatistics::category::from_type(packet->packet_type());
|
||||
this->callback_connection_stats(this->callback_data, category, packet->packet_length() + 96); /* 96 for the UDP packet overhead */
|
||||
}
|
||||
|
||||
void PacketEncoder::send_packet(protocol::PacketType type, protocol::PacketFlag::PacketFlags flag, const void *payload, size_t payload_size) {
|
||||
|
@ -216,8 +216,9 @@ void PacketEncoder::send_command(const std::string_view &command, bool low, std:
|
|||
}
|
||||
this->callback_request_write(this->callback_data);
|
||||
|
||||
if(own_data_buffer)
|
||||
if(own_data_buffer) {
|
||||
::free(own_data_buffer_ptr);
|
||||
}
|
||||
}
|
||||
|
||||
void PacketEncoder::encrypt_pending_packets() {
|
||||
|
|
Loading…
Reference in New Issue