From e88bcaea90214ff98702db026156119e15c29042 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Fri, 28 Dec 2007 19:26:26 +0000 Subject: [PATCH] made http_stream and proxy_base support builds with exceptions disabled --- include/libtorrent/proxy_base.hpp | 12 ++++++++++++ src/http_stream.cpp | 18 ++++++++++++------ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/include/libtorrent/proxy_base.hpp b/include/libtorrent/proxy_base.hpp index 037a1c2d4..153da5623 100644 --- a/include/libtorrent/proxy_base.hpp +++ b/include/libtorrent/proxy_base.hpp @@ -75,6 +75,7 @@ public: return m_sock.read_some(buffers, ec); } +#ifndef BOOST_NO_EXCEPTIONS template std::size_t read_some(Mutable_Buffers const& buffers) { @@ -86,6 +87,7 @@ public: { m_sock.io_control(ioc); } +#endif template 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) { diff --git a/src/http_stream.cpp b/src/http_stream.cpp index e645dff84..78603ca8b 100644 --- a/src/http_stream.cpp +++ b/src/http_stream.cpp @@ -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; }