Made Util::streamName and exitReason thread-local

This commit is contained in:
Thulinma 2020-08-28 19:23:48 +02:00
parent 7c6da9d455
commit 7423868de4
11 changed files with 40 additions and 32 deletions

View file

@ -87,7 +87,7 @@ namespace Mist{
// If we have a streamname option, set internal streamname to that option
if (!streamName.size() && config->hasOption("streamname")){
streamName = config->getString("streamname");
Util::streamName = streamName;
Util::setStreamName(streamName);
}
/*LTS-START*/
@ -327,7 +327,7 @@ namespace Mist{
JSON::Value strCnf = Util::getStreamConfig(streamName);
if (strCnf && strCnf["fallback_stream"].asStringRef().size()){
streamName = strCnf["fallback_stream"].asStringRef();
Util::streamName = streamName;
Util::setStreamName(streamName);
INFO_MSG("Switching to configured fallback stream '%s'", streamName.c_str());
reconnect();
return;
@ -358,7 +358,7 @@ namespace Mist{
newStrm.c_str());
std::string origStream = streamName;
streamName = newStrm;
Util::streamName = streamName;
Util::setStreamName(streamName);
if (!Util::startInput(streamName, "", true, isPushing())){
onFail("Stream open failed (fallback stream for '" + origStream + "')", true);
return;

View file

@ -450,7 +450,7 @@ namespace Mist{
INFO_MSG("Falling back to default stream '%s' -> '%s'", defStrm.c_str(), newStrm.c_str());
origStreamName = streamName;
streamName = newStrm;
Util::streamName = streamName;
Util::setStreamName(streamName);
reconnect();
return getStatusJSON(reqHost, useragent);
}

View file

@ -828,11 +828,11 @@ namespace Mist{
if (streamName.find('?') != std::string::npos){
std::string tmpVars = streamName.substr(streamName.find('?') + 1);
streamName = streamName.substr(0, streamName.find('?'));
Util::streamName = streamName;
Util::setStreamName(streamName);
HTTP::parseVars(tmpVars, targetParams);
}
Util::streamName = streamName;
Util::setStreamName(streamName);
reqUrl += "/" + streamName; // LTS
/*LTS-START*/
@ -850,17 +850,17 @@ namespace Mist{
size_t lSlash = newUrl.rfind('/');
if (lSlash != std::string::npos){
streamName = newUrl.substr(lSlash + 1);
Util::streamName = streamName;
Util::setStreamName(streamName);
}else{
streamName = newUrl;
Util::streamName = streamName;
Util::setStreamName(streamName);
}
}
/*LTS-END*/
if (streamName.find('/')){
streamName = streamName.substr(0, streamName.find('/'));
Util::streamName = streamName;
Util::setStreamName(streamName);
}
size_t colonPos = streamName.find(':');
@ -871,7 +871,7 @@ namespace Mist{
}else{
streamName = oldName.substr(colonPos + 1) + std::string(".") + oldName.substr(0, colonPos);
}
Util::streamName = streamName;
Util::setStreamName(streamName);
}
Util::sanitizeName(streamName);
@ -941,14 +941,14 @@ namespace Mist{
int8_t playMessageType = messageType;
int32_t playStreamId = streamId;
streamName = Encodings::URL::decode(amfData.getContentP(3)->StrValue());
Util::streamName = streamName;
Util::setStreamName(streamName);
reqUrl += "/" + streamName; // LTS
// handle variables
if (streamName.find('?') != std::string::npos){
std::string tmpVars = streamName.substr(streamName.find('?') + 1);
streamName = streamName.substr(0, streamName.find('?'));
Util::streamName = streamName;
Util::setStreamName(streamName);
HTTP::parseVars(tmpVars, targetParams);
}
@ -960,7 +960,7 @@ namespace Mist{
}else{
streamName = oldName.substr(colonPos + 1) + std::string(".") + oldName.substr(0, colonPos);
}
Util::streamName = streamName;
Util::setStreamName(streamName);
}
Util::sanitizeName(streamName);