Ticket #8467: mythtv-master-httpool_delay.patch

File mythtv-master-httpool_delay.patch, 1.8 KB (added by warpme@…, 8 years ago)

AddURLrequest delay patch

  • mythtv/libs/libmythbase/mythhttppool.cpp

    diff -Naur mythtv-master-20110924-g7fa4d4e-old/mythtv/libs/libmythbase/mythhttppool.cpp mythtv-master-20110924-g7fa4d4e-new/mythtv/libs/libmythbase/mythhttppool.cpp
    old new  
    3131{
    3232    QMutexLocker locker(&m_lock);
    3333
    34     LOG(VB_NETWORK, LOG_DEBUG, LOC + QString("AddUrlRequest(%1, 0x%2)")
     34    LOG(VB_GENERAL, LOG_DEBUG, LOC + QString("AddUrlRequest(%1, 0x%2)")
    3535            .arg(url.toString()).arg((quint64)listener,0,16));
    3636
    3737    bool in_queue = m_urlToListener.find(url) != m_urlToListener.end();
     
    4848
    4949    if (it != m_hostToHandler.end())
    5050    {
     51        usleep(1000000);
    5152        (*it)->AddUrlRequest(url);
    5253    }
    5354    else if ((uint)m_hostToHandler.size() < m_maxConnections)
    5455    {
    5556        MythHttpHandler *hh = new MythHttpHandler(this);
    5657        m_hostToHandler[url.host()] = hh;
     58        usleep(1000000);
    5759        hh->AddUrlRequest(url);
    5860    }
    5961    else
     
    6971            MythHttpHandler *hh = *it;
    7072            m_hostToHandler.erase(it);
    7173            m_hostToHandler[url.host()] = hh;
     74            usleep(1000000);
    7275            hh->AddUrlRequest(url);
    7376        }
    7477        else
     
    124127{
    125128    QMutexLocker locker(&m_lock);
    126129
    127     LOG(VB_NETWORK, LOG_DEBUG, LOC + QString("Done(%1, 0x%2)")
     130    LOG(VB_GENERAL, LOG_DEBUG, LOC + QString("Done(%1, 0x%2)")
    128131            .arg(host).arg((quint64)handler,0,16));
    129132
    130133    HostToHandler::iterator it = m_hostToHandler.find(host);
     
    149152            m_hostToHandler.erase(it);
    150153            m_hostToHandler[url.host()] = handler;
    151154        }
     155        usleep(1000000);
    152156        handler->AddUrlRequest(url);
    153157        break;
    154158    }