Fixed errors when requesting short URLs, fixed race condition during shutdown of controller.
This commit is contained in:
parent
a3354aeee6
commit
eaabf9e800
2 changed files with 6 additions and 4 deletions
|
@ -263,10 +263,6 @@ int main(int argc, char ** argv){
|
||||||
//join all joinable threads
|
//join all joinable threads
|
||||||
statsThread.join();
|
statsThread.join();
|
||||||
monitorThread.join();
|
monitorThread.join();
|
||||||
//give everything some time to print messages
|
|
||||||
Util::wait(100);
|
|
||||||
//close stderr to make the stderr reading thread exit
|
|
||||||
close(STDERR_FILENO);
|
|
||||||
//write config
|
//write config
|
||||||
if ( !Controller::WriteFile(Controller::conf.getString("configFile"), Controller::Storage.toString())){
|
if ( !Controller::WriteFile(Controller::conf.getString("configFile"), Controller::Storage.toString())){
|
||||||
std::cerr << "Error writing config " << Controller::conf.getString("configFile") << std::endl;
|
std::cerr << "Error writing config " << Controller::conf.getString("configFile") << std::endl;
|
||||||
|
@ -281,6 +277,10 @@ int main(int argc, char ** argv){
|
||||||
}
|
}
|
||||||
//stop all child processes
|
//stop all child processes
|
||||||
Util::Procs::StopAll();
|
Util::Procs::StopAll();
|
||||||
|
//give everything some time to print messages
|
||||||
|
Util::wait(100);
|
||||||
|
//close stderr to make the stderr reading thread exit
|
||||||
|
close(STDERR_FILENO);
|
||||||
std::cout << "Killed all processes, wrote config to disk. Exiting." << std::endl;
|
std::cout << "Killed all processes, wrote config to disk. Exiting." << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,7 @@ namespace Mist {
|
||||||
bool isMatch(const std::string & url, const std::string & m, std::string & streamname){
|
bool isMatch(const std::string & url, const std::string & m, std::string & streamname){
|
||||||
size_t found = m.find('$');
|
size_t found = m.find('$');
|
||||||
if (found != std::string::npos){
|
if (found != std::string::npos){
|
||||||
|
if (url.size() < m.size()){return false;}
|
||||||
if (m.substr(0, found) == url.substr(0, found) && m.substr(found+1) == url.substr(url.size() - (m.size() - found) + 1)){
|
if (m.substr(0, found) == url.substr(0, found) && m.substr(found+1) == url.substr(url.size() - (m.size() - found) + 1)){
|
||||||
streamname = url.substr(found, url.size() - m.size() + 1);
|
streamname = url.substr(found, url.size() - m.size() + 1);
|
||||||
return true;
|
return true;
|
||||||
|
@ -52,6 +53,7 @@ namespace Mist {
|
||||||
bool isPrefix(const std::string & url, const std::string & m, std::string & streamname){
|
bool isPrefix(const std::string & url, const std::string & m, std::string & streamname){
|
||||||
size_t found = m.find('$');
|
size_t found = m.find('$');
|
||||||
if (found != std::string::npos){
|
if (found != std::string::npos){
|
||||||
|
if (url.size() < m.size()){return false;}
|
||||||
size_t found_suf = url.find(m.substr(found+1), found);
|
size_t found_suf = url.find(m.substr(found+1), found);
|
||||||
if (m.substr(0, found) == url.substr(0, found) && found_suf != std::string::npos){
|
if (m.substr(0, found) == url.substr(0, found) && found_suf != std::string::npos){
|
||||||
streamname = url.substr(found, found_suf - found);
|
streamname = url.substr(found, found_suf - found);
|
||||||
|
|
Loading…
Add table
Reference in a new issue