Opened 14 years ago

Closed 14 years ago

#155 closed patch (fixed)

Patch to allow connections to the backend that don't block shutdown

Reported by: mythtv@… Owned by: Isaac Richards
Priority: minor Milestone: unknown
Component: mythtv Version: head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

This patch allows for connections to the backend that don't stop the main server from shutting down the system if it is idle.

Useful if you want to create a status app that connects to the backend to query the server for current recording status, scheduled program info and receive schedule/recordings change events etc. but don't want to prevent the backend from shutting things down if it is idle.

The patch adds two new commands you can send to the server "ALLOW_SHUTDOWN" and "BLOCK_SHUTDOWN" they simply set a flag in the playbacksock. When the main server checks for active connections in MainServer::isClientConnected() it ignores any connections that don't have the blockshutdown flag set. The default behavior is to block shutdown so everything will work has it does now unless the server receives a command to change that.

There are two new helper functions MythContext::AllowShutdown?() and MythContext::BlockShutdown?() which sets how the two sockets created by the MythContext object block or allow the backend to shutdown.

I have a further patch that adds a welcome/status app to myth that is designed to be run all the time but will usually only be visible if the frontend is not running. ie the system has been started to record a scheduled recording for example. It displays some status information about what Myth is upto at the moment; recording, grabbing EPG data, com. flagging, transcoding etc. Also shows what is currently recording, and what the next scheduled recording is. It also has a button which allows you to start the frontend if you want.

I'll send it to the tracker later if this patch gets the thumbs up.

Paul

Attachments (2)

mythtv.diff (5.3 KB) - added by mythtv@… 14 years ago.
Patch file
playbacksock.diff (411 bytes) - added by Paul 14 years ago.
patch to fix uninitialised blockshutdown flag

Download all attachments as: .zip

Change History (7)

Changed 14 years ago by mythtv@…

Attachment: mythtv.diff added

Patch file

comment:1 Changed 14 years ago by Isaac Richards

What's the uncommented ReadStringList? for?

comment:2 Changed 14 years ago by Paul

What's the uncommented ReadStringList? for?

It's been a while since I wrote that patch but I seem to remember while testing the patch I added some debug code to check I was getting the correct response from the backend. The server socked replys where in sync but I noticed that the responses from the event socked where always lagging one reply behind where they should be. Or I wasn't getting the expected reply.

I think I traced the problem to the commented ReadStringList? in EventSockedConnected?(). We never read the reply to "ANN Playback". So the first time we do a ReadStringList? from the event socked we get the 'OK' reply from the "ANN Playback".

I've been using the patch now for about 2 months without any problems.

Paul

comment:3 Changed 14 years ago by Isaac Richards

Resolution: fixed
Status: newclosed

(In [7075]) Patch from Paul to add a connection type that the backend will ignore for auto-shutdown.

Closes #155.

comment:4 Changed 14 years ago by Paul

Resolution: fixed
Status: closedreopened

Thanks for applying the patch.

I have just noticed I missed an important change from the original patch.

Its a small change but an important one because without it the blockshutdown flag is uninitialised and could result in the backend shutting things down randomly.

Its the result of having to edit the diff to remove other stuff that didn't belong in the original patch. I must have deleted it by mistake.

Added a new patch to fix it. Paul

Changed 14 years ago by Paul

Attachment: playbacksock.diff added

patch to fix uninitialised blockshutdown flag

comment:5 Changed 14 years ago by Isaac Richards

Resolution: fixed
Status: reopenedclosed

(In [7140]) Initialize uninitialize variables, closes #155.

Note: See TracTickets for help on using tickets.