HLS/HTTP fixes:

- Optimize URIReader class to not close connections if not needed
- reConnector now works for non-GET requests with GET params
- Chunk sending mode correctly kept for HLS
- Removed lots of H.Clean() from HLS that weren't needed
- Improved HTTP output class request handling logic
- Removed firstRun from HTTP output class; no longer needed
This commit is contained in:
Thulinma 2021-09-20 13:09:27 +02:00
parent 5774ce3b9e
commit 194b6e1388
5 changed files with 13 additions and 27 deletions

View file

@ -14,7 +14,6 @@ namespace Mist{
idleInterval = 0;
idleLast = 0;
if (config->getString("ip").size()){myConn.setHost(config->getString("ip"));}
firstRun = true;
if (config->getString("prequest").size()){
myConn.Received().prepend(config->getString("prequest"));
}
@ -197,14 +196,11 @@ namespace Mist{
if (!isBlocking && !parseData){Util::sleep(100);}
return;
}
// If we can't read anything more and we're non-blocking, sleep some.
if (!firstRun && !myConn.spool()){
if (!isBlocking && !parseData){Util::sleep(100);}
return;
}
firstRun = false;
//Attempt to read a HTTP request, regardless of data being available
bool sawRequest = false;
while (H.Read(myConn)){
sawRequest = true;
std::string handler = getHandler();
if (handler != capa["name"].asStringRef() || H.GetVar("stream") != streamName){
INFO_MSG("Received request: %s => %s (%s)", H.getUrl().c_str(), handler.c_str(), H.GetVar("stream").c_str());
@ -307,8 +303,12 @@ namespace Mist{
if (!myConn){return;}
onHTTP();
idleLast = Util::bootMS();
if (!H.bufferChunks){H.Clean();}
// Prevent the clean as well as the loop when we're in the middle of handling a request now
if (!wantRequest){return;}
H.Clean();
}
// If we can't read anything more and we're non-blocking, sleep some.
if (!sawRequest && !myConn.spool() && !isBlocking && !parseData){Util::sleep(100);}
}
/// Default HTTP handler.