made http_stream and proxy_base support builds with exceptions disabled

This commit is contained in:
Arvid Norberg 2007-12-28 19:26:26 +00:00
parent e6e5b43219
commit e88bcaea90
2 changed files with 24 additions and 6 deletions

View File

@ -75,6 +75,7 @@ public:
return m_sock.read_some(buffers, ec);
}
#ifndef BOOST_NO_EXCEPTIONS
template <class Mutable_Buffers>
std::size_t read_some(Mutable_Buffers const& buffers)
{
@ -86,6 +87,7 @@ public:
{
m_sock.io_control(ioc);
}
#endif
template <class IO_Control_Command>
void io_control(IO_Control_Command& ioc, asio::error_code& ec)
@ -99,32 +101,38 @@ public:
m_sock.async_write_some(buffers, handler);
}
#ifndef BOOST_NO_EXCEPTIONS
void bind(endpoint_type const& endpoint)
{
m_sock.bind(endpoint);
}
#endif
void bind(endpoint_type const& endpoint, asio::error_code& ec)
{
m_sock.bind(endpoint, ec);
}
#ifndef BOOST_NO_EXCEPTIONS
void open(protocol_type const& p)
{
m_sock.open(p);
}
#endif
void open(protocol_type const& p, asio::error_code& ec)
{
m_sock.open(p, ec);
}
#ifndef BOOST_NO_EXCEPTIONS
void close()
{
m_remote_endpoint = endpoint_type();
m_sock.close();
m_resolver.cancel();
}
#endif
void close(asio::error_code& ec)
{
@ -132,20 +140,24 @@ public:
m_resolver.cancel();
}
#ifndef BOOST_NO_EXCEPTIONS
endpoint_type remote_endpoint()
{
return m_remote_endpoint;
}
#endif
endpoint_type remote_endpoint(asio::error_code& ec)
{
return m_remote_endpoint;
}
#ifndef BOOST_NO_EXCEPTIONS
endpoint_type local_endpoint()
{
return m_sock.local_endpoint();
}
#endif
endpoint_type local_endpoint(asio::error_code& ec)
{

View File

@ -44,7 +44,8 @@ namespace libtorrent
if (e || i == tcp::resolver::iterator())
{
(*h)(e);
close();
asio::error_code ec;
close(ec);
return;
}
@ -57,7 +58,8 @@ namespace libtorrent
if (e)
{
(*h)(e);
close();
asio::error_code ec;
close(ec);
return;
}
@ -89,7 +91,8 @@ namespace libtorrent
if (e)
{
(*h)(e);
close();
asio::error_code ec;
close(ec);
return;
}
@ -104,7 +107,8 @@ namespace libtorrent
if (e)
{
(*h)(e);
close();
asio::error_code ec;
close(ec);
return;
}
@ -134,7 +138,8 @@ namespace libtorrent
if (status == 0)
{
(*h)(asio::error::operation_not_supported);
close();
asio::error_code ec;
close(ec);
return;
}
@ -143,7 +148,8 @@ namespace libtorrent
if (code != 200)
{
(*h)(asio::error::operation_not_supported);
close();
asio::error_code ec;
close(ec);
return;
}