Fixed a client disconnect bug

This commit is contained in:
WolverinDEV 2021-05-19 11:42:10 +02:00
parent 521b6fa111
commit fefe550805
3 changed files with 31 additions and 11 deletions

@ -1 +1 @@
Subproject commit cf3e1ed1069fca6f8bb657f96f851b5de4c8b033 Subproject commit b1565e43b01349fb9c66eb876711c115214cd823

View File

@ -1430,7 +1430,7 @@ ts::command_result ConnectedClient::execute_channel_edit(ChannelId& channel_id,
} }
} }
std::deque<std::shared_ptr<BasicChannel>> child_channel_type_updates{}; std::deque<std::tuple<std::shared_ptr<BasicChannel>, std::vector<property::ChannelProperties>>> child_channel_type_updates{};
/* updating all child channels */ /* updating all child channels */
{ {
@ -1446,10 +1446,34 @@ ts::command_result ConnectedClient::execute_channel_edit(ChannelId& channel_id,
} }
if (child->channelType() < target_channel_type) { if (child->channelType() < target_channel_type) {
child->setChannelType(target_channel_type); std::vector<property::ChannelProperties> channel_property_updates{};
channel_property_updates.reserve(16);
child->updateChannelType(channel_property_updates, target_channel_type);
if(target_channel_type == ChannelType::temporary) {
if(child->properties()[property::CHANNEL_FLAG_MAXCLIENTS_UNLIMITED].update_value(true)) {
channel_property_updates.push_back(property::CHANNEL_FLAG_MAXCLIENTS_UNLIMITED);
}
if(child->properties()[property::CHANNEL_FLAG_MAXFAMILYCLIENTS_INHERITED].update_value(false)) {
channel_property_updates.push_back(property::CHANNEL_FLAG_MAXFAMILYCLIENTS_INHERITED);
}
if(child->properties()[property::CHANNEL_MAXCLIENTS].update_value(-1)) {
channel_property_updates.push_back(property::CHANNEL_MAXCLIENTS);
}
if(child->properties()[property::CHANNEL_MAXFAMILYCLIENTS].update_value(-1)) {
channel_property_updates.push_back(property::CHANNEL_MAXFAMILYCLIENTS);
}
if(child->properties()[property::CHANNEL_FLAG_MAXFAMILYCLIENTS_UNLIMITED].update_value(true)) {
channel_property_updates.push_back(property::CHANNEL_FLAG_MAXFAMILYCLIENTS_UNLIMITED);
}
}
children_left.push_back(child); children_left.push_back(child);
child_channel_type_updates.push_back(child); child_channel_type_updates.push_back(std::make_tuple(child, channel_property_updates));
} }
} }
} }
@ -1524,10 +1548,6 @@ ts::command_result ConnectedClient::execute_channel_edit(ChannelId& channel_id,
assert(linked_previous_channel || channel->previousChannelId() == 0); assert(linked_previous_channel || channel->previousChannelId() == 0);
} }
std::vector<property::ChannelProperties> child_channel_type_property_updates{
property::CHANNEL_FLAG_PERMANENT,
property::CHANNEL_FLAG_SEMI_PERMANENT
};
std::vector<property::ChannelProperties> default_channel_property_updates{ std::vector<property::ChannelProperties> default_channel_property_updates{
property::CHANNEL_FLAG_DEFAULT, property::CHANNEL_FLAG_DEFAULT,
}; };
@ -1551,8 +1571,8 @@ ts::command_result ConnectedClient::execute_channel_edit(ChannelId& channel_id,
} }
std::unique_lock client_tree_lock{client->channel_tree_mutex}; std::unique_lock client_tree_lock{client->channel_tree_mutex};
for(const auto& child_channel : child_channel_type_updates) { for(const auto& [ child_channel, updates ] : child_channel_type_updates) {
client->notifyChannelEdited(child_channel, child_channel_type_property_updates, self_ref, false); client->notifyChannelEdited(child_channel, updates, self_ref, false);
} }
if(is_channel_create) { if(is_channel_create) {

2
shared

@ -1 +1 @@
Subproject commit 616149d5dddf1fa2545922a1d97c438a9e51da3d Subproject commit b155bf8d5f587b3b8970ef8ff81e0deb3b5bdf10