Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[pvr.tvh] fix bug in addon creation that led to startup failures
  • Loading branch information
adamsutton committed Apr 25, 2014
1 parent 842ca2b commit c22c798
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion addons/pvr.tvh/src/HTSPConnection.cpp
Expand Up @@ -136,7 +136,7 @@ bool CHTSPConnection::WaitForConnection ( void )
{
if (!m_ready) {
tvhtrace("waiting for registration...");
m_regCond.Wait(m_mutex, m_ready, 5000);//timeout);
m_regCond.Wait(m_mutex, m_ready, g_iConnectTimeout);
}
return m_ready;
}
Expand Down
22 changes: 12 additions & 10 deletions addons/pvr.tvh/src/client.cpp
Expand Up @@ -158,6 +158,18 @@ ADDON_STATUS ADDON_Create(void* hdl, void* _unused(props))

tvh = new CTvheadend;

/* Wait for connection */
if (!tvh->WaitForConnection()) {
SAFE_DELETE(tvh);
SAFE_DELETE(PVR);
#ifndef OPENELEC_32
SAFE_DELETE(CODEC);
#endif
SAFE_DELETE(GUI);
SAFE_DELETE(XBMC);
return ADDON_STATUS_LOST_CONNECTION;
}

m_CurStatus = ADDON_STATUS_OK;
m_bCreated = true;
return m_CurStatus;
Expand Down Expand Up @@ -311,13 +323,6 @@ const char* GetMininumGUIAPIVersion(void)

PVR_ERROR GetAddonCapabilities(PVR_ADDON_CAPABILITIES* pCapabilities)
{
// TODO: the API is completely naff! there is no way to update any
// of the following or the GetBackend*() methods after connection
// they get called once and only once! Therefore we attempt to
// wait for connection here

tvh->WaitForConnection();

pCapabilities->bSupportsEPG = true;
pCapabilities->bSupportsTV = true;
pCapabilities->bSupportsRadio = true;
Expand Down Expand Up @@ -350,9 +355,6 @@ const char *GetConnectionString(void)

PVR_ERROR GetDriveSpace(long long *iTotal, long long *iUsed)
{
if (!tvh->WaitForConnection())
return PVR_ERROR_SERVER_TIMEOUT;

return tvh->GetDriveSpace(iTotal, iUsed);
}

Expand Down

0 comments on commit c22c798

Please sign in to comment.