diff --git a/src/controller/controller.cpp b/src/controller/controller.cpp index 72dff86d..dca56c96 100644 --- a/src/controller/controller.cpp +++ b/src/controller/controller.cpp @@ -302,10 +302,6 @@ int main(int argc, char ** argv){ statsThread.join(); monitorThread.join(); uplinkThread.join();/*LTS*/ - //give everything some time to print messages - Util::wait(100); - //close stderr to make the stderr reading thread exit - close(STDERR_FILENO); //write config tthread::lock_guard guard(Controller::logMutex); Controller::Storage.removeMember("log"); @@ -320,6 +316,10 @@ int main(int argc, char ** argv){ } //stop all child processes 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; /*LTS-START*/ if (Controller::restarting){ diff --git a/src/output/output_http.cpp b/src/output/output_http.cpp index 84bdcdd3..6f268a36 100644 --- a/src/output/output_http.cpp +++ b/src/output/output_http.cpp @@ -41,6 +41,7 @@ namespace Mist { bool isMatch(const std::string & url, const std::string & m, std::string & streamname){ size_t found = m.find('$'); 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)){ streamname = url.substr(found, url.size() - m.size() + 1); return true; @@ -52,6 +53,7 @@ namespace Mist { bool isPrefix(const std::string & url, const std::string & m, std::string & streamname){ size_t found = m.find('$'); if (found != std::string::npos){ + if (url.size() < m.size()){return false;} 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){ streamname = url.substr(found, found_suf - found);