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->set_packet_id(full_id & 0xFFFFU);
|
||||||
packet->generation = full_id >> 16U;
|
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};
|
std::lock_guard qlock{this->write_queue_mutex};
|
||||||
*this->encrypt_queue_tail = packet;
|
*this->encrypt_queue_tail = packet;
|
||||||
@ -69,9 +72,6 @@ void PacketEncoder::send_packet(ts::protocol::OutgoingServerPacket *packet) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this->callback_request_write(this->callback_data);
|
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) {
|
void PacketEncoder::send_packet(protocol::PacketType type, protocol::PacketFlag::PacketFlags flag, const void *payload, size_t payload_size) {
|
||||||
@ -216,9 +216,10 @@ void PacketEncoder::send_command(const std::string_view &command, bool low, std:
|
|||||||
}
|
}
|
||||||
this->callback_request_write(this->callback_data);
|
this->callback_request_write(this->callback_data);
|
||||||
|
|
||||||
if(own_data_buffer)
|
if(own_data_buffer) {
|
||||||
::free(own_data_buffer_ptr);
|
::free(own_data_buffer_ptr);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void PacketEncoder::encrypt_pending_packets() {
|
void PacketEncoder::encrypt_pending_packets() {
|
||||||
OutgoingServerPacket* packets_head;
|
OutgoingServerPacket* packets_head;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user