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

Commit

Permalink
Tryfix ticket #4486
Browse files Browse the repository at this point in the history
git-svn-id: http://www.streamboard.tv/svn/oscam/trunk@11329 4b0bc96b-bc66-0410-9d44-ebda105a78c1
  • Loading branch information
theparasol committed Jan 11, 2017
1 parent f98efa5 commit 2d1612f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
14 changes: 14 additions & 0 deletions module-dvbapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -4077,6 +4077,7 @@ int32_t dvbapi_net_init_listenfd(void)
}

static pthread_mutex_t event_handler_lock;
static int8_t init_mutex = 0;

void event_handler(int32_t UNUSED(signal))
{
Expand All @@ -4087,6 +4088,12 @@ void event_handler(int32_t UNUSED(signal))
int32_t i, pmt_fd;
uchar mbuf[2048]; // dirty fix: larger buffer needed for CA PMT mode 6 with many parallel channels to decode
if(dvbapi_client != cur_client()) { return; }

if(init_mutex == 0)
{
SAFE_MUTEX_INIT(&event_handler_lock, NULL);
init_mutex = 1;
}

SAFE_MUTEX_LOCK(&event_handler_lock);

Expand Down Expand Up @@ -5976,7 +5983,14 @@ void dvbapi_send_dcw(struct s_client *client, ECM_REQUEST *er)

if(er->rc < E_NOTFOUND && cfg.dvbapi_requestmode == 1 && er->caid != 0) // FOUND
{
if(demux[i].init_mutex == 0)
{
SAFE_MUTEX_INIT(&demux[i].answerlock, NULL);
demux[i].init_mutex = 1;
}

SAFE_MUTEX_LOCK(&demux[i].answerlock); // only process one ecm answer

if(demux[i].ECMpids[j].checked != 4)
{

Expand Down
3 changes: 2 additions & 1 deletion module-dvbapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ typedef struct demux_s
uint8_t running;
uint8_t old_ecmfiltercount; // previous ecm filtercount
uint8_t old_emmfiltercount; // previous emm filtercount
pthread_mutex_t answerlock; // requestmode 1 avoid race
pthread_mutex_t answerlock; // requestmode 1 avoid race
int8_t init_mutex;
#ifdef WITH_STAPI
uint32_t DescramblerHandle[PTINUM];
int32_t desc_pidcount;
Expand Down

0 comments on commit 2d1612f

Please sign in to comment.