diff --git a/Jamfile b/Jamfile index b7d5875df..b43520eb0 100644 --- a/Jamfile +++ b/Jamfile @@ -93,6 +93,12 @@ rule linking ( properties * ) result += netkit gcc ; } + if haiku in $(properties) + { + result += libnetwork gcc ; + } + + if solaris in $(properties) { result += libsocket libnsl ; @@ -589,6 +595,7 @@ lib dl : : shared dl ; lib libsocket : : libnsl socket shared /usr/sfw/lib shared ; lib libnsl : : nsl shared /usr/sfw/lib shared ; +lib libnetwork : : network shared ; # socket libraries on windows lib wsock32 : : wsock32 shared ; diff --git a/examples/connection_tester.cpp b/examples/connection_tester.cpp index e72af46bd..3e7ef16f8 100644 --- a/examples/connection_tester.cpp +++ b/examples/connection_tester.cpp @@ -49,6 +49,7 @@ POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include #if BOOST_ASIO_DYN_LINK #if BOOST_VERSION >= 104500 @@ -104,17 +105,6 @@ std::atomic num_suggest(0); // the number of requests made from suggested pieces std::atomic num_suggested_requests(0); -void sleep_ms(int milliseconds) -{ -#if defined TORRENT_WINDOWS || defined TORRENT_CYGWIN - Sleep(milliseconds); -#elif defined TORRENT_BEOS - snooze_until(system_time() + std::int64_t(milliseconds) * 1000, B_SYSTEM_TIMEBASE); -#else - usleep(milliseconds * 1000); -#endif -} - std::string leaf_path(std::string f) { if (f.empty()) return ""; @@ -1096,7 +1086,7 @@ int main(int argc, char* argv[]) else if (test_mode == dual_test) seed = (i & 1); conns.push_back(new peer_conn(ios[i % num_threads], ti.num_pieces(), ti.piece_length() / 16 / 1024 , ep, (char const*)&ti.info_hash()[0], seed, churn, corrupt)); - sleep_ms(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); ios[i % num_threads].poll_one(ec); if (ec) { diff --git a/include/libtorrent/config.hpp b/include/libtorrent/config.hpp index 814ea7d66..f53e27146 100644 --- a/include/libtorrent/config.hpp +++ b/include/libtorrent/config.hpp @@ -307,6 +307,7 @@ POSSIBILITY OF SUCH DAMAGE. #ifndef TORRENT_USE_ICONV #define TORRENT_USE_ICONV 0 #endif +#define TORRENT_USE_MEMALIGN 1 // ==== GNU/Hurd === #elif defined __GNU__ diff --git a/src/allocator.cpp b/src/allocator.cpp index a4f5f1166..0db3d3bde 100644 --- a/src/allocator.cpp +++ b/src/allocator.cpp @@ -35,10 +35,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/assert.hpp" // for print_backtrace #include -#if defined TORRENT_BEOS -#include -#include // malloc/free -#elif !defined TORRENT_WINDOWS +#if !defined TORRENT_WINDOWS #include // posix_memalign/free #include // _SC_PAGESIZE #endif @@ -119,10 +116,6 @@ namespace libtorrent { ret = ::memalign(std::size_t(page_size()), std::size_t(bytes)); #elif defined TORRENT_WINDOWS ret = ::_aligned_malloc(std::size_t(bytes), std::size_t(page_size())); -#elif defined TORRENT_BEOS - area_id id = create_area("", &ret, B_ANY_ADDRESS - , (bytes + page_size() - 1) & (page_size() - 1), B_NO_LOCK, B_READ_AREA | B_WRITE_AREA); - if (id < B_OK) return nullptr; #else ret = valloc(std::size_t(bytes)); #endif @@ -188,10 +181,6 @@ namespace libtorrent { #ifdef TORRENT_WINDOWS _aligned_free(block); -#elif defined TORRENT_BEOS - area_id id = area_for(block); - if (id < B_OK) return; - delete_area(id); #else ::free(block); #endif // TORRENT_WINDOWS diff --git a/src/disk_io_thread.cpp b/src/disk_io_thread.cpp index 27d62fa05..fc7858392 100644 --- a/src/disk_io_thread.cpp +++ b/src/disk_io_thread.cpp @@ -1681,6 +1681,7 @@ constexpr disk_job_flags_t disk_interface::cache_hit; { TORRENT_ASSERT(r.length <= default_block_size); TORRENT_ASSERT(r.length <= 16 * 1024); + TORRENT_ASSERT(buf != nullptr); bool exceeded = false; disk_buffer_holder buffer(*this, m_disk_cache.allocate_buffer(exceeded, o, "receive buffer"), 0x4000); diff --git a/src/enum_net.cpp b/src/enum_net.cpp index 02d877a6c..0eb26fe61 100644 --- a/src/enum_net.cpp +++ b/src/enum_net.cpp @@ -790,7 +790,7 @@ int _System __libsocket_sysctl(int* mib, u_int namelen, void *oldp, size_t *oldl udp::resolver::iterator i = r.resolve(udp::resolver::query(boost::asio::ip::host_name(ec), "0"), ec); if (ec) return ret; ip_interface iface; - for (;i != udp::resolver_iterator(); ++i) + for (;i != udp::resolver::iterator(); ++i) { iface.interface_address = i->endpoint().address(); iface.name[0] = '\0'; @@ -815,6 +815,7 @@ int _System __libsocket_sysctl(int* mib, u_int namelen, void *oldp, size_t *oldl { std::vector ret; TORRENT_UNUSED(ios); + TORRENT_UNUSED(ec); #ifdef TORRENT_BUILD_SIMULATOR diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 9cb86f74a..3c59f9b28 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -6233,7 +6233,7 @@ namespace aux { template void set_tos(Socket& s, int v, error_code& ec) { -#if TORRENT_USE_IPV6 +#if TORRENT_USE_IPV6 && defined IPV6_TCLASS if (s.local_endpoint(ec).address().is_v6()) s.set_option(traffic_class(char(v)), ec); else if (!ec)