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


C++ intrusive_ptr::ignore_bandwidth_limits方法代码示例

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


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

示例1: request_bandwidth

	void bandwidth_manager::request_bandwidth(intrusive_ptr<peer_connection> peer
		, bool non_prioritized)
	{
		INVARIANT_CHECK;

		assert(!peer->ignore_bandwidth_limits());

		// make sure this peer isn't already in line
		// waiting for bandwidth
#ifndef NDEBUG
		for (std::deque<bw_queue_entry>::iterator i = m_queue.begin()
			, end(m_queue.end()); i != end; ++i)
		{
			assert(i->peer < peer || peer < i->peer);
		}
#endif

		assert(peer->max_assignable_bandwidth(m_channel) > 0);
		
		// if the queue is empty, we have to push the new
		// peer at the back of it. If the peer is non-prioritized
		// it is not supposed to cut in fron of anybody, so then
		// we also just add it at the end
		if (m_queue.empty() || non_prioritized)
		{
			m_queue.push_back(bw_queue_entry(peer, non_prioritized));
		}
		else
		{
			// skip forward in the queue until we find a prioritized peer
			// or hit the front of it.
			std::deque<bw_queue_entry>::reverse_iterator i = m_queue.rbegin();
			while (i != m_queue.rend() && i->non_prioritized) ++i;
			m_queue.insert(i.base(), bw_queue_entry(peer, non_prioritized));
		}
		if (m_queue.size() == 1) hand_out_bandwidth();
	}
开发者ID:svn2github,项目名称:libtorrent-rasterbar,代码行数:37,代码来源:bandwidth_manager.cpp


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