当前位置: 首页>>代码示例>>C++>>正文


C++ CFileCurl::Cancel方法代码示例

本文整理汇总了C++中CFileCurl::Cancel方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileCurl::Cancel方法的具体用法?C++ CFileCurl::Cancel怎么用?C++ CFileCurl::Cancel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CFileCurl的用法示例。


在下文中一共展示了CFileCurl::Cancel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: open

bool MythXml::open(CStdString hostname, int port, CStdString user, CStdString pass, int pin, long timeout) {
    hostname_ = hostname;
    port_ = port;
    timeout_ = timeout;
    pin_ = pin;
    CStdString strUrl;
    strUrl.Format("http://%s:%i/Myth/GetConnectionInfo?Pin=%i", hostname.c_str(), port, pin);
    CStdString strXML;

    CFileCurl http;

    http.SetTimeout(timeout);
    if(!http.Get(strUrl, strXML)) {
        CLog::Log(LOGDEBUG, "MythXml - Could not open connection to mythtv backend.");
        http.Cancel();
        return false;
    }
    http.Cancel();
    return true;
}
开发者ID:mbolhuis,项目名称:xbmc-antiquated,代码行数:20,代码来源:MythXml.cpp

示例2: Process

void CRssReader::Process()
{
  while (GetQueueSize())
  {
    CSingleLock lock(*this);

    int iFeed = m_vecQueue.front();
    m_vecQueue.erase(m_vecQueue.begin());

    m_strFeed[iFeed] = "";
    m_strColors[iFeed] = "";

    CFileCurl http;
    http.SetUserAgent(g_settings.m_userAgent);
    http.SetTimeout(2);
    CStdString strXML;
    CStdString strUrl = m_vecUrls[iFeed];
    lock.Leave();

    int nRetries = 3;
    CURL url(strUrl);

    // we wait for the network to come up
    if ((url.GetProtocol() == "http" || url.GetProtocol() == "https") && !g_application.getNetwork().IsAvailable(true))
      strXML = "<rss><item><title>"+g_localizeStrings.Get(15301)+"</title></item></rss>";
    else
    {
      unsigned int starttime = CTimeUtils::GetTimeMS();
      while ( (!m_bStop) && (nRetries > 0) )
      {
        unsigned int currenttimer = CTimeUtils::GetTimeMS() - starttime;
        if (currenttimer > 15000)
        {
          CLog::Log(LOGERROR,"Timeout whilst retrieving %s", strUrl.c_str());
          http.Cancel();
          break;
        }
        nRetries--;

        if (url.GetProtocol() != "http" && url.GetProtocol() != "https")
        {
          CFile file;
          if (file.Open(strUrl))
          {
            char *yo = new char[(int)file.GetLength()+1];
            file.Read(yo,file.GetLength());
            yo[file.GetLength()] = '\0';
            strXML = yo;
            delete[] yo;
            break;
          }
        }
        else
          if (http.Get(strUrl, strXML))
          {
            CLog::Log(LOGDEBUG, "Got rss feed: %s", strUrl.c_str());
            break;
          }
      }
      http.Cancel();
    }
    if ((!strXML.IsEmpty()) && m_pObserver)
    {
      // erase any <content:encoded> tags (also unsupported by tinyxml)
      int iStart = strXML.Find("<content:encoded>");
      int iEnd = 0;
      while (iStart > 0)
      {
        // get <content:encoded> end position
        iEnd = strXML.Find("</content:encoded>", iStart) + 18;

        // erase the section
        strXML = strXML.erase(iStart, iEnd - iStart);

        iStart = strXML.Find("<content:encoded>");
      }

      if (Parse((LPSTR)strXML.c_str(),iFeed))
      {
        CLog::Log(LOGDEBUG, "Parsed rss feed: %s", strUrl.c_str());
      }
    }
  }
  UpdateObserver();
}
开发者ID:Openivo,项目名称:xbmc,代码行数:85,代码来源:RssReader.cpp


注:本文中的CFileCurl::Cancel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。