本文整理汇总了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
}
}
}