Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 456884 Details for
Bug 603210
media-tv/mythtv-0.28 Patch to prevent a remote frontend idlescreen (standby) from waking up the backend after the backend shuts down.
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to implement controlled disable of WOL when idlesceen has focus.
idlescreen.patch (text/plain), 8.50 KB, created by
Norman Back
on 2016-12-20 16:24:41 UTC
(
hide
)
Description:
Patch to implement controlled disable of WOL when idlesceen has focus.
Filename:
MIME Type:
Creator:
Norman Back
Created:
2016-12-20 16:24:41 UTC
Size:
8.50 KB
patch
obsolete
>--- a/mythtv/libs/libmythbase/mythcorecontext.cpp 2016-04-11 20:30:28.000000000 +0100 >+++ b/mythtv/libs/libmythbase/mythcorecontext.cpp 2016-12-17 22:17:28.747716871 +0000 >@@ -323,10 +323,11 @@ > > // Connects to master server safely (i.e. by taking m_sockLock) > bool MythCoreContext::SafeConnectToMasterServer(bool blockingClient, >- bool openEventSocket) >+ bool openEventSocket, >+ bool disableWOL) > { > QMutexLocker locker(&d->m_sockLock); >- bool success = ConnectToMasterServer(blockingClient, openEventSocket); >+ bool success = ConnectToMasterServer(blockingClient, openEventSocket, disableWOL); > > return success; > } >@@ -334,7 +335,8 @@ > // Assumes that either m_sockLock is held, or the app is still single > // threaded (i.e. during startup). > bool MythCoreContext::ConnectToMasterServer(bool blockingClient, >- bool openEventSocket) >+ bool openEventSocket, >+ bool disableWOL) > { > if (IsMasterBackend()) > { >@@ -362,7 +364,7 @@ > .arg(type) > .arg(d->m_localHostname).arg(false); > d->m_serverSock = ConnectCommandSocket( >- server, port, ann, &proto_mismatch); >+ server, port, ann, &proto_mismatch,true,-1,-1,disableWOL); > } > > if (!d->m_serverSock) >@@ -401,7 +403,8 @@ > > MythSocket *MythCoreContext::ConnectCommandSocket( > const QString &hostname, int port, const QString &announce, >- bool *p_proto_mismatch, bool gui, int maxConnTry, int setup_timeout) >+ bool *p_proto_mismatch, bool gui, int maxConnTry, int setup_timeout, >+ bool disableWOL) > { > MythSocket *serverSock = NULL; > >@@ -410,7 +413,7 @@ > d->WaitForWOL(); > } > >- QString WOLcmd = GetSetting("WOLbackendCommand", ""); >+ QString WOLcmd = disableWOL?"":GetSetting("WOLbackendCommand", ""); > > if (maxConnTry < 1) > maxConnTry = max(GetNumSetting("BackendConnectRetry", 1), 1); >--- a/mythtv/libs/libmythbase/mythcorecontext.h 2016-04-11 20:30:28.000000000 +0100 >+++ b/mythtv/libs/libmythbase/mythcorecontext.h 2016-12-17 07:15:48.146939595 +0000 >@@ -64,15 +64,18 @@ > void SetScheduler(MythScheduler *sched); > > bool SafeConnectToMasterServer(bool blockingClient = true, >- bool openEventSocket = true); >+ bool openEventSocket = true, >+ bool disableWOL = false); > bool ConnectToMasterServer(bool blockingClient = true, >- bool openEventSocket = true); >+ bool openEventSocket = true, >+ bool disableWOL = false); > > MythSocket *ConnectCommandSocket(const QString &hostname, int port, > const QString &announcement, > bool *proto_mismatch = NULL, > bool gui = true, int maxConnTry = -1, >- int setup_timeout = -1); >+ int setup_timeout = -1, >+ bool disableWOL = false); > > MythSocket *ConnectEventSocket(const QString &hostname, int port); > >--- a/mythtv/programs/mythfrontend/backendconnectionmanager.cpp 2016-04-11 20:30:28.000000000 +0100 >+++ b/mythtv/programs/mythfrontend/backendconnectionmanager.cpp 2016-12-17 22:23:18.859921500 +0000 >@@ -22,15 +22,19 @@ > > class Reconnect : public QRunnable > { >+ private: >+ bool m_disableWOL; >+ > public: >- Reconnect() >+ Reconnect(bool disableWOL = false) > { > setAutoDelete(false); >+ m_disableWOL = disableWOL; > } > > virtual void run(void) > { >- if (!gCoreContext->SafeConnectToMasterServer(gCoreContext->IsBlockingClient())) >+ if (!gCoreContext->SafeConnectToMasterServer(gCoreContext->IsBlockingClient(),true,m_disableWOL)) > gCoreContext->dispatch(MythEvent(QString("RECONNECT_FAILURE"))); > else > gCoreContext->dispatch(MythEvent(QString("RECONNECT_SUCCESS"))); >@@ -69,6 +73,24 @@ > MythEvent *me = (MythEvent *)event; > QString message = me->Message(); > >+ if (message == "IDLE_SCREEN_LOADED") >+ { >+ m_frontend_idle = true; >+ LOG(VB_SOCKET, LOG_INFO, "IDLE_SCREEN_LOADED"); >+ } >+ >+ if (message == "IDLE_SCREEN_DESTROYED") >+ { >+ m_frontend_idle = false; >+ LOG(VB_SOCKET, LOG_INFO, "IDLE_SCREEN_DESTROYED"); >+ } >+ >+ if (message == "SHUTDOWN_NOW") >+ { >+ // m_shutdown_now is restored to false when a successful connection is made. >+ m_shutdown_now = true; >+ LOG(VB_SOCKET, LOG_INFO, "SHUTDOWN_NOW"); >+ } > if (message == "BACKEND_SOCKETS_CLOSED") > { > LOG(VB_SOCKET, LOG_INFO, "Got BACKEND_SOCKETS_CLOSED message"); >@@ -100,6 +122,12 @@ > } > reconnect = m_reconnect_again; > m_reconnect_again = message == "RECONNECT_FAILURE"; >+ if (message == "RECONNECT_SUCCESS" && m_shutdown_now) >+ { >+ // Backend has restarted after a shutdown >+ LOG(VB_SOCKET, LOG_INFO, "RECONNECT_SUCCESS after SHUTDOWN_NOW"); >+ m_shutdown_now = false; >+ } > } > } > >@@ -118,7 +146,11 @@ > > void BackendConnectionManager::ReconnectToBackend(void) > { >- LOG(VB_SOCKET, LOG_INFO, "Reconnecting"); >- m_reconnecting = new Reconnect(); >+ bool disableWOL = (m_frontend_idle && m_shutdown_now); >+ if (disableWOL) >+ LOG(VB_SOCKET, LOG_INFO, "Reconnecting with WOL disabled"); >+ else >+ LOG(VB_SOCKET, LOG_INFO, "Reconnecting"); >+ m_reconnecting = new Reconnect(disableWOL); > MThreadPool::globalInstance()->start(m_reconnecting, "Reconnect"); > } >--- a/mythtv/programs/mythfrontend/backendconnectionmanager.h 2016-04-11 20:30:28.000000000 +0100 >+++ b/mythtv/programs/mythfrontend/backendconnectionmanager.h 2016-12-17 07:15:48.145939619 +0000 >@@ -21,4 +21,6 @@ > Reconnect *m_reconnecting; > QTimer *m_reconnect_timer; > bool m_reconnect_again; >+ bool m_frontend_idle; >+ bool m_shutdown_now; > }; >--- a/mythtv/programs/mythfrontend/idlescreen.cpp 2016-04-11 20:30:28.000000000 +0100 >+++ b/mythtv/programs/mythfrontend/idlescreen.cpp 2016-12-17 22:31:51.766432266 +0000 >@@ -26,7 +26,8 @@ > m_conflictWarning(NULL), > m_secondsToShutdown(-1), > m_pendingSchedUpdate(false), >- m_hasConflicts(false) >+ m_hasConflicts(false), >+ m_disableWOL(false) > { > gCoreContext->addListener(this); > GetMythMainWindow()->EnterStandby(); >@@ -34,10 +35,14 @@ > connect(m_updateScreenTimer, SIGNAL(timeout()), > this, SLOT(UpdateScreen())); > m_updateScreenTimer->start(UPDATE_INTERVAL); >+ gCoreContext->dispatch(MythEvent(QString("IDLE_SCREEN_LOADED"))); >+ gContext->SetDisableEventPopup(true); > } > > IdleScreen::~IdleScreen() > { >+ gContext->SetDisableEventPopup(false); >+ gCoreContext->dispatch(MythEvent(QString("IDLE_SCREEN_DESTROYED"))); > GetMythMainWindow()->ExitStandby(); > gCoreContext->removeListener(this); > >@@ -95,7 +100,7 @@ > bRes = true; > else > { >- if (gCoreContext->SafeConnectToMasterServer(false)) >+ if (gCoreContext->SafeConnectToMasterServer(false,true,m_disableWOL)) > bRes = true; > } > >@@ -255,6 +260,9 @@ > { > MythEvent *me = static_cast<MythEvent *>(event); > >+ if (me->Message().startsWith("RECONNECT_SUCCESS")) >+ m_disableWOL = false; >+ > if (me->Message().startsWith("RECONNECT_")) > { > m_secondsToShutdown = -1; >@@ -268,6 +276,7 @@ > } > else if (me->Message().startsWith("SHUTDOWN_NOW")) > { >+ m_disableWOL = true; > if (gCoreContext->IsFrontendOnly()) > { > // does the user want to shutdown this frontend only machine >--- a/mythtv/programs/mythfrontend/idlescreen.h 2016-04-11 20:30:28.000000000 +0100 >+++ b/mythtv/programs/mythfrontend/idlescreen.h 2016-12-17 07:15:48.145939619 +0000 >@@ -50,6 +50,7 @@ > bool m_pendingSchedUpdate; > ProgramList m_scheduledList; > bool m_hasConflicts; >+ bool m_disableWOL; > }; > > #endif
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 603210
: 456884