MistInTS now shuts down after 20 seconds of no data
This commit is contained in:
parent
cd39965701
commit
69bb08a10a
2 changed files with 9 additions and 2 deletions
|
@ -180,7 +180,7 @@ namespace Controller {
|
||||||
jsonForEach(in, jit) {
|
jsonForEach(in, jit) {
|
||||||
if (out.isMember(jit.key())){
|
if (out.isMember(jit.key())){
|
||||||
if ( !streamsEqual((*jit), out[jit.key()])){
|
if ( !streamsEqual((*jit), out[jit.key()])){
|
||||||
/*LTS-START*/
|
/*LTS-START*/
|
||||||
if(Triggers::shouldTrigger("STREAM_CONFIG")){
|
if(Triggers::shouldTrigger("STREAM_CONFIG")){
|
||||||
std::string payload = jit.key()+"\n"+jit->toString();
|
std::string payload = jit.key()+"\n"+jit->toString();
|
||||||
if (!Triggers::doTrigger("STREAM_CONFIG", payload, jit.key())){
|
if (!Triggers::doTrigger("STREAM_CONFIG", payload, jit.key())){
|
||||||
|
@ -193,7 +193,7 @@ namespace Controller {
|
||||||
Log("STRM", std::string("Updated stream ") + jit.key());
|
Log("STRM", std::string("Updated stream ") + jit.key());
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
/*LTS-START*/
|
/*LTS-START*/
|
||||||
if(Triggers::shouldTrigger("STREAM_ADD")){
|
if(Triggers::shouldTrigger("STREAM_ADD")){
|
||||||
std::string payload = jit.key()+"\n"+jit->toString();
|
std::string payload = jit.key()+"\n"+jit->toString();
|
||||||
if (!Triggers::doTrigger("STREAM_ADD", payload, jit.key())){
|
if (!Triggers::doTrigger("STREAM_ADD", payload, jit.key())){
|
||||||
|
|
|
@ -302,6 +302,7 @@ namespace Mist {
|
||||||
IPC::sharedClient statsPage = IPC::sharedClient(SHM_STATISTICS, STAT_EX_SIZE, true);
|
IPC::sharedClient statsPage = IPC::sharedClient(SHM_STATISTICS, STAT_EX_SIZE, true);
|
||||||
uint64_t downCounter = 0;
|
uint64_t downCounter = 0;
|
||||||
uint64_t startTime = Util::epoch();
|
uint64_t startTime = Util::epoch();
|
||||||
|
uint64_t noDataSince = Util::bootSecs();
|
||||||
cfgPointer = config;
|
cfgPointer = config;
|
||||||
globalStreamName = streamName;
|
globalStreamName = streamName;
|
||||||
unsigned long long threadCheckTimer = Util::bootSecs();
|
unsigned long long threadCheckTimer = Util::bootSecs();
|
||||||
|
@ -327,6 +328,7 @@ namespace Mist {
|
||||||
if (udpCon.data[0] == 0x47){//check for sync byte
|
if (udpCon.data[0] == 0x47){//check for sync byte
|
||||||
if (offset + 188 <= udpCon.data_len){
|
if (offset + 188 <= udpCon.data_len){
|
||||||
liveStream.add(udpCon.data + offset);
|
liveStream.add(udpCon.data + offset);
|
||||||
|
noDataSince = Util::bootSecs();
|
||||||
downCounter += 188;
|
downCounter += 188;
|
||||||
}else{
|
}else{
|
||||||
leftData.append(udpCon.data + offset, udpCon.data_len - offset);
|
leftData.append(udpCon.data + offset, udpCon.data_len - offset);
|
||||||
|
@ -337,6 +339,7 @@ namespace Mist {
|
||||||
leftData.append(udpCon.data + offset, 1);
|
leftData.append(udpCon.data + offset, 1);
|
||||||
if (leftData.size() >= 188){
|
if (leftData.size() >= 188){
|
||||||
liveStream.add((char*)leftData.data());
|
liveStream.add((char*)leftData.data());
|
||||||
|
noDataSince = Util::bootSecs();
|
||||||
downCounter += 188;
|
downCounter += 188;
|
||||||
leftData.erase(0, 188);
|
leftData.erase(0, 188);
|
||||||
}
|
}
|
||||||
|
@ -395,6 +398,10 @@ namespace Mist {
|
||||||
}
|
}
|
||||||
if (!inFile){
|
if (!inFile){
|
||||||
Util::sleep(100);
|
Util::sleep(100);
|
||||||
|
if (Util::bootSecs() - noDataSince > 20){
|
||||||
|
WARN_MSG("Data TS packets received for 20 seconds - disconnecting");
|
||||||
|
config->is_active = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finish();
|
finish();
|
||||||
|
|
Loading…
Add table
Reference in a new issue