Skip to content
This repository has been archived by the owner on Apr 15, 2023. It is now read-only.

Commit

Permalink
tvheadend addon: fix CHTSPData::GetEvent(). lock the mutex while gett…
Browse files Browse the repository at this point in the history
…ing a new sequence number.
  • Loading branch information
opdenkamp committed May 6, 2011
1 parent bdd964d commit 2b789bc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions xbmc/pvrclients/tvheadend/HTSPConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,12 @@ bool CHTSPConnection::SendMessage(htsmsg_t* m)

htsmsg_t* CHTSPConnection::ReadResult(htsmsg_t* m, bool sequence)
{
uint32_t iSequence = 0;
if(sequence)
htsmsg_add_u32(m, "seq", ++m_iSequence);
{
iSequence = AddSequence();
htsmsg_add_u32(m, "seq", iSequence);
}

if(!SendMessage(m))
return NULL;
Expand All @@ -196,7 +200,7 @@ htsmsg_t* CHTSPConnection::ReadResult(htsmsg_t* m, bool sequence)
uint32_t seq;
if(!sequence)
break;
if(!htsmsg_get_u32(m, "seq", &seq) && seq == m_iSequence)
if(!htsmsg_get_u32(m, "seq", &seq) && seq == iSequence)
break;

queue.push_back(m);
Expand Down
2 changes: 1 addition & 1 deletion xbmc/pvrclients/tvheadend/HTSPData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ bool CHTSPData::GetEvent(SEvent& event, uint32_t id)
htsmsg_t *msg = htsmsg_create_map();
htsmsg_add_str(msg, "method", "getEvent");
htsmsg_add_u32(msg, "eventId", id);
if((msg = m_session->ReadResult(msg, true)) == NULL)
if((msg = ReadResult(msg)) == NULL)
{
XBMC->Log(LOG_DEBUG, "%s - failed to get event %d", __FUNCTION__, id);
return false;
Expand Down

0 comments on commit 2b789bc

Please sign in to comment.