Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Commits on Dec 14, 2012
  1. @daniel-kristjansson
Commits on Jun 1, 2012
  1. @daniel-kristjansson
Commits on Aug 23, 2011
  1. @daniel-kristjansson

    Convert rand() usage to random().

    daniel-kristjansson authored
    rand() is not re-entrant, random() is. random() also has more randomness in the lower order bits.
    
    Note: this may break compilation on windows. The solution is to add the compat.h header to the files that do not compile.
Commits on Aug 18, 2011
  1. @daniel-kristjansson

    Refs #9993. Move SSDP and TaskQueue thread shutdown to mythcontext.

    daniel-kristjansson authored
    These threads can be started by MythContext even when UPnP is otherwise disabled if we don't find a config.xml or mysql.txt so we always need to ensure that they are shutdown whenever MythContext is used.
Commits on Aug 11, 2011
  1. @daniel-kristjansson

    Tab cleanup.

    daniel-kristjansson authored
Commits on Aug 8, 2011
  1. @daniel-kristjansson
  2. @daniel-kristjansson

    This adds two new classes MThread and MThreadPool to be used instead …

    daniel-kristjansson authored
    …of QThread and QThreadPool.
    
    These mirror the API's of the Qt classes but also add a requirement for a QString naming
    the thread or naming the runnable which are used for debugging. These wrappers also make
    sure mysql connections are torn down properly and have a number of safety checks and
    assurances. The destructor for MThread also makes sure that a thread has stopped running
    before we allow the QThread to be deleted. And MThreaPool makes sure all it's threads
    have stopped running. MThread has a Cleanup() method that attempts to shut down any threads
    that are running, it only works for threads that exit on a call to exit(), which includes
    any threads using the Qt event loop. It will also print out the names of the threads that
    are still running for debugging purposes.
    
    MThread has one special constructor. It takes a QRunnable* and runs it instead of the
    Qt event loop in the default run() implementation. Unlike MThreadPool and QThreadPool,
    MThread does not delete this runnable when it exits. This allows you to run something
    with less boilerplate code. Just like with QThread in Qt4 it really is better to use
    the Qt event loop rather than write your own. As you don't use the Qt event loop QObject
    deleteLater's are not executed until the  thread exits, Qt events and timers do not work
    making Qt networking classes misbehave and signals/slots are generally unsafe. However,
    many of the threads with event loops in MythTV were written before Qt allowed an event
    loop outside the main thread so this syntactic sugar just lets us handle that with less
    lines of code.
    
    There are a few other differences with respect to Qt's classes other than requiring a name.
    First, MThread does not inherit from QObject, if you need QObject services in a threading
    class you will need to inherit from QObject seperately. Note when you inherit from QObject,
    you must inherit from no more than one QObject based class and it must be first in the list
    of classes your class inherits from (a Qt restriction). Second, QThread doesn't implement
    most of QThread's static methods, notably QThread::currentThread(). It does make the
    underlying QThread available via the qthread() method.. but the usual reason to use
    QThread::currentThread() is to check which thread you are running in.. for this there
    is a set of helper functions is_current_thread(MThread&), is_current_thread(QThread*),
    and is_current_thread(MThread*) which you can use instead. Finally, MThreadPool does not
    have reserveThread() and releaseThread() calls; instead use startReserved(). The
    reserveThread() and releaseThread() API is not a good API because it doesn't ensure that
    your runnable starts right away even though the thread will eventually not be counted
    amoung those forcing other threads to go to the queue rather than running right away.
Commits on Aug 1, 2011
  1. @daniel-kristjansson

    Reduce some LOG_CRIT log level messages to LOG_NOTICE or LOG_ERR as a…

    daniel-kristjansson authored
    …ppropriate.
    
    This is mostly not my code so my judgement calls may be off in some cases, but the general concept is that LOG_NOTICE is for informational/state messages of greater importantce than average (LOG_INFO), while LOG_ERR is for normal errors and LOG_CRIT is for extreemely critical information; like an error that indicates you should replace your hardware.
Commits on Jul 31, 2011
  1. @daniel-kristjansson
Commits on Jun 17, 2011
  1. @daniel-kristjansson

    This ports a few UPnP changes over from mythtv-rec2.

    daniel-kristjansson authored
     * SSDPCacheEntries::Find() and SSDPCacheEntries::GetFirst() now return a locked device location (when non-null)
        This ensures that there are no race conditions wrt to disappearing devices. Of all the changes
        this is most likely to cause problems to UPnP code outside the tree.
     * Many classes now have a toString() for debugging.
     * Extends SOAPClient so it can send different commands; this is not used yet in master, but is used in mythtv-rec2 to communicate with an OCUR recording device.
     * Moves UPnpServiceImpl class into it's own files.
     * Moves MBroadcastSocketDevice from broadcast.h to mbroadcastsocketdevice.h
     * Moves MMulticastSocketDevice from multicast.{h,cpp} to mmulticastsocketdevice.{h,cpp}
       Also extends writeBlock method to multicast on all IPv4 addresses other than localhost;
       this ensures that devices that show up on their own internal networks (like an Ceton
       OCUR recorder) can see our broadcasts.
     * This also fixes numerous small bugs.
Commits on Nov 17, 2009
  1. @daniel-kristjansson

    Some more header cleanup.

    daniel-kristjansson authored
    git-svn-id: http://svn.mythtv.org/svn/trunk@22857 7dbf422c-18fa-0310-86e9-fd20926502f2
Commits on Aug 12, 2009
  1. @daniel-kristjansson

    Don't segfault if socket failed to open in ssdp.cpp

    daniel-kristjansson authored
    git-svn-id: http://svn.mythtv.org/svn/trunk@21230 7dbf422c-18fa-0310-86e9-fd20926502f2
Commits on Aug 1, 2008
  1. @daniel-kristjansson

    Fixes #5592. Qt4'ifies libmythupnp.

    daniel-kristjansson authored
    Most of the substitutions are fairly straighforward, with these exceptions:
     * NameValueList is now a list of values not pointers, this made the code more readable after the Qt4 conversion and saves memory, the two functions that got a speed advantage from using pointers were refactored so as not to run any slower.
     * HttpRequest::Encode() now returns the modified string rather than modifying a reference. This saves us from having to create temporary strings all over the place.
     * Some DB stuff in mythxml.cpp was refactored and now spit out an error message if a query fails instead of failing silently.
     * QRegExp were removed where not needed and made class variables where needed so as to avoid recompiling the same expression multiple times.
    
    I've checked in valgrind for any leaks and confirmed that functionality is unaffected using djmount. Nigel fixed OSX compilation and also confirmed that functionality was unaffected with yesterday's patch.
    
    
    
    git-svn-id: http://svn.mythtv.org/svn/trunk@18011 7dbf422c-18fa-0310-86e9-fd20926502f2
Commits on Jul 30, 2008
  1. @daniel-kristjansson
Commits on Jul 18, 2008
  1. @daniel-kristjansson

    Refs #5311. Eliminates all ascii()/utf8()/latin1() calls & most Q3CSt…

    daniel-kristjansson authored
    …ring instances in libmythupnp.
    
    git-svn-id: http://svn.mythtv.org/svn/trunk@17852 7dbf422c-18fa-0310-86e9-fd20926502f2
Commits on Dec 5, 2007
  1. @daniel-kristjansson
Something went wrong with that request. Please try again.