View Single Post
Old 2007-08-05, 22:14   #95 (permalink)
balrog
Portal Member
 
Join Date: Apr 2007
Age: 38
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts

Country:


Default

Quote:
Originally Posted by infinityloop View Post
Quote:
Originally Posted by balrog View Post
Quote:
Originally Posted by infinityloop View Post
B. you watched TV on your PC in the livingroom. in a hurry you "switch the PC off" (no shutdown). which means that the tv-plugin doesnt "tell" the server, that it stoped watching TV, so the server still thinks that this card is in use.
now you start your htpc in the bedroom and then you cant tune any channel because the card you need is stoill "locked" because the server thinks that your "livingroom htpc" is still watching TV.
how do you get rid of that?
either restart the tv-service on the server, or start the livingroom pc again and properly end MediaPortal, or use the proposed solution and just ick that ouser out.
I didn't know that the server acted like that, but is that really the way the server should act? Shouldn't the TV Server be able to detect that the client is gone/hanging and free the card since it isn't used anymore?
if you know a smart way to get then done, then this can be changed.
until now, we have not found such a smart solution (talking about the code now).
Hmm... I must admit that I haven't looked at the code, so what I am proposing might be completely useless and/or impractical to implement depending on the exisitng code base, but since you asked I made an attempt on a solution.

As I see it there can be three situtations when the TV server thinks there is a client receiveing the stream while there in reality is noone watching the stream and the tuner could be freed.

1. PC is switched off or the TV client crashes
2. There is a SW bug which causes the TV client to hang
3. Somebody leaves the TV client without turning it off

A simple solution to situation number 1 is to introduce heartbeat monitoring, i.e. the TV client sends a message to the TV server every 5 minutes. If the TV server does not receive the heartbeat it expects that the TV client has been stopped in some way and is not receiving the stream anymore and the tuner can be freed. Heartbeat monitoring will of course limit the scalability of the system, but since the heartbeat frequency can be set fairly low the impact on scalability should be limited.

You can always discuss if situation number 2 should be managed at all or if it is better that SW faults are exposed and therefore possible to correct. I am of the opinion that no SW will ever be fault free, so it is better to design for robustness:
If no remote control activity has been detected for 3 hours, the TV server asks the TV client to return some information which is known to both the TV client and the TV server, but is changing over time. The check is to make sure that the client is not hanging and I expect that you can find some good shared information in the stream that is sent to the client. If the check fails, the tuner can be freed.

I don't know how likely situation 3 is, but if it happens and you have a large network it might be handy.

If no remote control activity has been detected for 6 hours a "shutting down" message is shown on the screen of the TV client and a timer starts to count during 30 seconds. If the user responds, the stream continues, but he/she fails, the tuner is freed.

The proposed solutions are independent of eachother so you you can pick the situations you want to manage or modify/replace solutions without impacting the other solutions.
balrog is offline   Reply With Quote