Fixed Session load recursion, allow higher level of imbrication

Recursive load of SessionFile in a Session is now detected by filename and prevented. Deeper level of integration of sessionfile inside session is thus possible (set to 3). Sessions now have an id, allowing to reference them by id in the logs. Terminology is clarified between level and recursion.
This commit is contained in:
Bruno Herbelin
2022-04-08 17:44:39 +02:00
parent ef65dd8cc6
commit 33756c775c
7 changed files with 84 additions and 49 deletions

View File

@@ -174,7 +174,7 @@ SessionFileSource::SessionFileSource(uint64_t id) : SessionSource(id), path_("")
}
void SessionFileSource::load(const std::string &p, uint recursion)
void SessionFileSource::load(const std::string &p, uint level)
{
path_ = p;
@@ -192,7 +192,7 @@ void SessionFileSource::load(const std::string &p, uint recursion)
}
else {
// launch a thread to load the session file
sessionLoader_ = std::async(std::launch::async, Session::load, path_, recursion);
sessionLoader_ = std::async(std::launch::async, Session::load, path_, level);
Log::Notify("Opening %s", p.c_str());
}
@@ -229,7 +229,7 @@ void SessionFileSource::init()
// done init
wait_for_sources_ = false;
initialized_ = true;
Log::Info("Source Session %s loaded %d sources.", path_.c_str(), session_->numSource());
Log::Info("Source '%s' linked to Session %s.", name().c_str(), std::to_string(session_->id()).c_str());
}
}
else if ( !failed_ ) {
@@ -254,7 +254,7 @@ void SessionFileSource::init()
wait_for_sources_ = true;
else {
initialized_ = true;
Log::Info("New Session created (%d x %d).", renderbuffer->width(), renderbuffer->height());
Log::Info("Source '%s' linked to new Session %s.", name().c_str(), std::to_string(session_->id()).c_str());
}
}
}