Skip to content

Commit

Permalink
[pvr.tvh] add support for overriden the global response timeout for i…
Browse files Browse the repository at this point in the history
…ndividual

calls to SendAndWait()
  • Loading branch information
Jalle19 authored and herrnst committed Apr 26, 2014
1 parent a01a1ed commit fc69c47
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
14 changes: 10 additions & 4 deletions addons/pvr.tvh/src/HTSPConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,11 @@ bool CHTSPConnection::SendMessage ( const char *method, htsmsg_t *msg )
/*
* Send a message and wait for response
*/
htsmsg_t *CHTSPConnection::SendAndWait0 ( const char *method, htsmsg_t *msg )
htsmsg_t *CHTSPConnection::SendAndWait0 ( const char *method, htsmsg_t *msg, int iResponseTimeout )
{
if (iResponseTimeout == -1)
iResponseTimeout = g_iResponseTimeout;

uint32_t seq;

/* Add Sequence number */
Expand All @@ -329,7 +332,7 @@ htsmsg_t *CHTSPConnection::SendAndWait0 ( const char *method, htsmsg_t *msg )
}

/* Wait for response */
msg = resp.Get(m_mutex, g_iResponseTimeout * 1000);
msg = resp.Get(m_mutex, iResponseTimeout * 1000);
m_messages.erase(seq);
if (!msg)
{
Expand All @@ -343,11 +346,14 @@ htsmsg_t *CHTSPConnection::SendAndWait0 ( const char *method, htsmsg_t *msg )
/*
* Send and wait for response
*/
htsmsg_t *CHTSPConnection::SendAndWait ( const char *method, htsmsg_t *msg )
htsmsg_t *CHTSPConnection::SendAndWait ( const char *method, htsmsg_t *msg, int iResponseTimeout )
{
if (iResponseTimeout == -1)
iResponseTimeout = g_iResponseTimeout;

if (!WaitForConnection())
return false;
return SendAndWait0(method, msg);
return SendAndWait0(method, msg, iResponseTimeout);
}

bool CHTSPConnection::SendHello ( void )
Expand Down
4 changes: 2 additions & 2 deletions addons/pvr.tvh/src/Tvheadend.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ class CHTSPConnection
void Disconnect ( void );

bool SendMessage0 ( const char *method, htsmsg_t *m );
htsmsg_t *SendAndWait0 ( const char *method, htsmsg_t *m );
htsmsg_t *SendAndWait0 ( const char *method, htsmsg_t *m, int iResponseTimeout = -1);
bool SendMessage ( const char *method, htsmsg_t *m );
htsmsg_t *SendAndWait ( const char *method, htsmsg_t *m );
htsmsg_t *SendAndWait ( const char *method, htsmsg_t *m, int iResponseTimeout = -1 );

int GetProtocol ( void ) { return m_htspVersion; }

Expand Down

0 comments on commit fc69c47

Please sign in to comment.