Fixed a crash related to the whisper system and some minor updates
This commit is contained in:
parent
0cff59328f
commit
ccd0f7fcfd
2
rtclib
2
rtclib
@ -1 +1 @@
|
|||||||
Subproject commit 7f1e1387fcfffd7e82bd51c3a3e0c7f38dcfdd6e
|
Subproject commit d5a085254595fddc0520de21a75402b43c39f608
|
@ -676,25 +676,30 @@ bool ConnectedClient::notifyChannelEdited(
|
|||||||
if(!v_channel) return false; //Not visible? Important do not remove!
|
if(!v_channel) return false; //Not visible? Important do not remove!
|
||||||
|
|
||||||
bool send_description_change{false};
|
bool send_description_change{false};
|
||||||
|
size_t property_count{0};
|
||||||
|
|
||||||
Command notify("notifychanneledited");
|
Command notify("notifychanneledited");
|
||||||
for(auto prop : properties) {
|
for(auto prop : properties) {
|
||||||
const auto& prop_info = property::describe(prop);
|
const auto& prop_info = property::describe(prop);
|
||||||
|
|
||||||
if(prop == property::CHANNEL_ORDER)
|
if(prop == property::CHANNEL_ORDER) {
|
||||||
notify[prop_info.name] = v_channel->previous_channel;
|
notify[prop_info.name] = v_channel->previous_channel;
|
||||||
else if(prop == property::CHANNEL_DESCRIPTION) {
|
property_count++;
|
||||||
|
} else if(prop == property::CHANNEL_DESCRIPTION) {
|
||||||
send_description_change = true;
|
send_description_change = true;
|
||||||
} else {
|
} else {
|
||||||
notify[prop_info.name] = channel->properties()[prop].as<string>();
|
notify[prop_info.name] = channel->properties()[prop].as<string>();
|
||||||
|
property_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
notify["cid"] = channel->channelId();
|
if(property_count > 0) {
|
||||||
notify["reasonid"] = ViewReasonId::VREASON_EDITED;
|
notify["cid"] = channel->channelId();
|
||||||
|
notify["reasonid"] = ViewReasonId::VREASON_EDITED;
|
||||||
|
|
||||||
INVOKER(notify, invoker);
|
INVOKER(notify, invoker);
|
||||||
this->sendCommand(notify);
|
this->sendCommand(notify);
|
||||||
|
}
|
||||||
|
|
||||||
if(send_description_change) {
|
if(send_description_change) {
|
||||||
Command notify_dchange{"notifychanneldescriptionchanged"};
|
Command notify_dchange{"notifychanneldescriptionchanged"};
|
||||||
|
@ -1436,6 +1436,7 @@ ts::command_result ConnectedClient::execute_channel_edit(ChannelId& channel_id,
|
|||||||
case property::CHANNEL_CODEC_QUALITY:
|
case property::CHANNEL_CODEC_QUALITY:
|
||||||
case property::CHANNEL_CODEC_IS_UNENCRYPTED:
|
case property::CHANNEL_CODEC_IS_UNENCRYPTED:
|
||||||
case property::CHANNEL_DELETE_DELAY:
|
case property::CHANNEL_DELETE_DELAY:
|
||||||
|
case property::CHANNEL_SIDEBAR_MODE:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case property::CHANNEL_PASSWORD:
|
case property::CHANNEL_PASSWORD:
|
||||||
@ -1500,7 +1501,7 @@ ts::command_result ConnectedClient::execute_channel_edit(ChannelId& channel_id,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
logCritical(this->getServerId(), "{} Channel property {} reached context validation context but we don't know how to handle it. Please report this bug!", property::describe(key).name);
|
logCritical(this->getServerId(), "{} Channel property {} reached context validation context but we don't know how to handle it. Please report this bug!", CLIENT_LOG_PREFIX, property::describe(key).name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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) {
|
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;
|
size_t head_length;
|
||||||
if(packet.flags() & protocol::PacketFlag::NewProtocol) {
|
if(packet.flags() & protocol::PacketFlag::NewProtocol) {
|
||||||
if(packet.payload_length() < 3 + 10) {
|
if(packet.payload_length() < 3 + 10) {
|
||||||
@ -163,6 +165,8 @@ void WhisperHandler::signal_session_reset() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void WhisperHandler::handle_session_reset() {
|
void WhisperHandler::handle_session_reset() {
|
||||||
|
std::lock_guard process_lock{this->whisper_head_mutex};
|
||||||
|
|
||||||
this->session_state = SessionState::Uninitialized;
|
this->session_state = SessionState::Uninitialized;
|
||||||
if(this->whisper_head_ptr) {
|
if(this->whisper_head_ptr) {
|
||||||
::free(this->whisper_head_ptr);
|
::free(this->whisper_head_ptr);
|
||||||
|
@ -61,6 +61,7 @@ namespace ts::server::whisper {
|
|||||||
SessionState session_state{SessionState::Uninitialized};
|
SessionState session_state{SessionState::Uninitialized};
|
||||||
std::chrono::system_clock::time_point session_timestamp{};
|
std::chrono::system_clock::time_point session_timestamp{};
|
||||||
|
|
||||||
|
std::mutex whisper_head_mutex{};
|
||||||
void* whisper_head_ptr{nullptr};
|
void* whisper_head_ptr{nullptr};
|
||||||
size_t whisper_head_length{0};
|
size_t whisper_head_length{0};
|
||||||
size_t whisper_head_capacity{0};
|
size_t whisper_head_capacity{0};
|
||||||
|
Loading…
Reference in New Issue
Block a user