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


C++ error_code::what方法代码示例

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


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

示例1: resend_request

void upnp::resend_request(error_code const& e)
{
	if (e) return;

	mutex_t::scoped_lock l(m_mutex);

	if (m_closing) return;

	if (m_retry_count < 12
		&& (m_devices.empty() || m_retry_count < 4))
	{
		discover_device_impl();
		return;
	}

	if (m_devices.empty())
	{
		disable("no UPnP router found (no response)");
		return;
	}
	
	for (std::set<rootdevice>::iterator i = m_devices.begin()
		, end(m_devices.end()); i != end; ++i)
	{
		if (i->control_url.empty() && !i->upnp_connection && !i->disabled)
		{
			// we don't have a WANIP or WANPPP url for this device,
			// ask for it
			rootdevice& d = const_cast<rootdevice&>(*i);
			TORRENT_ASSERT(d.magic == 1337);
#ifndef BOOST_NO_EXCEPTIONS
			try
			{
#endif
				char msg[200];
				snprintf(msg, sizeof(msg), "connecting to: %s", d.url.c_str());
				log(msg);
				if (d.upnp_connection) d.upnp_connection->close();
				d.upnp_connection.reset(new http_connection(m_io_service
					, m_cc, bind(&upnp::on_upnp_xml, self(), _1, _2
					, boost::ref(d), _5)));
				d.upnp_connection->get(d.url, seconds(30), 1);
#ifndef BOOST_NO_EXCEPTIONS
			}
			catch (std::exception& e)
			{
				(void)e;
				char msg[200];
				snprintf(msg, sizeof(msg), "connection failed to: %s %s", d.url.c_str(), e.what());
				log(msg);
				d.disabled = true;
			}
#endif
		}
	}
}
开发者ID:Krinkelss,项目名称:libtorrent,代码行数:56,代码来源:upnp.cpp


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