Fixed a crash related to the whisper system and some minor updates
This commit is contained in:
@@ -18,6 +18,8 @@ WhisperHandler::~WhisperHandler() {
|
||||
}
|
||||
|
||||
bool WhisperHandler::validate_whisper_packet(const protocol::ClientPacketParser &packet, bool& match_last_header, void *&payload_ptr, size_t &payload_length) {
|
||||
std::lock_guard process_lock{this->whisper_head_mutex};
|
||||
|
||||
size_t head_length;
|
||||
if(packet.flags() & protocol::PacketFlag::NewProtocol) {
|
||||
if(packet.payload_length() < 3 + 10) {
|
||||
@@ -163,6 +165,8 @@ void WhisperHandler::signal_session_reset() {
|
||||
}
|
||||
|
||||
void WhisperHandler::handle_session_reset() {
|
||||
std::lock_guard process_lock{this->whisper_head_mutex};
|
||||
|
||||
this->session_state = SessionState::Uninitialized;
|
||||
if(this->whisper_head_ptr) {
|
||||
::free(this->whisper_head_ptr);
|
||||
|
||||
@@ -61,6 +61,7 @@ namespace ts::server::whisper {
|
||||
SessionState session_state{SessionState::Uninitialized};
|
||||
std::chrono::system_clock::time_point session_timestamp{};
|
||||
|
||||
std::mutex whisper_head_mutex{};
|
||||
void* whisper_head_ptr{nullptr};
|
||||
size_t whisper_head_length{0};
|
||||
size_t whisper_head_capacity{0};
|
||||
|
||||
Reference in New Issue
Block a user