eitd: little cleanup

Origin commit data
------------------
Commit: f4ba558155
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2012-03-07 (Wed, 07 Mar 2012)
This commit is contained in:
[CST] Focus
2012-03-07 16:44:35 +04:00
parent 3f42634cb8
commit e7cf3a88ad
3 changed files with 39 additions and 62 deletions

View File

@@ -1,15 +1,16 @@
/* /*
* $Header: /cvs/tuxbox/apps/tuxbox/neutrino/daemons/sectionsd/dmx.cpp,v 1.51 2009/06/14 21:46:03 rhabarber1848 Exp $
*
* DMX class (sectionsd) - d-box2 linux project * DMX class (sectionsd) - d-box2 linux project
* *
* (C) 2001 by fnbrd, * (C) 2001 by fnbrd (fnbrd@gmx.de),
* 2003 by thegoodguy <thegoodguy@berlios.de> * 2003 by thegoodguy <thegoodguy@berlios.de>
* *
* Copyright (C) 2011-2012 CoolStream International Ltd
*
* License: GPLv2
*
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation;
* (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -22,7 +23,6 @@
* *
*/ */
#include <dmx.h> #include <dmx.h>
#include <dmxapi.h> #include <dmxapi.h>
#include <debug.h> #include <debug.h>
@@ -44,7 +44,7 @@
#include "debug.h" #include "debug.h"
//#define DEBUG_MUTEX 1 //#define DEBUG_MUTEX 1
//#define DEBUG_DEMUX 1 // debug start/close/change #define DEBUG_DEMUX 1 // debug start/close/change
//#define DEBUG_CACHED_SECTIONS 1 //#define DEBUG_CACHED_SECTIONS 1
//#define DEBUG_COMPLETE_SECTIONS 1 //#define DEBUG_COMPLETE_SECTIONS 1
#define DEBUG_COMPLETE 1 #define DEBUG_COMPLETE 1
@@ -203,11 +203,10 @@ inline sections_id_t create_sections_id(const uint8_t table_id, const uint16_t e
bool DMX::check_complete(sections_id_t s_id, uint8_t number, uint8_t last, uint8_t segment_last) bool DMX::check_complete(sections_id_t s_id, uint8_t number, uint8_t last, uint8_t segment_last)
{ {
bool ret = false; bool ret = false;
//lock();
section_map_t::iterator it = seenSections.find(s_id); section_map_t::iterator it = seenSections.find(s_id);
if (it == seenSections.end()) if (it == seenSections.end()) {
{
seenSections.insert(s_id); seenSections.insert(s_id);
calcedSections.insert(s_id); calcedSections.insert(s_id);
uint64_t tmpval = s_id & 0xFFFFFFFFFFFFFF00ULL; uint64_t tmpval = s_id & 0xFFFFFFFFFFFFFF00ULL;
@@ -253,7 +252,6 @@ printf(" [%s cache] old section for table 0x%02x sid 0x%04x section 0x%02x last
if(seenSections.size() > 10) if(seenSections.size() > 10)
ret = true; ret = true;
} }
//unlock();
return ret; return ret;
} }
@@ -448,11 +446,9 @@ int DMX::getSection(uint8_t *buf, const unsigned timeoutInMSeconds, int &timeout
} }
if(complete) { if(complete) {
//lock();
seenSections.clear(); seenSections.clear();
calcedSections.clear(); calcedSections.clear();
timeouts = -2; timeouts = -2;
//unlock();
} }
if(rc > 0) if(rc > 0)
first_skipped = 0; first_skipped = 0;

View File

@@ -1,14 +1,14 @@
/* /*
* $Header: /cvs/tuxbox/apps/tuxbox/neutrino/daemons/sectionsd/dmx.h,v 1.17 2009/05/23 16:50:12 seife Exp $
*
* DMX class (sectionsd) - d-box2 linux project * DMX class (sectionsd) - d-box2 linux project
* *
* (C) 2003 by thegoodguy <thegoodguy@berlios.de> * (C) 2003 by thegoodguy <thegoodguy@berlios.de>
* Copyright (C) 2011-2012 CoolStream International Ltd
*
* License: GPLv2
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation;
* (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of

View File

@@ -1,27 +1,27 @@
// /*
// sectionsd.cpp (network daemon for SI-sections) * sectionsd.cpp (network daemon for SI-sections)
// (dbox-II-project) * (dbox-II-project)
// *
// Copyright (C) 2001 by fnbrd * (C) 2001 by fnbrd (fnbrd@gmx.de)
// *
// Homepage: http://dbox2.elxsi.de * Copyright (C) 2011-2012 CoolStream International Ltd
// *
// Copyright (C) 2008, 2009 Stefan Seyfried * License: GPLv2
// *
// This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation;
// (at your option) any later version. *
// * This program is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of
// but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details.
// GNU General Public License for more details. *
// * You should have received a copy of the GNU General Public License
// You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software
// along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
// */
#ifndef __eitd_h__ #ifndef __eitd_h__
#define __eitd_h__ #define __eitd_h__
@@ -179,7 +179,8 @@ class CSectionThread : public OpenThreads::Thread, public DMX
running = true; running = true;
return (OpenThreads::Thread::start() == 0); return (OpenThreads::Thread::start() == 0);
} }
void StopRun() { void StopRun()
{
xprintf("%s::StopRun: to lock\n", name.c_str()); xprintf("%s::StopRun: to lock\n", name.c_str());
lock(); lock();
running = false; running = false;
@@ -189,7 +190,6 @@ class CSectionThread : public OpenThreads::Thread, public DMX
xprintf("%s::StopRun: to unlock\n", name.c_str()); xprintf("%s::StopRun: to unlock\n", name.c_str());
unlock(); unlock();
} }
void Wakeup() { pthread_cond_broadcast(&change_cond); }
bool Stop() bool Stop()
{ {
xprintf("%s::Stop: to broadcast\n", name.c_str()); xprintf("%s::Stop: to broadcast\n", name.c_str());
@@ -198,25 +198,6 @@ class CSectionThread : public OpenThreads::Thread, public DMX
int ret = (OpenThreads::Thread::join() == 0); int ret = (OpenThreads::Thread::join() == 0);
xprintf("%s::Stop: to close\n", name.c_str()); xprintf("%s::Stop: to close\n", name.c_str());
DMX::close(); DMX::close();
#if 0
if(!running)
return false;
xprintf("%s::Stop: to lock\n", name.c_str());
lock();
running = false;
xprintf("%s::Stop: to broadcast\n", name.c_str());
pthread_cond_broadcast(&change_cond);
xprintf("%s::Stop: to unlock\n", name.c_str());
unlock();
#if 1
xprintf("%s::Stop: to closefd\n", name.c_str());
DMX::closefd();
#endif
xprintf("%s::Stop: to join\n", name.c_str());
int ret = (OpenThreads::Thread::join() == 0);
xprintf("%s::Stop: to close\n", name.c_str());
DMX::close();
#endif
return ret; return ret;
} }
}; };