本文整理汇总了C++中Site::pop_url方法的典型用法代码示例。如果您正苦于以下问题:C++ Site::pop_url方法的具体用法?C++ Site::pop_url怎么用?C++ Site::pop_url使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Site
的用法示例。
在下文中一共展示了Site::pop_url方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
void Requester::run()
{
unsigned iter = 0;
while (1)
{
if (crawler->get_site_que()->size() <= iter)
break;
Site *site = (*crawler->get_site_que())[iter];
Socketpool *socketpool = new Socketpool(SOCKETNUM, site->get_host());
while (1)
{
string url = site->pop_url();
if (url.length() == 0) //这个队列已经完了
break;
site->push_fetched(url);
Net *net = socketpool->get_idle_socket();
net->link();
http_requester(net, url);
cout << "send request " + url << endl;
//if (post_ok == -1)
//{
//net->link();
//http_requester(net, url);
//}
struct epoll_event ev;
ev.events = EPOLLIN;
Epoll_ptr *ptr = new Epoll_ptr();
ptr->net = net;
ptr->url = url;
ptr->socketpool = socketpool;
ev.data.ptr = ptr;
epoll_ctl(crawler->get_epollfd(), EPOLL_CTL_ADD, net->get_sockfd(), &ev);
cout << "sockfd = " << net->get_sockfd() << endl;
}
iter++;
}
}