diff --git a/include/libtorrent/error_code.hpp b/include/libtorrent/error_code.hpp index 536f51fba..c0f84a5b0 100644 --- a/include/libtorrent/error_code.hpp +++ b/include/libtorrent/error_code.hpp @@ -81,6 +81,8 @@ namespace libtorrent typedef asio::error_code error_code; inline asio::error::error_category get_posix_category() { return asio::error::system_category; } inline asio::error::error_category get_system_category() { return asio::error::system_category; } + + extern asio::error::error_category libtorrent_category; #else struct TORRENT_EXPORT libtorrent_error_category : boost::system::error_category diff --git a/include/libtorrent/socket.hpp b/include/libtorrent/socket.hpp index 98f5d8151..719dccc60 100644 --- a/include/libtorrent/socket.hpp +++ b/include/libtorrent/socket.hpp @@ -83,21 +83,19 @@ namespace libtorrent { #if BOOST_VERSION < 103500 - using asio::ip::tcp; - using asio::ip::udp; - using asio::async_write; - using asio::async_read; + using ::asio::ip::tcp; + using ::asio::ip::udp; + using ::asio::async_write; + using ::asio::async_read; - typedef asio::ip::tcp::socket stream_socket; - typedef asio::ip::address address; - typedef asio::ip::address_v4 address_v4; - typedef asio::ip::address_v6 address_v6; - typedef asio::ip::udp::socket datagram_socket; - typedef asio::ip::tcp::acceptor socket_acceptor; - typedef asio::io_service io_service; - - namespace asio = ::asio; - typedef asio::basic_deadline_timer deadline_timer; + typedef ::asio::ip::tcp::socket stream_socket; + typedef ::asio::ip::address address; + typedef ::asio::ip::address_v4 address_v4; + typedef ::asio::ip::address_v6 address_v6; + typedef ::asio::ip::udp::socket datagram_socket; + typedef ::asio::ip::tcp::acceptor socket_acceptor; + typedef ::asio::io_service io_service; + typedef ::asio::basic_deadline_timer deadline_timer; #else using boost::asio::ip::tcp; using boost::asio::ip::udp; diff --git a/src/error_code.cpp b/src/error_code.cpp index 98a56d7e5..17fc1739f 100644 --- a/src/error_code.cpp +++ b/src/error_code.cpp @@ -32,12 +32,12 @@ POSSIBILITY OF SUCH DAMAGE. #include -#if BOOST_VERSION >= 103500 - #include "libtorrent/error_code.hpp" namespace libtorrent { +#if BOOST_VERSION >= 103500 + const char* libtorrent_error_category::name() const { return "libtorrent error"; @@ -78,7 +78,11 @@ namespace libtorrent libtorrent_error_category libtorrent_category; -} +#else + + ::asio::error::error_category libtorrent_category = asio::error::error_category(20); #endif +} +