[mythtv-commits] Re: Ticket #617: Allow non-blocking client connections

MythTV mythtv at cvs.mythtv.org
Thu Nov 10 19:44:03 EST 2005


#617: Allow non-blocking client connections
-----------------------------+----------------------------------------------
 Reporter:  gnassas at mac.com  |        Owner:  gnassas at mac.com
     Type:  patch            |       Status:  closed         
 Priority:  minor            |    Milestone:  0.19           
Component:  mythtv           |      Version:  head           
 Severity:  medium           |   Resolution:  wontfix        
-----------------------------+----------------------------------------------
Comment (by gnassas at gmail.com):

 Responding to Paul's comments:

 {{{
  This patch doesn't look like it will work as intended to me anyway.
  What happens in the case where the combined FE/BE is started to
  record something. You still need mythwelcome to connect to the
  BE as a blocking client even if for only a few seconds so as to trigger
  the BE  into shutting down when idle. Otherwise it will spin waiting for
 a
  client to connect because of the 'block shutdown before client connected'
  setting.
 }}}

 This argument is incorrect. Review the following lines from
 Scheduler::RunScheduler:

 {{{
                 // have we been started automatically?
                 if ((startIter != reclist.end()) &&
                     ((curtime.secsTo((*startIter)->startts) -
 prerollseconds)
                         < (idleWaitForRecordingTime * 60)))
                 {
                     VERBOSE(VB_ALL,
                             "Recording starts soon, AUTO-Startup
 assumed");
                     startupParam = "auto";

                     // Since we've started automatically, don't wait for
                     // client to connect before allowing shutdown.
                     blockShutdown = false;
                 }
 }}}


 Later in the commentary:

 {{{
 Maybe a better approach to the problem would be to make mythwelcome a
 little smarter as to when it sends the 'ALLOW_SHUTDOWN' command to the BE
 }}}

 You can't implement this reliably without an argument to
 ConnectToMasterServer. The problem is after crossing processes the
 connection request eventually comes down to MainServer::HandleAnnounce
 where a PlaybackSock is created and pushed onto the BE's playbackList. At
 that point it's visible to the loop in Scheduler::RunScheduler. You can
 gamble on a quickie ALLOW_SHUTDOWN from MW right after the connect but
 you're in a race with the scheduler thread's loop and once that
 blockShutdown flag is cleared the horse has left the barn.

 The only sure-fire way to do a non-blocking connection is to call
 PlaybackSock::setBlockShutdown before the push to playbackList. That
 implies a parameter to ANN Playback.

 {{{
  and/or when it starts up the FE automatically?
 }}}

 I discussed this earlier. The problem is MW has no way to detect if 1) the
 PC has started due to the power switch in which case it should start the
 FE because the user wants myth, or 2) the PC has come up due to a WOL
 message in which case it should hang back with a local FE since you want
 the PC to come down naturally when the remote FE disconnects.

 I started this because MW, as implemented in SVN, does not work in a mixed
 FE/BE FE-only environment. Try it yourself. This patch has been in
 production here for several days and I do a lot of recording and a lot of
 watching from both my FE and my FE/BE. I've seen nothing but success.
 Plus, I have fresher breath, whiter teeth, more women are attracted to me,
 I've made a fortune in real estate, my knives are sharper than ever, etc
 etc. What's not to like?

 - George

-- 
Ticket URL: <http://cvs.mythtv.org/trac/ticket/617>
MythTV <http://www.mythtv.org/>
MythTV


More information about the mythtv-commits mailing list