mirror of
https://github.com/minetest/minetest.git
synced 2025-01-07 16:40:23 +01:00
Improve situation around race condition with dynamic_add_media during client join
This commit is contained in:
parent
72b14bd994
commit
379473b670
@ -3534,8 +3534,22 @@ bool Server::dynamicAddMedia(std::string filepath,
|
|||||||
std::unordered_set<session_t> delivered, waiting;
|
std::unordered_set<session_t> delivered, waiting;
|
||||||
m_clients.lock();
|
m_clients.lock();
|
||||||
for (auto &pair : m_clients.getClientList()) {
|
for (auto &pair : m_clients.getClientList()) {
|
||||||
if (pair.second->getState() < CS_DefinitionsSent)
|
if (pair.second->getState() == CS_DefinitionsSent && !ephemeral) {
|
||||||
|
/*
|
||||||
|
If a client is in the DefinitionsSent state it is too late to
|
||||||
|
transfer the file via sendMediaAnnouncement() but at the same
|
||||||
|
time the client cannot accept a media push yet.
|
||||||
|
Short of artificially delaying the joining process there is no
|
||||||
|
way for the server to resolve this so we (currently) opt not to.
|
||||||
|
*/
|
||||||
|
warningstream << "The media \"" << filename << "\" (dynamic) could "
|
||||||
|
"not be delivered to " << pair.second->getName()
|
||||||
|
<< " due to a race condition." << std::endl;
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
if (pair.second->getState() < CS_Active)
|
||||||
|
continue;
|
||||||
|
|
||||||
const auto proto_ver = pair.second->net_proto_version;
|
const auto proto_ver = pair.second->net_proto_version;
|
||||||
if (proto_ver < 39)
|
if (proto_ver < 39)
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user