mirror of
				https://github.com/rofafor/vdr-plugin-satip.git
				synced 2023-10-10 11:37:42 +00:00 
			
		
		
		
	Added a timeout for releasing idling devices.
This commit is contained in:
		
							
								
								
									
										11
									
								
								tuner.c
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								tuner.c
									
									
									
									
									
								
							| @@ -29,6 +29,7 @@ cSatipTuner::cSatipTuner(cSatipDeviceIf &deviceP, unsigned int packetLenP) | ||||
|   nextServerM(NULL, deviceP.GetId(), 0), | ||||
|   mutexM(), | ||||
|   reConnectM(), | ||||
|   idleReleaseM(), | ||||
|   keepAliveM(), | ||||
|   statusUpdateM(), | ||||
|   pidUpdateCacheM(), | ||||
| @@ -92,6 +93,7 @@ void cSatipTuner::Action(void) | ||||
| { | ||||
|   debug1("%s Entering [device %d]", __PRETTY_FUNCTION__, deviceIdM); | ||||
|   reConnectM.Set(eConnectTimeoutMs); | ||||
|   idleReleaseM.Set(eIdleTimeoutMs); | ||||
|   // Do the thread loop | ||||
|   while (Running()) { | ||||
|         UpdateCurrentState(); | ||||
| @@ -116,6 +118,7 @@ void cSatipTuner::Action(void) | ||||
|           case tsTuned: | ||||
|                debug4("%s: tsTuned [device %d]", __PRETTY_FUNCTION__, deviceIdM); | ||||
|                reConnectM.Set(eConnectTimeoutMs); | ||||
|                idleReleaseM.Set(eIdleTimeoutMs); | ||||
|                // Read reception statistics via DESCRIBE and RTCP | ||||
|                if (hasLockM || ReadReceptionStatus()) { | ||||
|                   // Quirk for devices without valid reception data | ||||
| @@ -145,6 +148,14 @@ void cSatipTuner::Action(void) | ||||
|                   RequestState(tsSet, smInternal); | ||||
|                   break; | ||||
|                   } | ||||
|                if (idleReleaseM.TimedOut()) { | ||||
|                   idleReleaseM.Set(eIdleTimeoutMs); | ||||
|                   if (deviceM->IsIdle()) { | ||||
|                      info("Idle timeout - releasing [device %d]", deviceIdM); | ||||
|                      RequestState(tsRelease, smInternal); | ||||
|                      } | ||||
|                   break; | ||||
|                   } | ||||
|                break; | ||||
|           default: | ||||
|                error("Unknown tuner status %d [device %d]", currentStateM, deviceIdM); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user