Skip to content

Commit

Permalink
Allow creating backend connections without the event socket
Browse files Browse the repository at this point in the history
Add an optional parameter to MythCoreContext::ConnectToMasterServer()
to allow disabling the event socket connection.  Normally, we want
to open the event socket, but the forthcoming mythutil app just
needs to open a quick connection, send a message, read the response,
and exit.

This commit also adds a 'MYTH_APPNAME_MYTHUTIL' define for mythutil to
prevent a full recompile once it is committed.

This changes MYTH_BINARY_VERSION so make clean, etc..
  • Loading branch information
cpinkham committed Oct 7, 2011
1 parent 8c5aafc commit a598436
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
6 changes: 5 additions & 1 deletion mythtv/libs/libmythbase/mythcorecontext.cpp
Expand Up @@ -281,7 +281,8 @@ bool MythCoreContext::SetupCommandSocket(MythSocket *serverSock,

// Assumes that either m_sockLock is held, or the app is still single
// threaded (i.e. during startup).
bool MythCoreContext::ConnectToMasterServer(bool blockingClient)
bool MythCoreContext::ConnectToMasterServer(bool blockingClient,
bool openEventSocket)
{
if (IsMasterBackend())
{
Expand All @@ -308,6 +309,9 @@ bool MythCoreContext::ConnectToMasterServer(bool blockingClient)
if (!d->m_serverSock)
return false;

if (!openEventSocket)
return true;

if (!IsBackend() && !d->m_eventSock)
d->m_eventSock = ConnectEventSocket(server, port);

Expand Down
4 changes: 3 additions & 1 deletion mythtv/libs/libmythbase/mythcorecontext.h
Expand Up @@ -28,6 +28,7 @@
#define MYTH_APPNAME_MYTHAVTEST "mythavtest"
#define MYTH_APPNAME_MYTHMEDIASERVER "mythmediaserver"
#define MYTH_APPNAME_MYTHMETADATALOOKUP "mythmetadatalookup"
#define MYTH_APPNAME_MYTHUTIL "mythutil"

class MDBManager;
class MythCoreContextPrivate;
Expand Down Expand Up @@ -57,7 +58,8 @@ class MBASE_PUBLIC MythCoreContext : public MythObservable, public MythSocketCBs
void SetEventSocket(MythSocket *eventSock);
void SetScheduler(MythScheduler *sched);

bool ConnectToMasterServer(bool blockingClient = true);
bool ConnectToMasterServer(bool blockingClient = true,
bool openEventSocket = true);

MythSocket *ConnectCommandSocket(const QString &hostname, int port,
const QString &announcement,
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythbase/mythversion.h
Expand Up @@ -12,7 +12,7 @@
/// Update this whenever the plug-in API changes.
/// Including changes in the libmythbase, libmyth, libmythtv, libmythav* and
/// libmythui class methods used by plug-ins.
#define MYTH_BINARY_VERSION "0.25.20111005-1"
#define MYTH_BINARY_VERSION "0.25.20111006-1"

/** \brief Increment this whenever the MythTV network protocol changes.
*
Expand Down

0 comments on commit a598436

Please sign in to comment.