mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-16 16:55:27 +00:00
feat(master): the world file watch follows the override folder, and can hold a zone
For a file under maps/ master watches the file a world would read now: the override when one is there, else the client's. An override that appears, changes or goes away makes the instances that read another version stale, also for files from the packs. The dashboard can hold a zone's automatic reloads (WORLD_RELOAD_HOLD, a new message after the existing ones) until a reload of the zone is asked for. The status sent to the dashboard counts what reloads did per zone. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -21,7 +21,8 @@
|
||||
*
|
||||
* Master reads (hashes) each watched file itself: once when a world first reports it, and again whenever its size or
|
||||
* mtime changed and then held still for one poll (FdbSnapshot::Watcher). An instance is stale when a file it loaded
|
||||
* has another hash on disk now. Files a world read from the client's packs are listed but not watched.
|
||||
* has another hash on disk now. Files a world read from the client's packs are listed but not watched, unless the
|
||||
* caller watches a folder whose files replace them (Poll's watchPacked).
|
||||
*/
|
||||
namespace WorldFileWatch {
|
||||
using Stamp = FdbSnapshot::Stamp;
|
||||
@@ -85,10 +86,11 @@ namespace WorldFileWatch {
|
||||
* read yet, and files whose size or mtime changed and held still since the last poll. Those are marked as
|
||||
* being hashed until Hashed is called for them.
|
||||
*/
|
||||
std::vector<HashJob> Poll(const std::function<Stamp(const std::string&)>& stampOf) {
|
||||
std::vector<HashJob> Poll(const std::function<Stamp(const std::string&)>& stampOf, const std::function<bool(const std::string&)>& watchPacked = nullptr) {
|
||||
std::vector<HashJob> due;
|
||||
for (auto& [path, file] : m_Files) {
|
||||
if (file.packed || file.hashing) continue;
|
||||
// A file from the client's packs is only looked at when the caller can say what replaces it (an override folder)
|
||||
if (file.hashing || (file.packed && !(watchPacked && watchPacked(path)))) continue;
|
||||
const auto stamp = stampOf(path);
|
||||
file.missing = !stamp.exists;
|
||||
const bool first = !file.hash && stamp.exists;
|
||||
|
||||
Reference in New Issue
Block a user