libtorrent-commits Mailing List for libtorrent
Brought to you by:
arvidn
You can subscribe to this list here.
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(76) |
Dec
(45) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2012 |
Jan
(129) |
Feb
(82) |
Mar
(99) |
Apr
(173) |
May
(138) |
Jun
(169) |
Jul
(161) |
Aug
(114) |
Sep
(109) |
Oct
(126) |
Nov
(105) |
Dec
(64) |
| 2013 |
Jan
(177) |
Feb
(115) |
Mar
(164) |
Apr
(106) |
May
(83) |
Jun
(139) |
Jul
(144) |
Aug
(165) |
Sep
(134) |
Oct
(227) |
Nov
(124) |
Dec
(127) |
| 2014 |
Jan
(159) |
Feb
(87) |
Mar
(115) |
Apr
(50) |
May
(71) |
Jun
(74) |
Jul
(113) |
Aug
(85) |
Sep
(91) |
Oct
(106) |
Nov
(118) |
Dec
(85) |
| 2015 |
Jan
(103) |
Feb
(52) |
Mar
(104) |
Apr
(107) |
May
(106) |
Jun
(13) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <ar...@us...> - 2015-06-03 05:18:52
|
Revision: 11152
http://sourceforge.net/p/libtorrent/code/11152
Author: arvidn
Date: 2015-06-03 05:18:48 +0000 (Wed, 03 Jun 2015)
Log Message:
-----------
update copyright year
Modified Paths:
--------------
trunk/COPYING
trunk/LICENSE
trunk/include/libtorrent/add_torrent_params.hpp
trunk/include/libtorrent/address.hpp
trunk/include/libtorrent/alert.hpp
trunk/include/libtorrent/alert_manager.hpp
trunk/include/libtorrent/alert_observer.hpp
trunk/include/libtorrent/alert_types.hpp
trunk/include/libtorrent/alloca.hpp
trunk/include/libtorrent/allocator.hpp
trunk/include/libtorrent/assert.hpp
trunk/include/libtorrent/bandwidth_limit.hpp
trunk/include/libtorrent/bandwidth_manager.hpp
trunk/include/libtorrent/bandwidth_queue_entry.hpp
trunk/include/libtorrent/bandwidth_socket.hpp
trunk/include/libtorrent/bencode.hpp
trunk/include/libtorrent/bitfield.hpp
trunk/include/libtorrent/block_cache.hpp
trunk/include/libtorrent/bloom_filter.hpp
trunk/include/libtorrent/broadcast_socket.hpp
trunk/include/libtorrent/bt_peer_connection.hpp
trunk/include/libtorrent/buffer.hpp
trunk/include/libtorrent/build_config.hpp
trunk/include/libtorrent/byteswap.hpp
trunk/include/libtorrent/chained_buffer.hpp
trunk/include/libtorrent/choker.hpp
trunk/include/libtorrent/config.hpp
trunk/include/libtorrent/copy_ptr.hpp
trunk/include/libtorrent/crc32c.hpp
trunk/include/libtorrent/create_torrent.hpp
trunk/include/libtorrent/deadline_timer.hpp
trunk/include/libtorrent/debug.hpp
trunk/include/libtorrent/disk_buffer_holder.hpp
trunk/include/libtorrent/disk_buffer_pool.hpp
trunk/include/libtorrent/disk_interface.hpp
trunk/include/libtorrent/disk_io_job.hpp
trunk/include/libtorrent/disk_io_thread.hpp
trunk/include/libtorrent/disk_job_pool.hpp
trunk/include/libtorrent/disk_observer.hpp
trunk/include/libtorrent/entry.hpp
trunk/include/libtorrent/enum_net.hpp
trunk/include/libtorrent/error.hpp
trunk/include/libtorrent/error_code.hpp
trunk/include/libtorrent/export.hpp
trunk/include/libtorrent/extensions/lt_trackers.hpp
trunk/include/libtorrent/extensions/metadata_transfer.hpp
trunk/include/libtorrent/extensions/smart_ban.hpp
trunk/include/libtorrent/extensions/ut_metadata.hpp
trunk/include/libtorrent/extensions.hpp
trunk/include/libtorrent/file.hpp
trunk/include/libtorrent/file_pool.hpp
trunk/include/libtorrent/file_storage.hpp
trunk/include/libtorrent/fingerprint.hpp
trunk/include/libtorrent/gzip.hpp
trunk/include/libtorrent/hasher.hpp
trunk/include/libtorrent/hex.hpp
trunk/include/libtorrent/http_connection.hpp
trunk/include/libtorrent/http_parser.hpp
trunk/include/libtorrent/http_seed_connection.hpp
trunk/include/libtorrent/http_stream.hpp
trunk/include/libtorrent/http_tracker_connection.hpp
trunk/include/libtorrent/i2p_stream.hpp
trunk/include/libtorrent/identify_client.hpp
trunk/include/libtorrent/instantiate_connection.hpp
trunk/include/libtorrent/io.hpp
trunk/include/libtorrent/io_service.hpp
trunk/include/libtorrent/io_service_fwd.hpp
trunk/include/libtorrent/ip_filter.hpp
trunk/include/libtorrent/ip_voter.hpp
trunk/include/libtorrent/kademlia/dht_observer.hpp
trunk/include/libtorrent/kademlia/dht_tracker.hpp
trunk/include/libtorrent/kademlia/dos_blocker.hpp
trunk/include/libtorrent/kademlia/find_data.hpp
trunk/include/libtorrent/kademlia/get_peers.hpp
trunk/include/libtorrent/kademlia/msg.hpp
trunk/include/libtorrent/kademlia/node.hpp
trunk/include/libtorrent/kademlia/node_entry.hpp
trunk/include/libtorrent/kademlia/node_id.hpp
trunk/include/libtorrent/kademlia/observer.hpp
trunk/include/libtorrent/kademlia/refresh.hpp
trunk/include/libtorrent/kademlia/routing_table.hpp
trunk/include/libtorrent/kademlia/rpc_manager.hpp
trunk/include/libtorrent/kademlia/traversal_algorithm.hpp
trunk/include/libtorrent/lazy_entry.hpp
trunk/include/libtorrent/link.hpp
trunk/include/libtorrent/linked_list.hpp
trunk/include/libtorrent/lsd.hpp
trunk/include/libtorrent/magnet_uri.hpp
trunk/include/libtorrent/max.hpp
trunk/include/libtorrent/natpmp.hpp
trunk/include/libtorrent/network_thread_pool.hpp
trunk/include/libtorrent/packet_buffer.hpp
trunk/include/libtorrent/parse_url.hpp
trunk/include/libtorrent/part_file.hpp
trunk/include/libtorrent/pe_crypto.hpp
trunk/include/libtorrent/peer.hpp
trunk/include/libtorrent/peer_class.hpp
trunk/include/libtorrent/peer_class_set.hpp
trunk/include/libtorrent/peer_class_type_filter.hpp
trunk/include/libtorrent/peer_connection.hpp
trunk/include/libtorrent/peer_connection_interface.hpp
trunk/include/libtorrent/peer_id.hpp
trunk/include/libtorrent/peer_info.hpp
trunk/include/libtorrent/peer_list.hpp
trunk/include/libtorrent/peer_request.hpp
trunk/include/libtorrent/performance_counters.hpp
trunk/include/libtorrent/piece_block_progress.hpp
trunk/include/libtorrent/piece_picker.hpp
trunk/include/libtorrent/proxy_base.hpp
trunk/include/libtorrent/random.hpp
trunk/include/libtorrent/receive_buffer.hpp
trunk/include/libtorrent/request_blocks.hpp
trunk/include/libtorrent/resolve_links.hpp
trunk/include/libtorrent/resolver.hpp
trunk/include/libtorrent/resolver_interface.hpp
trunk/include/libtorrent/rss.hpp
trunk/include/libtorrent/session.hpp
trunk/include/libtorrent/session_settings.hpp
trunk/include/libtorrent/session_status.hpp
trunk/include/libtorrent/settings_pack.hpp
trunk/include/libtorrent/sha1_hash.hpp
trunk/include/libtorrent/sliding_average.hpp
trunk/include/libtorrent/socket.hpp
trunk/include/libtorrent/socket_io.hpp
trunk/include/libtorrent/socket_type.hpp
trunk/include/libtorrent/socket_type_fwd.hpp
trunk/include/libtorrent/socks5_stream.hpp
trunk/include/libtorrent/ssl_stream.hpp
trunk/include/libtorrent/stat.hpp
trunk/include/libtorrent/stat_cache.hpp
trunk/include/libtorrent/storage.hpp
trunk/include/libtorrent/storage_defs.hpp
trunk/include/libtorrent/string_util.hpp
trunk/include/libtorrent/tailqueue.hpp
trunk/include/libtorrent/thread.hpp
trunk/include/libtorrent/thread_pool.hpp
trunk/include/libtorrent/time.hpp
trunk/include/libtorrent/timestamp_history.hpp
trunk/include/libtorrent/torrent.hpp
trunk/include/libtorrent/torrent_handle.hpp
trunk/include/libtorrent/torrent_info.hpp
trunk/include/libtorrent/torrent_peer.hpp
trunk/include/libtorrent/torrent_peer_allocator.hpp
trunk/include/libtorrent/tracker_manager.hpp
trunk/include/libtorrent/udp_socket.hpp
trunk/include/libtorrent/udp_tracker_connection.hpp
trunk/include/libtorrent/uncork_interface.hpp
trunk/include/libtorrent/union_endpoint.hpp
trunk/include/libtorrent/upnp.hpp
trunk/include/libtorrent/utf8.hpp
trunk/include/libtorrent/utp_socket_manager.hpp
trunk/include/libtorrent/utp_stream.hpp
trunk/include/libtorrent/vector_utils.hpp
trunk/include/libtorrent/version.hpp
trunk/include/libtorrent/web_connection_base.hpp
trunk/include/libtorrent/web_peer_connection.hpp
trunk/include/libtorrent/xml_parse.hpp
trunk/src/alert.cpp
trunk/src/alert_manager.cpp
trunk/src/allocator.cpp
trunk/src/assert.cpp
trunk/src/bandwidth_limit.cpp
trunk/src/bandwidth_manager.cpp
trunk/src/bandwidth_queue_entry.cpp
trunk/src/block_cache.cpp
trunk/src/bloom_filter.cpp
trunk/src/broadcast_socket.cpp
trunk/src/bt_peer_connection.cpp
trunk/src/chained_buffer.cpp
trunk/src/choker.cpp
trunk/src/crc32c.cpp
trunk/src/create_torrent.cpp
trunk/src/disk_buffer_holder.cpp
trunk/src/disk_buffer_pool.cpp
trunk/src/disk_io_job.cpp
trunk/src/disk_io_thread.cpp
trunk/src/disk_job_pool.cpp
trunk/src/entry.cpp
trunk/src/enum_net.cpp
trunk/src/error_code.cpp
trunk/src/escape_string.cpp
trunk/src/file.cpp
trunk/src/file_pool.cpp
trunk/src/file_storage.cpp
trunk/src/gzip.cpp
trunk/src/hasher.cpp
trunk/src/http_connection.cpp
trunk/src/http_parser.cpp
trunk/src/http_seed_connection.cpp
trunk/src/http_stream.cpp
trunk/src/http_tracker_connection.cpp
trunk/src/i2p_stream.cpp
trunk/src/identify_client.cpp
trunk/src/instantiate_connection.cpp
trunk/src/ip_filter.cpp
trunk/src/ip_voter.cpp
trunk/src/kademlia/dht_tracker.cpp
trunk/src/kademlia/dos_blocker.cpp
trunk/src/kademlia/find_data.cpp
trunk/src/kademlia/get_peers.cpp
trunk/src/kademlia/node.cpp
trunk/src/kademlia/node_entry.cpp
trunk/src/kademlia/node_id.cpp
trunk/src/kademlia/refresh.cpp
trunk/src/kademlia/routing_table.cpp
trunk/src/kademlia/rpc_manager.cpp
trunk/src/kademlia/traversal_algorithm.cpp
trunk/src/lazy_bdecode.cpp
trunk/src/lsd.cpp
trunk/src/lt_trackers.cpp
trunk/src/magnet_uri.cpp
trunk/src/merkle.cpp
trunk/src/metadata_transfer.cpp
trunk/src/natpmp.cpp
trunk/src/packet_buffer.cpp
trunk/src/parse_url.cpp
trunk/src/part_file.cpp
trunk/src/pe_crypto.cpp
trunk/src/peer_class.cpp
trunk/src/peer_class_set.cpp
trunk/src/peer_connection.cpp
trunk/src/peer_list.cpp
trunk/src/performance_counters.cpp
trunk/src/piece_picker.cpp
trunk/src/platform_util.cpp
trunk/src/proxy_base.cpp
trunk/src/random.cpp
trunk/src/receive_buffer.cpp
trunk/src/request_blocks.cpp
trunk/src/resolve_links.cpp
trunk/src/resolver.cpp
trunk/src/rss.cpp
trunk/src/session.cpp
trunk/src/session_call.cpp
trunk/src/session_impl.cpp
trunk/src/session_stats.cpp
trunk/src/settings_pack.cpp
trunk/src/smart_ban.cpp
trunk/src/socket_io.cpp
trunk/src/socket_type.cpp
trunk/src/socks5_stream.cpp
trunk/src/stat.cpp
trunk/src/stat_cache.cpp
trunk/src/storage.cpp
trunk/src/string_util.cpp
trunk/src/tailqueue.cpp
trunk/src/thread.cpp
trunk/src/time.cpp
trunk/src/timestamp_history.cpp
trunk/src/torrent.cpp
trunk/src/torrent_handle.cpp
trunk/src/torrent_info.cpp
trunk/src/torrent_peer.cpp
trunk/src/torrent_peer_allocator.cpp
trunk/src/tracker_manager.cpp
trunk/src/udp_socket.cpp
trunk/src/udp_tracker_connection.cpp
trunk/src/upnp.cpp
trunk/src/ut_metadata.cpp
trunk/src/ut_pex.cpp
trunk/src/utf8.cpp
trunk/src/utp_socket_manager.cpp
trunk/src/utp_stream.cpp
trunk/src/web_connection_base.cpp
trunk/src/web_peer_connection.cpp
trunk/src/xml_parse.cpp
Modified: trunk/COPYING
===================================================================
--- trunk/COPYING 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/COPYING 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,4 +1,4 @@
-Copyright (c) 2003-2014, Arvid Norberg
+Copyright (c) 2003-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/LICENSE
===================================================================
--- trunk/LICENSE 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/LICENSE 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,4 +1,4 @@
-Copyright (c) 2003-2014, Arvid Norberg
+Copyright (c) 2003-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/add_torrent_params.hpp
===================================================================
--- trunk/include/libtorrent/add_torrent_params.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/add_torrent_params.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2009-2014, Arvid Norberg
+Copyright (c) 2009-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/address.hpp
===================================================================
--- trunk/include/libtorrent/address.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/address.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2009-2014, Arvid Norberg
+Copyright (c) 2009-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/alert.hpp
===================================================================
--- trunk/include/libtorrent/alert.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/alert.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2003-2014, Arvid Norberg, Daniel Wallin
+Copyright (c) 2003-2015, Arvid Norberg, Daniel Wallin
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/alert_manager.hpp
===================================================================
--- trunk/include/libtorrent/alert_manager.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/alert_manager.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2003-2014, Arvid Norberg, Daniel Wallin
+Copyright (c) 2003-2015, Arvid Norberg, Daniel Wallin
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/alert_observer.hpp
===================================================================
--- trunk/include/libtorrent/alert_observer.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/alert_observer.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2012-2013, Arvid Norberg
+Copyright (c) 2012-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/alert_types.hpp
===================================================================
--- trunk/include/libtorrent/alert_types.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/alert_types.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2003-2014, Arvid Norberg
+Copyright (c) 2003-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/alloca.hpp
===================================================================
--- trunk/include/libtorrent/alloca.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/alloca.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2008-2014, Arvid Norberg
+Copyright (c) 2008-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/allocator.hpp
===================================================================
--- trunk/include/libtorrent/allocator.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/allocator.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2009-2014, Arvid Norberg
+Copyright (c) 2009-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/assert.hpp
===================================================================
--- trunk/include/libtorrent/assert.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/assert.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2007-2014, Arvid Norberg
+Copyright (c) 2007-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/bandwidth_limit.hpp
===================================================================
--- trunk/include/libtorrent/bandwidth_limit.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/bandwidth_limit.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2007-2014, Arvid Norberg
+Copyright (c) 2007-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/bandwidth_manager.hpp
===================================================================
--- trunk/include/libtorrent/bandwidth_manager.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/bandwidth_manager.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2007-2014, Arvid Norberg
+Copyright (c) 2007-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/bandwidth_queue_entry.hpp
===================================================================
--- trunk/include/libtorrent/bandwidth_queue_entry.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/bandwidth_queue_entry.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2007-2014, Arvid Norberg
+Copyright (c) 2007-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/bandwidth_socket.hpp
===================================================================
--- trunk/include/libtorrent/bandwidth_socket.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/bandwidth_socket.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2009-2014, Arvid Norberg
+Copyright (c) 2009-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/bencode.hpp
===================================================================
--- trunk/include/libtorrent/bencode.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/bencode.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2003-2014, Arvid Norberg
+Copyright (c) 2003-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/bitfield.hpp
===================================================================
--- trunk/include/libtorrent/bitfield.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/bitfield.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2008-2014, Arvid Norberg
+Copyright (c) 2008-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/block_cache.hpp
===================================================================
--- trunk/include/libtorrent/block_cache.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/block_cache.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2010-2013, Arvid Norberg
+Copyright (c) 2010-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/bloom_filter.hpp
===================================================================
--- trunk/include/libtorrent/bloom_filter.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/bloom_filter.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2010-2014, Arvid Norberg
+Copyright (c) 2010-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/broadcast_socket.hpp
===================================================================
--- trunk/include/libtorrent/broadcast_socket.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/broadcast_socket.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2007-2014, Arvid Norberg
+Copyright (c) 2007-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/bt_peer_connection.hpp
===================================================================
--- trunk/include/libtorrent/bt_peer_connection.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/bt_peer_connection.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,7 +1,7 @@
/*
-Copyright (c) 2003-2014, Arvid Norberg
-Copyright (c) 2007-2014, Arvid Norberg, Un Shyam
+Copyright (c) 2003-2015, Arvid Norberg
+Copyright (c) 2007-2015, Arvid Norberg, Un Shyam
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/buffer.hpp
===================================================================
--- trunk/include/libtorrent/buffer.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/buffer.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2007-2014, Arvid Norberg
+Copyright (c) 2007-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/build_config.hpp
===================================================================
--- trunk/include/libtorrent/build_config.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/build_config.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2010-2014, Arvid Norberg
+Copyright (c) 2010-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/byteswap.hpp
===================================================================
--- trunk/include/libtorrent/byteswap.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/byteswap.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2013, Arvid Norberg
+Copyright (c) 2013-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/chained_buffer.hpp
===================================================================
--- trunk/include/libtorrent/chained_buffer.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/chained_buffer.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2007-2014, Arvid Norberg
+Copyright (c) 2007-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/choker.hpp
===================================================================
--- trunk/include/libtorrent/choker.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/choker.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2014, Arvid Norberg
+Copyright (c) 2014-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/config.hpp
===================================================================
--- trunk/include/libtorrent/config.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/config.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2005-2014, Arvid Norberg
+Copyright (c) 2005-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/copy_ptr.hpp
===================================================================
--- trunk/include/libtorrent/copy_ptr.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/copy_ptr.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2010-2014, Arvid Norberg
+Copyright (c) 2010-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/crc32c.hpp
===================================================================
--- trunk/include/libtorrent/crc32c.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/crc32c.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2014, Arvid Norberg
+Copyright (c) 2014-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/create_torrent.hpp
===================================================================
--- trunk/include/libtorrent/create_torrent.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/create_torrent.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2008-2014, Arvid Norberg
+Copyright (c) 2008-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/deadline_timer.hpp
===================================================================
--- trunk/include/libtorrent/deadline_timer.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/deadline_timer.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2009-2014, Arvid Norberg
+Copyright (c) 2009-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/debug.hpp
===================================================================
--- trunk/include/libtorrent/debug.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/debug.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2003-2014, Arvid Norberg
+Copyright (c) 2003-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/disk_buffer_holder.hpp
===================================================================
--- trunk/include/libtorrent/disk_buffer_holder.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/disk_buffer_holder.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2008-2014, Arvid Norberg
+Copyright (c) 2008-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/disk_buffer_pool.hpp
===================================================================
--- trunk/include/libtorrent/disk_buffer_pool.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/disk_buffer_pool.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2007-2014, Arvid Norberg
+Copyright (c) 2007-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/disk_interface.hpp
===================================================================
--- trunk/include/libtorrent/disk_interface.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/disk_interface.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2012-2013, Arvid Norberg
+Copyright (c) 2012-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/disk_io_job.hpp
===================================================================
--- trunk/include/libtorrent/disk_io_job.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/disk_io_job.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2010-2013, Arvid Norberg
+Copyright (c) 2010-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/disk_io_thread.hpp
===================================================================
--- trunk/include/libtorrent/disk_io_thread.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/disk_io_thread.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2007-2014, Arvid Norberg
+Copyright (c) 2007-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/disk_job_pool.hpp
===================================================================
--- trunk/include/libtorrent/disk_job_pool.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/disk_job_pool.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2010-2013, Arvid Norberg
+Copyright (c) 2010-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/disk_observer.hpp
===================================================================
--- trunk/include/libtorrent/disk_observer.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/disk_observer.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2012-2013, Arvid Norberg
+Copyright (c) 2012-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/entry.hpp
===================================================================
--- trunk/include/libtorrent/entry.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/entry.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2003-2014, Arvid Norberg
+Copyright (c) 2003-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/enum_net.hpp
===================================================================
--- trunk/include/libtorrent/enum_net.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/enum_net.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2007-2014, Arvid Norberg
+Copyright (c) 2007-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/error.hpp
===================================================================
--- trunk/include/libtorrent/error.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/error.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2009-2014, Arvid Norberg
+Copyright (c) 2009-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/error_code.hpp
===================================================================
--- trunk/include/libtorrent/error_code.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/error_code.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2008-2014, Arvid Norberg
+Copyright (c) 2008-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/export.hpp
===================================================================
--- trunk/include/libtorrent/export.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/export.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2005-2014, Arvid Norberg
+Copyright (c) 2005-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/extensions/lt_trackers.hpp
===================================================================
--- trunk/include/libtorrent/extensions/lt_trackers.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/extensions/lt_trackers.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2008, Arvid Norberg
+Copyright (c) 2008-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/extensions/metadata_transfer.hpp
===================================================================
--- trunk/include/libtorrent/extensions/metadata_transfer.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/extensions/metadata_transfer.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2006, Arvid Norberg
+Copyright (c) 2006-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/extensions/smart_ban.hpp
===================================================================
--- trunk/include/libtorrent/extensions/smart_ban.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/extensions/smart_ban.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2007, Arvid Norberg
+Copyright (c) 2007-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/extensions/ut_metadata.hpp
===================================================================
--- trunk/include/libtorrent/extensions/ut_metadata.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/extensions/ut_metadata.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2007, Arvid Norberg
+Copyright (c) 2007-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/extensions.hpp
===================================================================
--- trunk/include/libtorrent/extensions.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/extensions.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2006-2014, Arvid Norberg
+Copyright (c) 2006-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/file.hpp
===================================================================
--- trunk/include/libtorrent/file.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/file.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2003-2014, Arvid Norberg
+Copyright (c) 2003-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/file_pool.hpp
===================================================================
--- trunk/include/libtorrent/file_pool.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/file_pool.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2006-2014, Arvid Norberg
+Copyright (c) 2006-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/file_storage.hpp
===================================================================
--- trunk/include/libtorrent/file_storage.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/file_storage.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2003-2014, Arvid Norberg
+Copyright (c) 2003-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/fingerprint.hpp
===================================================================
--- trunk/include/libtorrent/fingerprint.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/fingerprint.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2003-2014, Arvid Norberg
+Copyright (c) 2003-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/gzip.hpp
===================================================================
--- trunk/include/libtorrent/gzip.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/gzip.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2007-2014, Arvid Norberg
+Copyright (c) 2007-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/hasher.hpp
===================================================================
--- trunk/include/libtorrent/hasher.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/hasher.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2003-2014, Arvid Norberg
+Copyright (c) 2003-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/hex.hpp
===================================================================
--- trunk/include/libtorrent/hex.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/hex.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2003-2014, Arvid Norberg
+Copyright (c) 2003-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/http_connection.hpp
===================================================================
--- trunk/include/libtorrent/http_connection.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/http_connection.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2007-2014, Arvid Norberg
+Copyright (c) 2007-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/http_parser.hpp
===================================================================
--- trunk/include/libtorrent/http_parser.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/http_parser.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2008-2014, Arvid Norberg
+Copyright (c) 2008-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/http_seed_connection.hpp
===================================================================
--- trunk/include/libtorrent/http_seed_connection.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/http_seed_connection.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2008-2014, Arvid Norberg
+Copyright (c) 2008-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/http_stream.hpp
===================================================================
--- trunk/include/libtorrent/http_stream.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/http_stream.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2007-2014, Arvid Norberg
+Copyright (c) 2007-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/http_tracker_connection.hpp
===================================================================
--- trunk/include/libtorrent/http_tracker_connection.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/http_tracker_connection.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2003-2014, Arvid Norberg
+Copyright (c) 2003-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/i2p_stream.hpp
===================================================================
--- trunk/include/libtorrent/i2p_stream.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/i2p_stream.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2009-2014, Arvid Norberg
+Copyright (c) 2009-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/identify_client.hpp
===================================================================
--- trunk/include/libtorrent/identify_client.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/identify_client.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2003-2014, Arvid Norberg
+Copyright (c) 2003-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/instantiate_connection.hpp
===================================================================
--- trunk/include/libtorrent/instantiate_connection.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/instantiate_connection.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2007-2014, Arvid Norberg
+Copyright (c) 2007-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/io.hpp
===================================================================
--- trunk/include/libtorrent/io.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/io.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2003-2014, Arvid Norberg
+Copyright (c) 2003-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/io_service.hpp
===================================================================
--- trunk/include/libtorrent/io_service.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/io_service.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2009-2014, Arvid Norberg
+Copyright (c) 2009-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/io_service_fwd.hpp
===================================================================
--- trunk/include/libtorrent/io_service_fwd.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/io_service_fwd.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2009-2014, Arvid Norberg
+Copyright (c) 2009-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/ip_filter.hpp
===================================================================
--- trunk/include/libtorrent/ip_filter.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/ip_filter.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2005-2014, Arvid Norberg
+Copyright (c) 2005-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/ip_voter.hpp
===================================================================
--- trunk/include/libtorrent/ip_voter.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/ip_voter.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2013-2014, Arvid Norberg
+Copyright (c) 2013-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/kademlia/dht_observer.hpp
===================================================================
--- trunk/include/libtorrent/kademlia/dht_observer.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/kademlia/dht_observer.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2012-2014, Arvid Norberg
+Copyright (c) 2012-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/kademlia/dht_tracker.hpp
===================================================================
--- trunk/include/libtorrent/kademlia/dht_tracker.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/kademlia/dht_tracker.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2006-2014, Arvid Norberg
+Copyright (c) 2006-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/kademlia/dos_blocker.hpp
===================================================================
--- trunk/include/libtorrent/kademlia/dos_blocker.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/kademlia/dos_blocker.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2006-2013, Arvid Norberg
+Copyright (c) 2006-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/kademlia/find_data.hpp
===================================================================
--- trunk/include/libtorrent/kademlia/find_data.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/kademlia/find_data.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2006-2014, Arvid Norberg & Daniel Wallin
+Copyright (c) 2006-2015, Arvid Norberg & Daniel Wallin
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/kademlia/get_peers.hpp
===================================================================
--- trunk/include/libtorrent/kademlia/get_peers.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/kademlia/get_peers.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2006-2014, Arvid Norberg & Daniel Wallin
+Copyright (c) 2006-2015, Arvid Norberg & Daniel Wallin
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/kademlia/msg.hpp
===================================================================
--- trunk/include/libtorrent/kademlia/msg.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/kademlia/msg.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2007-2014, Arvid Norberg
+Copyright (c) 2007-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/kademlia/node.hpp
===================================================================
--- trunk/include/libtorrent/kademlia/node.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/kademlia/node.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2006-2014, Arvid Norberg
+Copyright (c) 2006-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/kademlia/node_entry.hpp
===================================================================
--- trunk/include/libtorrent/kademlia/node_entry.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/kademlia/node_entry.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2006-2014, Arvid Norberg
+Copyright (c) 2006-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/kademlia/node_id.hpp
===================================================================
--- trunk/include/libtorrent/kademlia/node_id.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/kademlia/node_id.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2006-2014, Arvid Norberg
+Copyright (c) 2006-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/kademlia/observer.hpp
===================================================================
--- trunk/include/libtorrent/kademlia/observer.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/kademlia/observer.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2007-2014, Arvid Norberg
+Copyright (c) 2007-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/kademlia/refresh.hpp
===================================================================
--- trunk/include/libtorrent/kademlia/refresh.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/kademlia/refresh.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2006-2014, Arvid Norberg & Daniel Wallin
+Copyright (c) 2006-2015, Arvid Norberg & Daniel Wallin
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/kademlia/routing_table.hpp
===================================================================
--- trunk/include/libtorrent/kademlia/routing_table.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/kademlia/routing_table.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2006-2014, Arvid Norberg
+Copyright (c) 2006-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/kademlia/rpc_manager.hpp
===================================================================
--- trunk/include/libtorrent/kademlia/rpc_manager.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/kademlia/rpc_manager.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2006-2014, Arvid Norberg
+Copyright (c) 2006-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/kademlia/traversal_algorithm.hpp
===================================================================
--- trunk/include/libtorrent/kademlia/traversal_algorithm.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/kademlia/traversal_algorithm.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2006-2014, Arvid Norberg & Daniel Wallin
+Copyright (c) 2006-2015, Arvid Norberg & Daniel Wallin
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/lazy_entry.hpp
===================================================================
--- trunk/include/libtorrent/lazy_entry.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/lazy_entry.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2003-2014, Arvid Norberg
+Copyright (c) 2003-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/link.hpp
===================================================================
--- trunk/include/libtorrent/link.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/link.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2011-2013, Arvid Norberg
+Copyright (c) 2011-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/linked_list.hpp
===================================================================
--- trunk/include/libtorrent/linked_list.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/linked_list.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2012-2013, Arvid Norberg
+Copyright (c) 2012-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/lsd.hpp
===================================================================
--- trunk/include/libtorrent/lsd.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/lsd.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2007-2014, Arvid Norberg
+Copyright (c) 2007-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/magnet_uri.hpp
===================================================================
--- trunk/include/libtorrent/magnet_uri.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/magnet_uri.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2007-2014, Arvid Norberg
+Copyright (c) 2007-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/max.hpp
===================================================================
--- trunk/include/libtorrent/max.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/max.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2009-2014, Arvid Norberg
+Copyright (c) 2009-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/natpmp.hpp
===================================================================
--- trunk/include/libtorrent/natpmp.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/natpmp.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2007-2014, Arvid Norberg
+Copyright (c) 2007-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/network_thread_pool.hpp
===================================================================
--- trunk/include/libtorrent/network_thread_pool.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/network_thread_pool.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2011-2013, Arvid Norberg
+Copyright (c) 2011-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/packet_buffer.hpp
===================================================================
--- trunk/include/libtorrent/packet_buffer.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/packet_buffer.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2010-2014, Arvid Norberg, Daniel Wallin.
+Copyright (c) 2010-2015, Arvid Norberg, Daniel Wallin.
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/parse_url.hpp
===================================================================
--- trunk/include/libtorrent/parse_url.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/parse_url.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2008-2014, Arvid Norberg
+Copyright (c) 2008-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/part_file.hpp
===================================================================
--- trunk/include/libtorrent/part_file.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/part_file.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2012-2013, Arvid Norberg
+Copyright (c) 2012-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/pe_crypto.hpp
===================================================================
--- trunk/include/libtorrent/pe_crypto.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/pe_crypto.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2007-2014, Un Shyam & Arvid Norberg
+Copyright (c) 2007-2015, Un Shyam & Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/peer.hpp
===================================================================
--- trunk/include/libtorrent/peer.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/peer.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2003-2014, Arvid Norberg
+Copyright (c) 2003-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/peer_class.hpp
===================================================================
--- trunk/include/libtorrent/peer_class.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/peer_class.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2011-2013, Arvid Norberg
+Copyright (c) 2011-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/peer_class_set.hpp
===================================================================
--- trunk/include/libtorrent/peer_class_set.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/peer_class_set.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2011-2013, Arvid Norberg
+Copyright (c) 2011-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/peer_class_type_filter.hpp
===================================================================
--- trunk/include/libtorrent/peer_class_type_filter.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/peer_class_type_filter.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2012-2013, Arvid Norberg
+Copyright (c) 2012-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/peer_connection.hpp
===================================================================
--- trunk/include/libtorrent/peer_connection.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/peer_connection.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2003-2014, Arvid Norberg
+Copyright (c) 2003-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/peer_connection_interface.hpp
===================================================================
--- trunk/include/libtorrent/peer_connection_interface.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/peer_connection_interface.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2013, Arvid Norberg
+Copyright (c) 2013-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/peer_id.hpp
===================================================================
--- trunk/include/libtorrent/peer_id.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/peer_id.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2003-2014, Arvid Norberg
+Copyright (c) 2003-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/peer_info.hpp
===================================================================
--- trunk/include/libtorrent/peer_info.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/peer_info.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2003-2014, Arvid Norberg
+Copyright (c) 2003-2015, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/include/libtorrent/peer_list.hpp
===================================================================
--- trunk/include/libtorrent/peer_list.hpp 2015-06-03 05:12:54 UTC (rev 11151)
+++ trunk/include/libtorrent/peer_list.hpp 2015-06-03 05:18:48 UTC (rev 11152)
@@ -1,6 +1,6 @@
/*
-Copyright (c) 2003...
[truncated message content] |
|
From: <ar...@us...> - 2015-06-03 05:12:57
|
Revision: 11151
http://sourceforge.net/p/libtorrent/code/11151
Author: arvidn
Date: 2015-06-03 05:12:54 +0000 (Wed, 03 Jun 2015)
Log Message:
-----------
merged changes from RC_1_0
Modified Paths:
--------------
trunk/include/libtorrent/bencode.hpp
trunk/src/entry.cpp
Property Changed:
----------------
trunk/
Index: trunk
===================================================================
--- trunk 2015-06-03 05:01:16 UTC (rev 11150)
+++ trunk 2015-06-03 05:12:54 UTC (rev 11151)
Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
## -1,5 +1,5 ##
/branches/RC_0_16:6640,6657,6662,6665,6669,6673-6675,6678,6684,6686,6688,6690,6692,6694-6695,6698,6700,6715,6936,6938,6946,6951,6956,6971,6974,6976,6979,7166,7200,7206,7258,7311,7314,7323,7333,7339,7348,7358,7371,7373,7375,7379,7395,7422,7433,7458,7461,7464,7466,7469,7471,7473,7480,7482,7487,7489,7492-7493,7497,7500,7507,7511,7514,7529,7536,7542,7546,7548-7549,7551,7553,7555,7560-7561,7564,7572,7577,7579,7587,7593-7594,7598-7599,7609,7611,7623-7624,7627,7633,7642,7644,7651,7667,7671,7675,7677,7681,7683,7685,7694,7699,7701,7704-7706,7711,7719,7729,7739,7752,7758,7760,7762,7765,7767,7771,7773,7784,7786,7788,7809,7814,7826,7828,7834,7838,7840,7847,7851,7853,7863-7864,7868,7870,7875,7884,7886,7890,7902,7905-7906,7909,7912,7914-7915,7925,7928,7930,7932,7934,7941,7947,7951,7955,7962,7964,7966,7971,7973,7984,7986,7988,7999,8002-8003,8005,8010,8012,8015,8017,8019,8021,8025,8041,8050,8066,8080,8082,8087,8091,8111,8130,8144,8171,8216,8221,8229,8235,8251,8288,8303,8331,8333,8340,8342,8345,8348,8357,8359-8361,8363,8371,8375,8382,8391,8393,8397,8399-8401,8416,8423,8426,8429,8431,8433,8436,8439,8445,8448,8452,8460,8462,8464,8466,8536,8564,8577,8580,8584,8587,8591,8605-8606,8612,8615,8619,8682,8693-8694,8696,8698,8700,8702,8704,8730,8732-8734,8760,8776-8777,8786,8797,8800,8815,8824,8826,8869,8884,8887,8917,8921-8922,8934,8936,8938,8943,8966,8971,8981-8982,8992,8994,8997,9000,9032-9033,9037,9046,9122,9127,9132,9154,9197,9204,9224,9232,9235,9237,9240,9253-9254,9260,9266-9267,9273,9285,9291,9294-9295,9297,9300,9333,9341,9343,9345,9347,9377,9408,9410,9414,9453,9480,9482,9487,9514,9520,9526,9530,9540,9543,9584,9616,9620,9627,9635,9652,9654,9661,9664,9684,9686,9691,9710,9716,9722,9729,9731,9738,9744,9752,9762,9766-9767,9772,9776,9779,9799,9805,9822,9826,9870,9872,9882,9889,9892,9894,9897,9947,9955,9994,10012,10017,10025,10134,10186,10189,10192,10195,10210,10214,10220,10223,10261,10289,10325,10338,10341,10344,10348,10391,10467,10576,10625,10629,10641
-/branches/RC_1_0:10069-11143
+/branches/RC_1_0:10069-11150
/branches/alert_queue:10881-10930
/branches/bdecoder:10825-10866
/branches/libtorrent_aio:4468-10083
\ No newline at end of property
Modified: trunk/include/libtorrent/bencode.hpp
===================================================================
--- trunk/include/libtorrent/bencode.hpp 2015-06-03 05:01:16 UTC (rev 11150)
+++ trunk/include/libtorrent/bencode.hpp 2015-06-03 05:12:54 UTC (rev 11151)
@@ -241,11 +241,11 @@
// integer
case 'i':
{
- ++in; // 'i'
+ ++in; // 'i'
std::string val = read_until(in, end, 'e', err);
if (err) return;
TORRENT_ASSERT(*in == 'e');
- ++in; // 'e'
+ ++in; // 'e'
ret = entry(entry::int_t);
char* end_pointer;
ret.integer() = strtoll(val.c_str(), &end_pointer, 10);
@@ -304,7 +304,7 @@
entry key;
bdecode_recursive(in, end, key, err, depth + 1);
if (err || key.type() != entry::string_t)
- {
+ {
#ifdef TORRENT_DEBUG
ret.m_type_queried = false;
#endif
@@ -375,7 +375,7 @@
}
}
}
-
+
// These functions will encode data to bencoded or decode bencoded data.
//
// If possible, ``bdecode()`` producing a bdecode_node should be preferred
Modified: trunk/src/entry.cpp
===================================================================
--- trunk/src/entry.cpp 2015-06-03 05:01:16 UTC (rev 11150)
+++ trunk/src/entry.cpp 2015-06-03 05:12:54 UTC (rev 11151)
@@ -116,7 +116,7 @@
if (i == dict().end()) return 0;
return &i->second;
}
-
+
entry* entry::find_key(std::string const& key)
{
dictionary_type::iterator i = dict().find(key);
@@ -130,7 +130,7 @@
if (i == dict().end()) return 0;
return &i->second;
}
-
+
#ifndef BOOST_NO_EXCEPTIONS
const entry& entry::operator[](char const* key) const
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ar...@us...> - 2015-06-03 05:01:19
|
Revision: 11150
http://sourceforge.net/p/libtorrent/code/11150
Author: arvidn
Date: 2015-06-03 05:01:16 +0000 (Wed, 03 Jun 2015)
Log Message:
-----------
merged changes from trunk
Modified Paths:
--------------
branches/multi_threading/ChangeLog
branches/multi_threading/bindings/python/src/session.cpp
branches/multi_threading/bindings/python/src/session_settings.cpp
branches/multi_threading/configure.ac
branches/multi_threading/examples/client_test.cpp
branches/multi_threading/include/libtorrent/alert_types.hpp
branches/multi_threading/include/libtorrent/aux_/cpuid.hpp
branches/multi_threading/include/libtorrent/aux_/session_call.hpp
branches/multi_threading/include/libtorrent/aux_/session_impl.hpp
branches/multi_threading/include/libtorrent/aux_/session_interface.hpp
branches/multi_threading/include/libtorrent/create_torrent.hpp
branches/multi_threading/include/libtorrent/disk_io_job.hpp
branches/multi_threading/include/libtorrent/disk_io_thread.hpp
branches/multi_threading/include/libtorrent/enum_net.hpp
branches/multi_threading/include/libtorrent/extensions.hpp
branches/multi_threading/include/libtorrent/identify_client.hpp
branches/multi_threading/include/libtorrent/io_service.hpp
branches/multi_threading/include/libtorrent/kademlia/dht_observer.hpp
branches/multi_threading/include/libtorrent/kademlia/node.hpp
branches/multi_threading/include/libtorrent/session.hpp
branches/multi_threading/include/libtorrent/session_settings.hpp
branches/multi_threading/include/libtorrent/settings_pack.hpp
branches/multi_threading/include/libtorrent/stack_allocator.hpp
branches/multi_threading/include/libtorrent/udp_socket.hpp
branches/multi_threading/src/alert.cpp
branches/multi_threading/src/asio.cpp
branches/multi_threading/src/assert.cpp
branches/multi_threading/src/bdecode.cpp
branches/multi_threading/src/disk_io_thread.cpp
branches/multi_threading/src/kademlia/dht_tracker.cpp
branches/multi_threading/src/kademlia/get_item.cpp
branches/multi_threading/src/lazy_bdecode.cpp
branches/multi_threading/src/rss.cpp
branches/multi_threading/src/session.cpp
branches/multi_threading/src/session_call.cpp
branches/multi_threading/src/session_impl.cpp
branches/multi_threading/src/settings_pack.cpp
branches/multi_threading/src/torrent.cpp
branches/multi_threading/src/torrent_handle.cpp
branches/multi_threading/src/udp_socket.cpp
branches/multi_threading/test/Jamfile
branches/multi_threading/test/Makefile.am
branches/multi_threading/test/dht_server.cpp
branches/multi_threading/test/enum_if.cpp
branches/multi_threading/test/main.cpp
branches/multi_threading/test/peer_server.cpp
branches/multi_threading/test/setup_transfer.cpp
branches/multi_threading/test/socks.py
branches/multi_threading/test/test.hpp
branches/multi_threading/test/test_alert_manager.cpp
branches/multi_threading/test/test_auto_unchoke.cpp
branches/multi_threading/test/test_bandwidth_limiter.cpp
branches/multi_threading/test/test_bdecode.cpp
branches/multi_threading/test/test_bencoding.cpp
branches/multi_threading/test/test_bitfield.cpp
branches/multi_threading/test/test_block_cache.cpp
branches/multi_threading/test/test_bloom_filter.cpp
branches/multi_threading/test/test_buffer.cpp
branches/multi_threading/test/test_checking.cpp
branches/multi_threading/test/test_crc32.cpp
branches/multi_threading/test/test_dht.cpp
branches/multi_threading/test/test_dos_blocker.cpp
branches/multi_threading/test/test_fast_extension.cpp
branches/multi_threading/test/test_fence.cpp
branches/multi_threading/test/test_file.cpp
branches/multi_threading/test/test_file_storage.cpp
branches/multi_threading/test/test_gzip.cpp
branches/multi_threading/test/test_hasher.cpp
branches/multi_threading/test/test_heterogeneous_queue.cpp
branches/multi_threading/test/test_http_connection.cpp
branches/multi_threading/test/test_http_parser.cpp
branches/multi_threading/test/test_identify_client.cpp
branches/multi_threading/test/test_ip_filter.cpp
branches/multi_threading/test/test_ip_voter.cpp
branches/multi_threading/test/test_lsd.cpp
branches/multi_threading/test/test_magnet.cpp
branches/multi_threading/test/test_merkle.cpp
branches/multi_threading/test/test_metadata_extension.cpp
branches/multi_threading/test/test_packet_buffer.cpp
branches/multi_threading/test/test_part_file.cpp
branches/multi_threading/test/test_pe_crypto.cpp
branches/multi_threading/test/test_peer_classes.cpp
branches/multi_threading/test/test_peer_list.cpp
branches/multi_threading/test/test_peer_priority.cpp
branches/multi_threading/test/test_pex.cpp
branches/multi_threading/test/test_piece_picker.cpp
branches/multi_threading/test/test_primitives.cpp
branches/multi_threading/test/test_priority.cpp
branches/multi_threading/test/test_privacy.cpp
branches/multi_threading/test/test_random.cpp
branches/multi_threading/test/test_read_piece.cpp
branches/multi_threading/test/test_recheck.cpp
branches/multi_threading/test/test_remap_files.cpp
branches/multi_threading/test/test_resolve_links.cpp
branches/multi_threading/test/test_resume.cpp
branches/multi_threading/test/test_session.cpp
branches/multi_threading/test/test_settings_pack.cpp
branches/multi_threading/test/test_sha1_hash.cpp
branches/multi_threading/test/test_sliding_average.cpp
branches/multi_threading/test/test_socket_io.cpp
branches/multi_threading/test/test_ssl.cpp
branches/multi_threading/test/test_stat_cache.cpp
branches/multi_threading/test/test_storage.cpp
branches/multi_threading/test/test_string.cpp
branches/multi_threading/test/test_super_seeding.cpp
branches/multi_threading/test/test_swarm.cpp
branches/multi_threading/test/test_tailqueue.cpp
branches/multi_threading/test/test_threads.cpp
branches/multi_threading/test/test_time.cpp
branches/multi_threading/test/test_time_critical.cpp
branches/multi_threading/test/test_timestamp_history.cpp
branches/multi_threading/test/test_torrent.cpp
branches/multi_threading/test/test_torrent_info.cpp
branches/multi_threading/test/test_tracker.cpp
branches/multi_threading/test/test_trackers_extension.cpp
branches/multi_threading/test/test_transfer.cpp
branches/multi_threading/test/test_upnp.cpp
branches/multi_threading/test/test_url_seed.cpp
branches/multi_threading/test/test_utf8.cpp
branches/multi_threading/test/test_utp.cpp
branches/multi_threading/test/test_web_seed.cpp
branches/multi_threading/test/test_web_seed_ban.cpp
branches/multi_threading/test/test_web_seed_chunked.cpp
branches/multi_threading/test/test_web_seed_http.cpp
branches/multi_threading/test/test_web_seed_http_pw.cpp
branches/multi_threading/test/test_web_seed_redirect.cpp
branches/multi_threading/test/test_web_seed_socks4.cpp
branches/multi_threading/test/test_web_seed_socks5.cpp
branches/multi_threading/test/test_web_seed_socks5_pw.cpp
branches/multi_threading/test/test_xml.cpp
branches/multi_threading/test/udp_tracker.cpp
Added Paths:
-----------
branches/multi_threading/m4/ax_boost_random.m4
branches/multi_threading/test/test.cpp
Property Changed:
----------------
branches/multi_threading/
Index: branches/multi_threading
===================================================================
--- branches/multi_threading 2015-06-03 04:33:20 UTC (rev 11149)
+++ branches/multi_threading 2015-06-03 05:01:16 UTC (rev 11150)
Property changes on: branches/multi_threading
___________________________________________________________________
Modified: svn:mergeinfo
## -1,5 +1,5 ##
/branches/RC_0_16:6640,6657,6662,6665,6669,6673-6675,6678,6684,6686,6688,6690,6692,6694-6695,6698,6700,6715,6936,6938,6946,6951,6956,6971,6974,6976,6979,7166,7200,7206,7258,7311,7314,7323,7333,7339,7348,7358,7371,7373,7375,7379,7395,7422,7433,7458,7461,7464,7466,7469,7471,7473,7480,7482,7487,7489,7492-7493,7497,7500,7507,7511,7514,7529,7536,7542,7546,7548-7549,7551,7553,7555,7560-7561,7564,7572,7577,7579,7587,7593-7594,7598-7599,7609,7611,7623-7624,7627,7633,7642,7644,7651,7667,7671,7675,7677,7681,7683,7685,7694,7699,7701,7704-7706,7711,7719,7729,7739,7752,7758,7760,7762,7765,7767,7771,7773,7784,7786,7788,7809,7814,7826,7828,7834,7838,7840,7847,7851,7853,7863-7864,7868,7870,7875,7884,7886,7890,7902,7905-7906,7909,7912,7914-7915,7925,7928,7930,7932,7934,7941,7947,7951,7955,7962,7964,7966,7971,7973,7984,7986,7988,7999,8002-8003,8005,8010,8012,8015,8017,8019,8021,8025,8041,8050,8066,8080,8082,8087,8091,8111,8130,8144,8171,8216,8221,8229,8235,8251,8288,8303,8331,8333,8340,8342,8345,8348,8357,8359-8361,8363,8371,8375,8382,8391,8393,8397,8399-8401,8416,8423,8426,8429,8431,8433,8436,8439,8445,8448,8452,8460,8462,8464,8466,8536,8564,8577,8580,8584,8587,8591,8605-8606,8612,8615,8619,8682,8693-8694,8696,8698,8700,8702,8704,8730,8732-8734,8760,8776-8777,8786,8797,8800,8815,8824,8826,8869,8884,8887,8917,8921-8922,8934,8936,8938,8943,8966,8971,8981-8982,8992,8994,8997,9000,9032-9033,9037,9046,9122,9127,9132,9154,9197,9204,9224,9232,9235,9237,9240,9253-9254,9260,9266-9267,9273,9285,9291,9294-9295,9297,9300,9333,9341,9343,9345,9347,9377,9408,9410,9414,9453,9480,9482,9487,9514,9520,9526,9530,9540,9543,9584,9616,9620,9627,9635,9652,9654,9661,9664,9684,9686,9691,9710,9716,9722,9729,9731,9738,9744,9752,9762,9766-9767,9772,9776,9779,9799,9805,9822,9826,9870,9872,9882,9889,9892,9894,9897,9947,9955,9994,10012,10017,10025,10134,10186,10189,10192,10195,10210,10214,10220,10223,10261,10289,10325,10338,10341,10344,10348,10391,10467,10576,10625,10629,10641
-/branches/RC_1_0:10069-11113
+/branches/RC_1_0:10069-11143
/branches/alert_queue:10881-10930
/branches/bdecoder:10825-10866
/branches/libtorrent_aio:4468-10083
## -13,4 +13,4 ##
/branches/mutable_torrents:10624-10892
/branches/peer_crypto:10512-10517
/branches/ssl:6336-6361
-/trunk:11073-11118
+/trunk:11073-11149
\ No newline at end of property
Modified: branches/multi_threading/ChangeLog
===================================================================
--- branches/multi_threading/ChangeLog 2015-06-03 04:33:20 UTC (rev 11149)
+++ branches/multi_threading/ChangeLog 2015-06-03 05:01:16 UTC (rev 11150)
@@ -71,6 +71,9 @@
* almost completely changed the storage interface (for custom storage)
* added support for hashing pieces in multiple threads
+ * fix bound-checking issue in bdecoder
+ * expose missing dht_settings fields to python
+ * add function to query the DHT settings
* fix bug in 'dont_count_slow_torrents' feature, which would start too many
torrents
Modified: branches/multi_threading/bindings/python/src/session.cpp
===================================================================
--- branches/multi_threading/bindings/python/src/session.cpp 2015-06-03 04:33:20 UTC (rev 11149)
+++ branches/multi_threading/bindings/python/src/session.cpp 2015-06-03 05:01:16 UTC (rev 11150)
@@ -664,6 +664,7 @@
)
.def("is_dht_running", allow_threads(<::session::is_dht_running))
.def("set_dht_settings", allow_threads(<::session::set_dht_settings))
+ .def("get_dht_settings", allow_threads(<::session::get_dht_settings))
#endif
.def("add_torrent", &add_torrent)
.def("async_add_torrent", &async_add_torrent)
Modified: branches/multi_threading/bindings/python/src/session_settings.cpp
===================================================================
--- branches/multi_threading/bindings/python/src/session_settings.cpp 2015-06-03 04:33:20 UTC (rev 11149)
+++ branches/multi_threading/bindings/python/src/session_settings.cpp 2015-06-03 05:01:16 UTC (rev 11150)
@@ -284,6 +284,12 @@
.def_readwrite("max_dht_items", &dht_settings::max_dht_items)
.def_readwrite("restrict_routing_ips", &dht_settings::restrict_routing_ips)
.def_readwrite("restrict_search_ips", &dht_settings::restrict_search_ips)
+ .def_readwrite("max_torrent_search_reply", &dht_settings::max_torrent_search_reply)
+ .def_readwrite("extended_routing_table", &dht_settings::extended_routing_table)
+ .def_readwrite("aggressive_lookups", &dht_settings::aggressive_lookups)
+ .def_readwrite("privacy_lookups", &dht_settings::privacy_lookups)
+ .def_readwrite("enforce_node_id", &dht_settings::enforce_node_id)
+ .def_readwrite("ignore_dark_internet", &dht_settings::ignore_dark_internet)
;
#endif
Modified: branches/multi_threading/configure.ac
===================================================================
--- branches/multi_threading/configure.ac 2015-06-03 04:33:20 UTC (rev 11149)
+++ branches/multi_threading/configure.ac 2015-06-03 05:01:16 UTC (rev 11150)
@@ -134,7 +134,6 @@
CPPFLAGS="$BOOST_CPPFLAGS $CPPFLAGS"
LDFLAGS="$BOOST_LDFLAGS $LDFLAGS"
-
###############################################################################
# Checking for functions and other stuffs
###############################################################################
Modified: branches/multi_threading/examples/client_test.cpp
===================================================================
--- branches/multi_threading/examples/client_test.cpp 2015-06-03 04:33:20 UTC (rev 11149)
+++ branches/multi_threading/examples/client_test.cpp 2015-06-03 05:01:16 UTC (rev 11150)
@@ -1180,12 +1180,14 @@
else { color = esc("0"); chr = ' '; }
}
if (last_color == 0 || strcmp(last_color, color) != 0)
+ {
snprintf(str, sizeof(str), "%s%c", color, chr);
+ out += str;
+ }
else
out += chr;
last_color = color;
- out += str;
}
out += esc("0");
out += "]";
Modified: branches/multi_threading/include/libtorrent/alert_types.hpp
===================================================================
--- branches/multi_threading/include/libtorrent/alert_types.hpp 2015-06-03 04:33:20 UTC (rev 11149)
+++ branches/multi_threading/include/libtorrent/alert_types.hpp 2015-06-03 05:01:16 UTC (rev 11150)
@@ -2319,12 +2319,48 @@
int m_msg_idx;
};
+ // This alert is posted every time a DHT message is sent or received. It is
+ // only posted if the ``alert::dht_log_notification`` alert category is
+ // enabled. It contains a verbatim copy of the message.
+ struct TORRENT_EXPORT dht_pkt_alert : alert
+ {
+ enum direction_t
+ { incoming, outgoing };
+
+ dht_pkt_alert(aux::stack_allocator& alloc, char const* buf, int size
+ , dht_pkt_alert::direction_t d, udp::endpoint ep);
+
+ static const int static_category = alert::dht_log_notification;
+ TORRENT_DEFINE_ALERT(dht_pkt_alert, 86)
+
+ virtual std::string message() const;
+
+ // returns a pointer to the packet buffer and size of the packet,
+ // respectively. This buffer is only valid for as long as the alert itself
+ // is valid, which is owned by libtorrent and reclaimed whenever
+ // pop_alerts() is called on the session.
+ char const* pkt_buf() const;
+ int pkt_size() const;
+
+ // whether this is an incoming or outgoing packet.
+ direction_t dir;
+
+ // the DHT node we received this packet from, or sent this packet to
+ // (depending on ``dir``).
+ udp::endpoint node;
+
+ private:
+ aux::stack_allocator& m_alloc;
+ int m_msg_idx;
+ int m_size;
+ };
+
#undef TORRENT_DEFINE_ALERT_IMPL
#undef TORRENT_DEFINE_ALERT
#undef TORRENT_DEFINE_ALERT_PRIO
#undef TORRENT_CLONE
- enum { num_alert_types = 86 };
+ enum { num_alert_types = 87 };
}
Modified: branches/multi_threading/include/libtorrent/aux_/cpuid.hpp
===================================================================
--- branches/multi_threading/include/libtorrent/aux_/cpuid.hpp 2015-06-03 04:33:20 UTC (rev 11149)
+++ branches/multi_threading/include/libtorrent/aux_/cpuid.hpp 2015-06-03 05:01:16 UTC (rev 11150)
@@ -38,8 +38,8 @@
namespace libtorrent { namespace aux
{
// initialized by static initializers (in cpuid.cpp)
- extern bool sse42_support;
- extern bool mmx_support;
+ TORRENT_EXTRA_EXPORT extern bool sse42_support;
+ TORRENT_EXTRA_EXPORT extern bool mmx_support;
} }
#endif // TORRENT_CPUID_HPP_INCLUDED
Modified: branches/multi_threading/include/libtorrent/aux_/session_call.hpp
===================================================================
--- branches/multi_threading/include/libtorrent/aux_/session_call.hpp 2015-06-03 04:33:20 UTC (rev 11149)
+++ branches/multi_threading/include/libtorrent/aux_/session_call.hpp 2015-06-03 05:01:16 UTC (rev 11150)
@@ -64,7 +64,7 @@
{
bool done = false;
session_impl& ses = (session_impl&) h->session();
- ses.m_io_service.dispatch(boost::bind(&aux::fun_wrap
+ ses.get_io_service().dispatch(boost::bind(&aux::fun_wrap
, boost::ref(done)
, boost::ref(ses.cond)
, boost::ref(ses.mut), f));
@@ -77,7 +77,7 @@
{
bool done = false;
Ret r;
- ses.m_io_service.dispatch(boost::bind(&fun_ret<Ret>
+ ses.get_io_service().dispatch(boost::bind(&fun_ret<Ret>
, boost::ref(r)
, boost::ref(done)
, boost::ref(ses.cond)
@@ -92,7 +92,7 @@
{
bool done = false;
session_impl& ses = (session_impl&) h->session();
- ses.m_io_service.dispatch(boost::bind(&aux::fun_ret<Ret>
+ ses.get_io_service().dispatch(boost::bind(&aux::fun_ret<Ret>
, boost::ref(r)
, boost::ref(done)
, boost::ref(ses.cond)
Modified: branches/multi_threading/include/libtorrent/aux_/session_impl.hpp
===================================================================
--- branches/multi_threading/include/libtorrent/aux_/session_impl.hpp 2015-06-03 04:33:20 UTC (rev 11149)
+++ branches/multi_threading/include/libtorrent/aux_/session_impl.hpp 2015-06-03 05:01:16 UTC (rev 11150)
@@ -168,10 +168,9 @@
enum { send_buffer_size_impl = 128 };
#ifdef TORRENT_DEBUG
- friend class ::libtorrent::peer_connection;
+// friend class ::libtorrent::peer_connection;
#endif
- friend struct checker_impl;
- friend class invariant_access;
+ friend class libtorrent::invariant_access;
typedef std::set<boost::shared_ptr<peer_connection> > connection_map;
#if TORRENT_HAS_BOOST_UNORDERED
typedef boost::unordered_map<sha1_hash, boost::shared_ptr<torrent> > torrent_map;
@@ -179,10 +178,9 @@
typedef std::map<sha1_hash, boost::shared_ptr<torrent> > torrent_map;
#endif
- session_impl();
+ session_impl(io_service& ios);
virtual ~session_impl();
- void init();
void start_session(settings_pack const& pack);
void set_load_function(user_load_function_t fun)
@@ -205,10 +203,7 @@
bool m_posting_torrent_updates;
#endif
- void main_thread();
-
void open_listen_port();
- void init_settings();
torrent_peer_allocator_interface* get_peer_allocator() { return &m_peer_allocator; }
@@ -276,7 +271,8 @@
libtorrent::session_settings deprecated_settings() const;
#endif
- void apply_settings_pack(settings_pack* pack);
+ void apply_settings_pack(boost::shared_ptr<settings_pack> pack);
+ void apply_settings_pack_impl(settings_pack const& pack);
session_settings const& settings() const { return m_settings; }
#ifndef TORRENT_DISABLE_DHT
@@ -566,8 +562,8 @@
, sha1_hash const& sent_target, udp::endpoint const& ep) TORRENT_OVERRIDE;
virtual void log(libtorrent::dht::dht_logger::module_t m, char const* fmt, ...)
TORRENT_OVERRIDE TORRENT_FORMAT(3,4);
- virtual void log_message(message_direction_t dir, char const* pkt, int len
- , char const* fmt, ...) TORRENT_OVERRIDE TORRENT_FORMAT(5, 6);
+ virtual void log_packet(message_direction_t dir, char const* pkt, int len
+ , udp::endpoint node) TORRENT_OVERRIDE;
void set_external_address(address const& ip
, int source_type, address const& source);
@@ -601,17 +597,15 @@
libtorrent::utp_socket_manager* utp_socket_manager() { return &m_utp_socket_manager; }
void inc_boost_connections() { ++m_boost_connections; }
- private:
+#ifndef TORRENT_NO_DEPRECATE
+ // the time when the next rss feed needs updating
+ time_point m_next_rss_update;
- std::vector<torrent*> m_torrent_lists[num_torrent_lists];
+ // update any rss feeds that need updating and
+ // recalculate m_next_rss_update
+ void update_rss_feeds();
+#endif
- peer_class_pool m_classes;
-
- // TODO: 2 fix this
- public:
-
- void submit_disk_jobs();
-
void update_proxy();
void update_i2p_bridge();
void update_peer_tos();
@@ -625,7 +619,6 @@
void update_network_threads();
void update_cache_buffer_chunk_size();
void update_report_web_seed_downloads();
- void trigger_auto_manage();
void update_outgoing_interfaces();
void update_listen_interfaces();
void update_privileged_ports();
@@ -639,8 +632,6 @@
void update_count_slow();
void update_peer_fingerprint();
- void on_trigger_auto_manage();
-
void update_socket_buffer_size();
void update_dht_announce_interval();
void update_anonymous_mode();
@@ -656,6 +647,20 @@
#endif
void update_alert_mask();
+ void trigger_auto_manage();
+
+ private:
+
+ std::vector<torrent*> m_torrent_lists[num_torrent_lists];
+
+ peer_class_pool m_classes;
+
+ void init(boost::shared_ptr<settings_pack> pack);
+
+ void submit_disk_jobs();
+
+ void on_trigger_auto_manage();
+
void on_lsd_peer(tcp::endpoint peer, sha1_hash const& ih);
void setup_socket_buffers(socket_type& s);
@@ -678,10 +683,7 @@
boost::pool<> m_send_buffers;
#endif
- // this is where all active sockets are stored.
- // the selector can sleep while there's no activity on
- // them
- mutable io_service m_io_service;
+ io_service& m_io_service;
#ifdef TORRENT_USE_OPENSSL
// this is a generic SSL context used when talking to
@@ -971,15 +973,6 @@
// and stopped (only the auto managed ones)
time_point m_last_auto_manage;
-#ifndef TORRENT_NO_DEPRECATE
- // the time when the next rss feed needs updating
- time_point m_next_rss_update;
-
- // update any rss feeds that need updating and
- // recalculate m_next_rss_update
- void update_rss_feeds();
-#endif
-
// when outgoing_ports is configured, this is the
// port we'll bind the next outgoing socket to
mutable int m_next_port;
@@ -1126,8 +1119,6 @@
std::list<boost::shared_ptr<tracker_logger> > m_tracker_loggers;
#endif
- private:
-
// TODO: 2 the throttling of saving resume data could probably be
// factored out into a separate class
void queue_async_resume_data(boost::shared_ptr<torrent> const& t);
@@ -1184,13 +1175,6 @@
// into fewer network writes, saving CPU and possibly
// ending up sending larger network packets
std::vector<peer_connection*> m_delayed_uncorks;
-
- // the main working thread
- boost::scoped_ptr<thread> m_thread;
-
-#if TORRENT_USE_ASSERTS && defined BOOST_HAS_PTHREADS
- pthread_t m_network_thread;
-#endif
};
#ifndef TORRENT_DISABLE_LOGGING
Modified: branches/multi_threading/include/libtorrent/aux_/session_interface.hpp
===================================================================
--- branches/multi_threading/include/libtorrent/aux_/session_interface.hpp 2015-06-03 04:33:20 UTC (rev 11149)
+++ branches/multi_threading/include/libtorrent/aux_/session_interface.hpp 2015-06-03 05:01:16 UTC (rev 11150)
@@ -267,7 +267,7 @@
virtual void trigger_auto_manage() = 0;
- virtual void apply_settings_pack(settings_pack* pack) = 0;
+ virtual void apply_settings_pack(boost::shared_ptr<settings_pack> pack) = 0;
virtual void queue_tracker_request(tracker_request& req
, boost::weak_ptr<request_callback> c) = 0;
Modified: branches/multi_threading/include/libtorrent/create_torrent.hpp
===================================================================
--- branches/multi_threading/include/libtorrent/create_torrent.hpp 2015-06-03 04:33:20 UTC (rev 11149)
+++ branches/multi_threading/include/libtorrent/create_torrent.hpp 2015-06-03 05:01:16 UTC (rev 11150)
@@ -460,7 +460,7 @@
#ifndef BOOST_NO_EXCEPTIONS
template <class Fun>
TORRENT_DEPRECATED
- void TORRENT_DEPRECATED set_piece_hashes(create_torrent& t
+ void set_piece_hashes(create_torrent& t
, std::wstring const& p, Fun f)
{
error_code ec;
@@ -469,7 +469,7 @@
}
TORRENT_DEPRECATED
- inline void TORRENT_DEPRECATED set_piece_hashes(create_torrent& t
+ inline void set_piece_hashes(create_torrent& t
, std::wstring const& p)
{
error_code ec;
@@ -479,7 +479,7 @@
#endif
TORRENT_DEPRECATED
- inline void TORRENT_DEPRECATED set_piece_hashes(create_torrent& t
+ inline void set_piece_hashes(create_torrent& t
, std::wstring const& p, error_code& ec)
{
set_piece_hashes_deprecated(t, p, detail::nop, ec);
Modified: branches/multi_threading/include/libtorrent/disk_io_job.hpp
===================================================================
--- branches/multi_threading/include/libtorrent/disk_io_job.hpp 2015-06-03 04:33:20 UTC (rev 11149)
+++ branches/multi_threading/include/libtorrent/disk_io_job.hpp 2015-06-03 05:01:16 UTC (rev 11150)
@@ -53,7 +53,7 @@
class piece_manager;
struct cached_piece_entry;
struct bdecode_node;
- struct torrent_info;
+ class torrent_info;
struct block_cache_reference
{
Modified: branches/multi_threading/include/libtorrent/disk_io_thread.hpp
===================================================================
--- branches/multi_threading/include/libtorrent/disk_io_thread.hpp 2015-06-03 04:33:20 UTC (rev 11149)
+++ branches/multi_threading/include/libtorrent/disk_io_thread.hpp 2015-06-03 05:01:16 UTC (rev 11150)
@@ -290,7 +290,7 @@
, int block_size = 16 * 1024);
~disk_io_thread();
- void set_settings(settings_pack* sett, alert_manager& alerts);
+ void set_settings(settings_pack const* sett, alert_manager& alerts);
void set_num_threads(int i, bool wait = true);
void async_read(piece_manager* storage, peer_request const& r
@@ -586,7 +586,7 @@
// dedicated to do hashing
condition_variable m_hash_job_cond;
tailqueue m_queued_hash_jobs;
-
+
// used to rate limit disk performance warnings
time_point m_last_disk_aio_performance_warning;
Modified: branches/multi_threading/include/libtorrent/enum_net.hpp
===================================================================
--- branches/multi_threading/include/libtorrent/enum_net.hpp 2015-06-03 04:33:20 UTC (rev 11149)
+++ branches/multi_threading/include/libtorrent/enum_net.hpp 2015-06-03 05:01:16 UTC (rev 11150)
@@ -89,7 +89,7 @@
, error_code& ec);
TORRENT_EXTRA_EXPORT bool in_local_network(std::vector<ip_interface> const& net
, address const& addr);
-
+
TORRENT_EXTRA_EXPORT address get_default_gateway(error_code& ec);
#ifdef SO_BINDTODEVICE
Modified: branches/multi_threading/include/libtorrent/extensions.hpp
===================================================================
--- branches/multi_threading/include/libtorrent/extensions.hpp 2015-06-03 04:33:20 UTC (rev 11149)
+++ branches/multi_threading/include/libtorrent/extensions.hpp 2015-06-03 05:01:16 UTC (rev 11150)
@@ -357,7 +357,7 @@
// can add entries to the extension handshake
// this is not called for web seeds
virtual void add_handshake(entry&) {}
-
+
// called when the peer is being disconnected.
virtual void on_disconnect(error_code const& /*ec*/) {}
@@ -369,13 +369,13 @@
// throwing an exception from any of the handlers (except add_handshake)
// closes the connection
-
+
// this is called when the initial BT handshake is received. Returning false
// means that the other end doesn't support this extension and will remove
// it from the list of plugins.
// this is not called for web seeds
virtual bool on_handshake(char const* /*reserved_bits*/) { return true; }
-
+
// called when the extension handshake from the other end is received
// if this returns false, it means that this extension isn't
// supported by this peer. It will result in this peer_plugin
Modified: branches/multi_threading/include/libtorrent/identify_client.hpp
===================================================================
--- branches/multi_threading/include/libtorrent/identify_client.hpp 2015-06-03 04:33:20 UTC (rev 11149)
+++ branches/multi_threading/include/libtorrent/identify_client.hpp 2015-06-03 05:01:16 UTC (rev 11150)
@@ -53,15 +53,16 @@
// This function can can be used to extract a string describing a client
// version from its peer-id. It will recognize most clients that have this
// kind of identification in the peer-id.
- TORRENT_DEPRECATED_EXPORT std::string identify_client(const peer_id& p)
- TORRENT_DEPRECATED;
+ TORRENT_DEPRECATED_EXPORT TORRENT_DEPRECATED
+ std::string identify_client(const peer_id& p);
// Returns an optional fingerprint if any can be identified from the peer
// id. This can be used to automate the identification of clients. It will
// not be able to identify peers with non- standard encodings. Only Azureus
// style, Shadow's style and Mainline style.
- TORRENT_DEPRECATED_EXPORT boost::optional<fingerprint>
- client_fingerprint(peer_id const& p) TORRENT_DEPRECATED;
+ TORRENT_DEPRECATED_EXPORT TORRENT_DEPRECATED
+ boost::optional<fingerprint>
+ client_fingerprint(peer_id const& p);
}
Modified: branches/multi_threading/include/libtorrent/io_service.hpp
===================================================================
--- branches/multi_threading/include/libtorrent/io_service.hpp 2015-06-03 04:33:20 UTC (rev 11149)
+++ branches/multi_threading/include/libtorrent/io_service.hpp 2015-06-03 05:01:16 UTC (rev 11150)
@@ -54,7 +54,7 @@
#include "libtorrent/aux_/disable_warnings_pop.hpp"
-#ifdef __OBJC__
+#ifdef __OBJC__
#undef Protocol
#endif
Modified: branches/multi_threading/include/libtorrent/kademlia/dht_observer.hpp
===================================================================
--- branches/multi_threading/include/libtorrent/kademlia/dht_observer.hpp 2015-06-03 04:33:20 UTC (rev 11149)
+++ branches/multi_threading/include/libtorrent/kademlia/dht_observer.hpp 2015-06-03 05:01:16 UTC (rev 11150)
@@ -53,14 +53,12 @@
enum message_direction_t
{
incoming_message,
- outgoing_message,
- incoming_message_error,
- outgoing_message_error
+ outgoing_message
};
virtual void log(module_t m, char const* fmt, ...) TORRENT_FORMAT(3,4) = 0;
- virtual void log_message(message_direction_t dir, char const* pkt, int len
- , char const* fmt, ...) TORRENT_FORMAT(5, 6) = 0;
+ virtual void log_packet(message_direction_t dir, char const* pkt, int len
+ , udp::endpoint node) = 0;
protected:
~dht_logger() {}
Modified: branches/multi_threading/include/libtorrent/kademlia/node.hpp
===================================================================
--- branches/multi_threading/include/libtorrent/kademlia/node.hpp 2015-06-03 04:33:20 UTC (rev 11149)
+++ branches/multi_threading/include/libtorrent/kademlia/node.hpp 2015-06-03 05:01:16 UTC (rev 11150)
@@ -176,12 +176,12 @@
struct count_peers
{
- int& count;
- count_peers(int& c): count(c) {}
+ int* count;
+ count_peers(int* c): count(c) {}
void operator()(std::pair<libtorrent::dht::node_id
, libtorrent::dht::torrent_entry> const& t)
{
- count += t.second.peers.size();
+ *count += t.second.peers.size();
}
};
@@ -218,7 +218,7 @@
int num_peers() const
{
int ret = 0;
- std::for_each(m_map.begin(), m_map.end(), count_peers(ret));
+ std::for_each(m_map.begin(), m_map.end(), count_peers(&ret));
return ret;
}
Modified: branches/multi_threading/include/libtorrent/session.hpp
===================================================================
--- branches/multi_threading/include/libtorrent/session.hpp 2015-06-03 04:33:20 UTC (rev 11149)
+++ branches/multi_threading/include/libtorrent/session.hpp 2015-06-03 05:01:16 UTC (rev 11150)
@@ -39,9 +39,6 @@
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/limits.hpp>
-#ifdef _MSC_VER
-# include <eh.h>
-#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
@@ -50,16 +47,19 @@
#include "libtorrent/entry.hpp"
#include "libtorrent/version.hpp"
#include "libtorrent/fingerprint.hpp"
-#include "libtorrent/disk_io_thread.hpp"
+#include "libtorrent/disk_io_thread.hpp" // for cached_piece_info
#include "libtorrent/peer_id.hpp"
#include "libtorrent/alert.hpp" // alert::error_notification
#include "libtorrent/add_torrent_params.hpp"
#include "libtorrent/peer_class.hpp"
#include "libtorrent/peer_class_type_filter.hpp"
#include "libtorrent/build_config.hpp"
+#include "libtorrent/settings_pack.hpp"
+#include "libtorrent/io_service.hpp"
#include "libtorrent/storage.hpp"
#include "libtorrent/session_settings.hpp"
+#include "libtorrent/thread.hpp"
#ifndef TORRENT_NO_DEPRECATE
#include "libtorrent/rss.hpp"
@@ -146,9 +146,18 @@
// default constructor, does not refer to any session
// implementation object.
session_proxy() {}
+ ~session_proxy();
private:
- session_proxy(boost::shared_ptr<aux::session_impl> impl)
- : m_impl(impl) {}
+ session_proxy(
+ boost::shared_ptr<io_service> ios
+ , boost::shared_ptr<thread> t
+ , boost::shared_ptr<aux::session_impl> impl)
+ : m_io_service(ios)
+ , m_thread(t)
+ , m_impl(impl)
+ {}
+ boost::shared_ptr<io_service> m_io_service;
+ boost::shared_ptr<thread> m_thread;
boost::shared_ptr<aux::session_impl> m_impl;
};
@@ -168,26 +177,47 @@
{
public:
- // If the fingerprint in the first overload is omited, the client will
- // get a default fingerprint stating the version of libtorrent. The
- // fingerprint is a short string that will be used in the peer-id to
- // identify the client and the client's version. For more details see the
- // fingerprint class.
+ // Constructs the session obects which acts as the container of torrents.
+ // It provides configuration options across torrents (such as rate limits,
+ // disk cache, ip filter etc.). In order to avoid a race condition between
+ // starting the session and configuring it, you can pass in a
+ // settings_pack object. Its settings will take effect before the session
+ // starts up.
//
- // The flags paramater can be used to start default features (upnp &
+ // The ``flags`` parameter can be used to start default features (upnp &
// nat-pmp) and default plugins (ut_metadata, ut_pex and smart_ban). The
// default is to start those features. If you do not want them to start,
// pass 0 as the flags parameter.
+ session(settings_pack const& pack
+ , int flags = start_default_features | add_default_plugins)
+ {
+ TORRENT_CFG();
+ start(flags, pack, NULL);
+ }
+
+ // overload of the constructor that takes an external io_service to run
+ // the session object on. This is primarily useful for tests that may want
+ // to run multiple sessions on a single io_service, or low resource
+ // systems where additional threads are expensive and sharing an
+ // io_service with other events is fine.
//
- // The ``alert_mask`` is the same mask that you would send to
- // set_alert_mask().
-
+ // .. warning::
+ // The session object does not cleanly terminate with an external
+ // io_service. The io_service::run() call _must_ have returned before
+ // it's safe to destruct the session. Which means you *MUST* call
+ // session::abort() and save the session_proxy first, then destruct the
+ // session object, then sync withthe io_service, then destruct the
+ // session_proxy object.
session(settings_pack const& pack
+ , io_service& ios
, int flags = start_default_features | add_default_plugins)
{
TORRENT_CFG();
- start(flags, pack);
+ start(flags, pack, &ios);
}
+
+#ifndef TORRENT_NO_DEPRECATE
+ TORRENT_DEPRECATED
session(fingerprint const& print = fingerprint("LT"
, LIBTORRENT_VERSION_MAJOR, LIBTORRENT_VERSION_MINOR, 0, 0)
, int flags = start_default_features | add_default_plugins
@@ -195,9 +225,6 @@
{
TORRENT_CFG();
settings_pack pack;
- // TODO: 2 the two second constructors here should probably
- // be deprecated in favor of the more generic one that just
- // takes a settings_pack and a string
pack.set_int(settings_pack::alert_mask, alert_mask);
pack.set_str(settings_pack::peer_fingerprint, print.to_string());
if ((flags & start_default_features) == 0)
@@ -208,8 +235,10 @@
pack.set_bool(settings_pack::enable_dht, false);
}
- start(flags, pack);
+ start(flags, pack, NULL);
}
+
+ TORRENT_DEPRECATED
session(fingerprint const& print
, std::pair<int, int> listen_port_range
, char const* listen_interface = "0.0.0.0"
@@ -235,9 +264,10 @@
pack.set_bool(settings_pack::enable_lsd, false);
pack.set_bool(settings_pack::enable_dht, false);
}
- start(flags, pack);
+ start(flags, pack, NULL);
}
-
+#endif // TORRENT_NO_DEPRECATE
+
// The destructor of session will notify all trackers that our torrents
// have been shut down. If some trackers are down, they will time out.
// All this before the destructor of session returns. So, it's advised
@@ -389,7 +419,7 @@
#endif
torrent_handle add_torrent(add_torrent_params const& params, error_code& ec);
void async_add_torrent(add_torrent_params const& params);
-
+
#ifndef BOOST_NO_EXCEPTIONS
#ifndef TORRENT_NO_DEPRECATE
// deprecated in 0.14
@@ -435,7 +465,7 @@
// session_proxy();
// ~session_proxy()
// };
- session_proxy abort() { return session_proxy(m_impl); }
+ session_proxy abort() { return session_proxy(m_io_service, m_thread, m_impl); }
// Pausing the session has the same effect as pausing every torrent in
// it, except that torrents will not be resumed by the auto-manage
@@ -537,8 +567,11 @@
// ``is_dht_running()`` returns true if the DHT support has been started
// and false
// otherwise.
+ //
+ // ``get_dht_settings()`` returns the current settings
void set_dht_settings(dht_settings const& settings);
bool is_dht_running() const;
+ dht_settings get_dht_settings() const;
// ``add_dht_node`` takes a host name and port pair. That endpoint will be
// pinged, and if a valid DHT reply is received, the node will be added to
@@ -1218,10 +1251,12 @@
private:
- void start(int flags, settings_pack const& pack);
+ void start(int flags, settings_pack const& pack, io_service* ios);
// data shared between the main thread
// and the working thread
+ boost::shared_ptr<io_service> m_io_service;
+ boost::shared_ptr<thread> m_thread;
boost::shared_ptr<aux::session_impl> m_impl;
};
Modified: branches/multi_threading/include/libtorrent/session_settings.hpp
===================================================================
--- branches/multi_threading/include/libtorrent/session_settings.hpp 2015-06-03 04:33:20 UTC (rev 11149)
+++ branches/multi_threading/include/libtorrent/session_settings.hpp 2015-06-03 05:01:16 UTC (rev 11150)
@@ -1498,7 +1498,7 @@
, block_timeout(5 * 60)
, block_ratelimit(5)
{}
-
+
// the maximum number of peers to send in a reply to ``get_peers``
int max_peers_reply;
@@ -1506,13 +1506,13 @@
// announcing and refreshing the routing table. This parameter is called
// alpha in the kademlia paper
int search_branching;
-
+
#ifndef TORRENT_NO_DEPRECATE
// the listen port for the dht. This is a UDP port. zero means use the
// same as the tcp interface
int service_port;
#endif
-
+
// the maximum number of failed tries to contact a node before it is
// removed from the routing table. If there are known working nodes that
// are ready to replace a failing node, it will be replaced immediately,
Modified: branches/multi_threading/include/libtorrent/settings_pack.hpp
===================================================================
--- branches/multi_threading/include/libtorrent/settings_pack.hpp 2015-06-03 04:33:20 UTC (rev 11149)
+++ branches/multi_threading/include/libtorrent/settings_pack.hpp 2015-06-03 05:01:16 UTC (rev 11150)
@@ -35,6 +35,7 @@
#include "libtorrent/entry.hpp"
#include <vector>
+#include <boost/smart_ptr.hpp>
// OVERVIEW
//
@@ -53,7 +54,7 @@
struct settings_pack;
struct bdecode_node;
- TORRENT_EXTRA_EXPORT settings_pack* load_pack_from_dict(bdecode_node const& settings);
+ TORRENT_EXTRA_EXPORT boost::shared_ptr<settings_pack> load_pack_from_dict(bdecode_node const& settings);
TORRENT_EXTRA_EXPORT void save_settings_to_dict(aux::session_settings const& s, entry::dictionary_type& sett);
TORRENT_EXTRA_EXPORT void apply_pack(settings_pack const* pack, aux::session_settings& sett, aux::session_impl* ses = 0);
@@ -62,7 +63,7 @@
#ifndef TORRENT_NO_DEPRECATE
struct session_settings;
- settings_pack* load_pack_from_struct(aux::session_settings const& current, session_settings const& s);
+ boost::shared_ptr<settings_pack> load_pack_from_struct(aux::session_settings const& current, session_settings const& s);
void load_struct_from_settings(aux::session_settings const& current, session_settings& ret);
#endif
@@ -183,7 +184,7 @@
// when using a poxy, this is the hostname where the proxy is running
// see proxy_type.
proxy_hostname,
-
+
// when using a proxy, these are the credentials (if any) to use whne
// connecting to it. see proxy_type
proxy_username,
Modified: branches/multi_threading/include/libtorrent/stack_allocator.hpp
===================================================================
--- branches/multi_threading/include/libtorrent/stack_allocator.hpp 2015-06-03 04:33:20 UTC (rev 11149)
+++ branches/multi_threading/include/libtorrent/stack_allocator.hpp 2015-06-03 05:01:16 UTC (rev 11150)
@@ -41,7 +41,7 @@
struct stack_allocator
{
stack_allocator() {}
-
+
int copy_string(std::string const& str)
{
int ret = int(m_storage.size());
@@ -59,6 +59,14 @@
return ret;
}
+ int copy_buffer(char const* buf, int size)
+ {
+ int ret = int(m_storage.size());
+ m_storage.resize(ret + size);
+ memcpy(&m_storage[ret], buf, size);
+ return ret;
+ }
+
int allocate(int bytes)
{
int ret = int(m_storage.size());
Modified: branches/multi_threading/include/libtorrent/udp_socket.hpp
===================================================================
--- branches/multi_threading/include/libtorrent/udp_socket.hpp 2015-06-03 04:33:20 UTC (rev 11149)
+++ branches/multi_threading/include/libtorrent/udp_socket.hpp 2015-06-03 05:01:16 UTC (rev 11150)
@@ -139,6 +139,11 @@
struct queued_packet
{
+ queued_packet()
+ : hostname(NULL)
+ , flags(0)
+ {}
+
udp::endpoint ep;
char* hostname;
buffer buf;
Copied: branches/multi_threading/m4/ax_boost_random.m4 (from rev 11149, trunk/m4/ax_boost_random.m4)
===================================================================
--- branches/multi_threading/m4/ax_boost_random.m4 (rev 0)
+++ branches/multi_threading/m4/ax_boost_random.m4 2015-06-03 05:01:16 UTC (rev 11150)
@@ -0,0 +1,123 @@
+# ===========================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_boost_random.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_BOOST_RANDOM
+#
+# DESCRIPTION
+#
+# Test for Random library from the Boost C++ libraries. The macro requires a
+# preceding call to AX_BOOST_BASE. Further documentation is available at
+# <http://randspringer.de/boost/index.html>.
+#
+# This macro calls:
+#
+# AC_SUBST(BOOST_RANDOM_LIB)
+#
+# And sets:
+#
+# HAVE_BOOST_RANDOM
+#
+# LICENSE
+#
+# Copyright (c) 2008 Thomas Porschberg <th...@ra...>
+# Copyright (c) 2008 Michael Tindal
+# Copyright (c) 2013 Daniel Casimiro <dan...@gm...>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+
+#serial 1
+
+AC_DEFUN([AX_BOOST_RANDOM],
+[
+ AC_ARG_WITH([boost-random],
+ AS_HELP_STRING([--with-boost-random@<:@=special-lib@:>@],
+ [use the Random library from boost - it is possible to specify a certain library for the linker
+ e.g. --with-boost-random=boost_random-gcc-mt ]), [
+ if test "$withval" = "no"; then
+ want_boost="no"
+ elif test "$withval" = "yes"; then
+ want_boost="yes"
+ ax_boost_user_random_lib=""
+ else
+ want_boost="yes"
+ ax_boost_user_random_lib="$withval"
+ fi
+ ], [want_boost="yes"]
+ )
+
+ if test "x$want_boost" = "xyes"; then
+ AC_REQUIRE([AC_PROG_CC])
+ AC_REQUIRE([AC_CANONICAL_BUILD])
+
+ CPPFLAGS_SAVED="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+ export CPPFLAGS
+
+ LDFLAGS_SAVED="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+ export LDFLAGS
+
+ AC_CACHE_CHECK(whether the Boost::Random library is available,
+ ax_cv_boost_random,
+ [AC_LANG_PUSH([C++])
+ CXXFLAGS_SAVE=$CXXFLAGS
+
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+ [[@%:@include <boost/random/random_device.hpp>]],
+ [[boost::random::random_device()();]])],
+ ax_cv_boost_random=yes, ax_cv_boost_random=no)
+ CXXFLAGS=$CXXFLAGS_SAVE
+ AC_LANG_POP([C++])
+ ])
+
+ if test "x$ax_cv_boost_random" = "xyes"; then
+ AC_SUBST(BOOST_CPPFLAGS)
+
+ AC_DEFINE(HAVE_BOOST_RANDOM,,[define if the Boost::Random library is available])
+ BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
+
+ if test "x$ax_boost_user_random_lib" = "x"; then
+ for libextension in `ls $BOOSTLIBDIR/libboost_random*.so* $BOOSTLIBDIR/libboost_random*.dylib* $BOOSTLIBDIR/libboost_random*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_random.*\)\.so.*$;\1;' -e 's;^lib\(boost_random.*\)\.dylib.*$;\1;' -e 's;^lib\(boost_random.*\)\.a.*$;\1;'` ; do
+ ax_lib=${libextension}
+ AC_CHECK_LIB($ax_lib, exit,
+ [BOOST_RANDOM_LIB="-l$ax_lib"; AC_SUBST(BOOST_RANDOM_LIB) link_random="yes"; break],
+ [link_random="no"])
+ done
+
+ if test "x$link_random" != "xyes"; then
+ for libextension in `ls $BOOSTLIBDIR/boost_random*.dll* $BOOSTLIBDIR/boost_random*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_random.*\)\.dll.*$;\1;' -e 's;^\(boost_random.*\)\.a.*$;\1;'` ; do
+ ax_lib=${libextension}
+ AC_CHECK_LIB($ax_lib, exit,
+ [BOOST_RANDOM_LIB="-l$ax_lib"; AC_SUBST(BOOST_RANDOM_LIB) link_random="yes"; break],
+ [link_random="no"])
+ done
+ fi
+
+ else
+ for ax_lib in $ax_boost_user_random_lib boost_random-$ax_boost_user_random_lib; do
+ AC_CHECK_LIB($ax_lib, exit,
+ [BOOST_RANDOM_LIB="-l$ax_lib"; AC_SUBST(BOOST_RANDOM_LIB) link_random="yes"; break],
+ [link_random="no"])
+ done
+ fi
+
+ if test "x$ax_lib" = "x"; then
+ AC_MSG_ERROR(Could not find a version of the library!)
+ fi
+
+ if test "x$link_random" = "xno"; then
+ AC_MSG_ERROR(Could not link against $ax_lib !)
+ fi
+ fi
+
+ CPPFLAGS="$CPPFLAGS_SAVED"
+ LDFLAGS="$LDFLAGS_SAVED"
+ fi
+])
+
Modified: branches/multi_threading/src/alert.cpp
===================================================================
--- branches/multi_threading/src/alert.cpp 2015-06-03 04:33:20 UTC (rev 11149)
+++ branches/multi_threading/src/alert.cpp 2015-06-03 05:01:16 UTC (rev 11150)
@@ -1739,5 +1739,43 @@
return ret;
}
+ dht_pkt_alert::dht_pkt_alert(aux::stack_allocator& alloc
+ , char const* buf, int size, dht_pkt_alert::direction_t d, udp::endpoint ep)
+ : dir(d)
+ , node(ep)
+ , m_alloc(alloc)
+ , m_msg_idx(alloc.copy_buffer(buf, size))
+ , m_size(size)
+ {}
+
+ char const* dht_pkt_alert::pkt_buf() const
+ {
+ return m_alloc.ptr(m_msg_idx);
+ }
+
+ int dht_pkt_alert::pkt_size() const
+ {
+ return m_size;
+ }
+
+ std::string dht_pkt_alert::message() const
+ {
+ bdecode_node print;
+ error_code ec;
+
+ // ignore errors here. This is best-effort. It may be a broken encoding
+ // but at least we'll print the valid parts
+ bdecode(pkt_buf(), pkt_buf() + pkt_size(), print, ec, NULL, 100, 100);
+
+ std::string msg = print_entry(print, true);
+
+ char const* prefix[2] = { "<==", "==>"};
+ char buf[1024];
+ snprintf(buf, sizeof(buf), "%s [%s] %s", prefix[dir]
+ , print_endpoint(node).c_str(), msg.c_str());
+
+ return buf;
+ }
+
} // namespace libtorrent
Modified: branches/multi_threading/src/asio.cpp
===================================================================
--- branches/multi_threading/src/asio.cpp 2015-06-03 04:33:20 UTC (rev 11149)
+++ branches/multi_threading/src/asio.cpp 2015-06-03 05:01:16 UTC (rev 11150)
@@ -1,14 +1,13 @@
// builds all boost.asio source as a separate compilation unit
#include <boost/version.hpp>
+#include <boost/preprocessor/facilities/is_empty.hpp>
#include "libtorrent/config.hpp"
// only define BOOST_ASIO_DECL if it hasn't already been defined
// or if it has been defined to an empty string
-#define TORRENT_IS_EMPTY_IMPL(VAL) VAL ## 1
-#define TORRENT_IS_EMPTY(VAL) TORRENT_IS_EMPTY_IMPL(VAL)
-#if !defined BOOST_ASIO_DECL || TORRENT_IS_EMPTY(BOOST_ASIO_DECL) == 1
+#if !defined BOOST_ASIO_DECL || !BOOST_PP_IS_EMPTY(BOOST_ASIO_DECL)
#ifdef BOOST_ASIO_DECL
#undef BOOST_ASIO_DECL
#endif
Modified: branches/multi_threading/src/assert.cpp
===================================================================
--- branches/multi_threading/src/assert.cpp 2015-06-03 04:33:20 UTC (rev 11149)
+++ branches/multi_threading/src/assert.cpp 2015-06-03 05:01:16 UTC (rev 11150)
@@ -266,7 +266,7 @@
message = "A precondition of a libtorrent function has been violated.\n"
"This indicates a bug in the client application using libtorrent\n";
}
-
+
assert_print("%s\n"
#ifdef TORRENT_PRODUCTION_ASSERTS
"#: %d\n"
@@ -288,10 +288,10 @@
// if production asserts are defined, don't abort, just print the error
#ifndef TORRENT_PRODUCTION_ASSERTS
- // send SIGINT to the current process
- // to break into the debugger
- raise(SIGINT);
- abort();
+ // send SIGINT to the current process
+ // to break into the debugger
+ raise(SIGINT);
+ abort();
#endif
}
Modified: branches/multi_threading/src/bdecode.cpp
===================================================================
--- branches/multi_threading/src/bdecode.cpp 2015-06-03 04:33:20 UTC (rev 11149)
+++ branches/multi_threading/src/bdecode.cpp 2015-06-03 05:01:16 UTC (rev 11150)
@@ -836,7 +836,10 @@
start = parse_int(start, end, ':', len, e);
if (e)
TORRENT_FAIL_BDECODE(e);
- if (start + len + 1 > end)
+
+ // remaining buffer size excluding ':'
+ const ptrdiff_t buff_size = end - start - 1;
+ if (len > buff_size)
TORRENT_FAIL_BDECODE(bdecode_errors::unexpected_eof);
if (len < 0)
TORRENT_FAIL_BDECODE(bdecode_errors::overflow);
Modified: branches/multi_threading/src/disk_io_thread.cpp
===================================================================
--- branches/multi_threading/src/disk_io_thread.cpp 2015-06-03 04:33:20 UTC (rev 11149)
+++ branches/multi_threading/src/disk_io_thread.cpp 2015-06-03 05:01:16 UTC (rev 11150)
@@ -262,7 +262,7 @@
m_blocks_to_reclaim.clear();
}
- void disk_io_thread::set_settings(settings_pack* pack, alert_manager& alerts)
+ void disk_io_thread::set_settings(settings_pack const* pack, alert_manager& alerts)
{
TORRENT_ASSERT(m_magic == 0x1337);
mutex::scoped_lock l(m_cache_mutex);
Modified: branches/multi_threading/src/kademlia/dht_tracker.cpp
===================================================================
--- branches/multi_threading/src/kademlia/dht_tracker.cpp 2015-06-03 04:33:20 UTC (rev 11149)
+++ branches/multi_threading/src/kademlia/dht_tracker.cpp 2015-06-03 05:01:16 UTC (rev 11150)
@@ -79,47 +79,6 @@
{
void incoming_error(entry& e, char const* msg);
-#ifndef TORRENT_DISABLE_LOGGING
- std::string parse_dht_client(bdecode_node const& e)
- {
- bdecode_node ver = e.dict_find_string("v");
- if (!ver) return "generic";
- std::string const& client = ver.string_value();
- if (client.size() < 2)
- {
- return client;
- }
- else if (std::equal(client.begin(), client.begin() + 2, "Az"))
- {
- return "Azureus";
- }
- else if (std::equal(client.begin(), client.begin() + 2, "UT"))
- {
- return "uTorrent";
- }
- else if (std::equal(client.begin(), client.begin() + 2, "LT"))
- {
- return "libtorrent";
- }
- else if (std::equal(client.begin(), client.begin() + 2, "MP"))
- {
- return "MooPolice";
- }
- else if (std::equal(client.begin(), client.begin() + 2, "GR"))
- {
- return "GetRight";
- }
- else if (std::equal(client.begin(), client.begin() + 2, "MO"))
- {
- return "Mono Torrent";
- }
- else
- {
- return client;
- }
- }
-#endif
-
namespace {
node_id extract_node_id(entry const* e)
@@ -394,7 +353,7 @@
using libtorrent::entry;
using libtorrent::bdecode;
-
+
TORRENT_ASSERT(size > 0);
int pos;
@@ -403,10 +362,7 @@
if (ret != 0)
{
#ifndef TORRENT_DISABLE_LOGGING
- m_log->log_message(dht_logger::incoming_message_error, buf
- , size, "%s ERROR: %s pos: %d"
- , print_endpoint(ep).c_str(), err.message().c_str()
- , int(pos));
+ m_log->log_packet(dht_logger::incoming_message, buf, size, ep);
#endif
return false;
}
@@ -414,21 +370,15 @@
if (m_msg.type() != bdecode_node::dict_t)
{
#ifndef TORRENT_DISABLE_LOGGING
- m_log->log_message(dht_logger::incoming_message_error, buf
- , size, "%s ERROR: not a dictionary"
- , print_endpoint(ep).c_str());
+ m_log->log_packet(dht_logger::incoming_message, buf, size, ep);
#endif
- // it's not a good idea to send invalid messages
- // especially not in response to an invalid message
-// entry r;
-// libtorrent::dht::incoming_error(r, "message is not a dictionary");
-// send_packet(r, ep, 0);
+ // it's not a good idea to send a response to an invalid messages
return false;
}
#ifndef TORRENT_DISABLE_LOGGING
- m_log->log_message(dht_logger::incoming_message, buf
- , size, "%s", print_endpoint(ep).c_str());
+ m_log->log_packet(dht_logger::incoming_message, buf
+ , size, ep);
#endif
libtorrent::dht::msg m(m_msg, ep);
@@ -448,7 +398,7 @@
}
} // anonymous namespace
-
+
entry dht_tracker::state() const
{
entry ret(entry::dictionary_t);
@@ -523,9 +473,8 @@
{
m_counters.inc_stats_counter(counters::dht_messages_out_dropped);
#ifndef TORRENT_DISABLE_LOGGING
- m_log->log_message(dht_logger::outgoing_message, &m_send_buf[0]
- , m_send_buf.size(), "%s DROPPED (%s)"
- , print_endpoint(addr).c_str(), ec.message().c_str());
+ m_log->log_packet(dht_logger::outgoing_message, &m_send_buf[0]
+ , m_send_buf.size(), addr);
#endif
return false;
}
@@ -536,9 +485,8 @@
, addr.address().is_v6() ? 48 : 28);
m_counters.inc_stats_counter(counters::dht_messages_out);
#ifndef TORRENT_DISABLE_LOGGING
- m_log->log_message(dht_logger::outgoing_message, &m_send_buf[0]
- , m_send_buf.size(), "%s"
- , print_endpoint(addr).c_str());
+ m_log->log_packet(dht_logger::outgoing_message, &m_send_buf[0]
+ , m_send_buf.size(), addr);
#endif
return true;
}
@@ -547,9 +495,8 @@
m_counters.inc_stats_counter(counters::dht_messages_out_dropped);
#ifndef TORRENT_DISABLE_LOGGING
- m_log->log_message(dht_logger::outgoing_message, &m_send_buf[0]
- , m_send_buf.size(), "%s"
- , print_endpoint(addr).c_str());
+ m_log->log_packet(dht_logger::outgoing_message, &m_send_buf[0]
+ , m_send_buf.size(), addr);
#endif
return false;
}
Modified: branches/multi_threading/src/kademlia/get_item.cpp
===================================================================
--- branches/multi_threading/src/kademlia/get_item.cpp 2015-06-03 04:33:20 UTC (rev 11149)
+++ branches/multi_threading/src/kademlia/get_item.cpp 2015-06-03 05:01:16 UTC (rev 11150)
@@ -201,9 +201,9 @@
#ifndef TORRENT_DISABLE_LOGGING
// TODO: 3 it would be nice to not have to spend so much time rendering
// the bencoded dict if logging is disabled
- get_node().observer()->log(dht_logger::traversal, "[%p] sending put [ v: \"%s\" seq: %" PRId64 " nodes: %d ]"
- , this, m_data.value().to_string().c_str()
- , (m_data.is_mutable() ? m_data.seq() : -1)
+ get_node().observer()->log(dht_logger::traversal, "[%p] sending put "
+ "[ seq: %" PRId64 " nodes: %d ]"
+ , this, (m_data.is_mutable() ? m_data.seq() : -1)
, int(v.size()));
#endif
Modified: branches/multi_threading/src/lazy_bdecode.cpp
===================================================================
--- branches/multi_threading/src/lazy_bdecode.cpp 2015-06-03 04:33:20 UTC (rev 11149)
+++ branches/multi_threading/src/lazy_bdecode.cpp 2015-06-03 05:01:16 UTC (rev 11150)
@@ -130,7 +130,9 @@
if (e)
TORRENT_FAIL_BDECODE(e);
- if (start + len + 1 > end)
+ // remaining buffer size excluding ':'
+ const ptrdiff_t buff_size = end - start - 1;
+ if (len > buff_size)
TORRENT_FAIL_BDECODE(bdecode_errors::unexpected_eof);
if (len < 0)
@@ -196,15 +198,19 @@
start = parse_int(start, end, ':', len, e);
if (e)
TORRENT_FAIL_BDECODE(e);
- if (start + len + 1 > end)
+
+ // remaining buffer size excluding ':'
+ const ptrdiff_t buff_size = end - start - 1;
+ if (len > buff_size)
TORRENT_FAIL_BDECODE(bdecode_errors::unexpected_eof);
if (len < 0)
TORRENT_FAIL_BDECODE(bdecode_errors::overflow);
++start;
+ if (start == end) TORRENT_FAIL_BDECODE(bdecode_errors::unexpected_eof);
top->construct_string(start, int(len));
+ start += len;
stack.pop_back();
- start += len;
break;
}
}
Modified: branches/multi_threading/src/rss.cpp
===================================================================
--- branches/multi_threading/src/rss.cpp 2015-06-03 04:33:20 UTC (rev 11149)
+++ branches/multi_threading/src/rss.cpp 2015-06-03 05:01:16 UTC (rev 11150)
@@ -348,9 +348,9 @@
{
++m_failures;
m_error = ec;
- if (m_ses.m_alerts.should_post<rss_alert>())
+ if (m_ses.alerts().should_post<rss_alert>())
{
- m_ses.m_alerts.emplace_alert<rss_alert>(my_handle(), m_settings.url
+ m_ses.alerts().emplace_alert<rss_alert>(my_handle(), m_settings.url
, rss_alert::state_error, m_error);
}
return;
@@ -360,9 +360,9 @@
{
++m_failures;
m_error = error_code(parser.status_code(), get_http_category());
- if (m_ses.m_alerts.should_post<rss_alert>())
+ if (m_ses.alerts().should_post<rss_alert>())
{
- m_ses.m_alerts.emplace_alert<rss_alert>(my_handle(), m_settings.url
+ m_ses.alerts().emplace_alert<rss_alert>(my_handle(), m_settings.url
, rss_alert::state_error, m_error);
}
return;
@@ -405,9 +405,9 @@
#endif
// report that we successfully updated the feed
- if (m_ses.m_alerts.should_post<rss_alert>())
+ if (m_ses.alerts().should_post<rss_alert>())
{
- m_ses.m_alerts.emplace_alert<rss_alert>(my_handle(), m_settings.url
+ m_ses.alerts().emplace_alert<rss_alert>(my_handle(), m_settings.url
, rss_alert::state_updated, error_code());
}
@@ -435,7 +435,7 @@
{
bdecode_node entry = e.list_at(i);
if (entry.type() != bdecode_node::dict_t) continue;
-
+
m_items.push_back(feed_item());
feed_item& item = m_items.back();
item.url = entry.dict_find_string_value("url");
@@ -560,8 +560,8 @@
if (m_settings.auto_map_handles)
i.handle = torrent_handle(m_ses.find_torrent(i.uuid.empty() ? i.url : i.uuid));
- if (m_ses.m_alerts.should_post<rss_item_alert>())
- m_ses.m_alerts.emplace_alert<rss_item_alert>(my_handle(), i);
+ if (m_ses.alerts().should_post<rss_item_alert>())
+ m_ses.alerts().emplace_alert<rss_item_alert>(my_handle(), i);
if (m_settings.auto_download)
{
@@ -605,9 +605,9 @@
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
- if (m_ses.m_alerts.should_post<rss_alert>())
+ if (m_ses.alerts().should_post<rss_alert>())
{
- m_ses.m_alerts.emplace_alert<rss_alert>(my_handle(), m_settings.url
+ m_ses.alerts().emplace_alert<rss_alert>(my_handle(), m_settings.url
, rss_alert::state_updating, error_code());
}
@@ -616,14 +616,14 @@
#endif
boost::shared_ptr<http_connection> feed(
- new http_connection(m_ses.m_io_service
- , m_ses.m_host_resolver
+ new http_connection(m_ses.get_io_service()
+ , m_ses.get_resolver()
, boost::bind(&feed::on_feed, shared_from_this()
, _1, _2, _3, _4)));
m_updating = true;
feed->get(m_settings.url, seconds(30), 0, 0, 5
- , m_ses.m_settings.get_str(settings_pack::user_agent));
+ , m_ses.s...
[truncated message content] |
|
From: <ar...@us...> - 2015-06-03 04:33:23
|
Revision: 11149
http://sourceforge.net/p/libtorrent/code/11149
Author: arvidn
Date: 2015-06-03 04:33:20 +0000 (Wed, 03 Jun 2015)
Log Message:
-----------
turn some more members of session_impl to private
Modified Paths:
--------------
trunk/include/libtorrent/aux_/session_call.hpp
trunk/include/libtorrent/aux_/session_impl.hpp
trunk/src/rss.cpp
trunk/src/session.cpp
trunk/src/session_call.cpp
trunk/src/torrent_handle.cpp
Modified: trunk/include/libtorrent/aux_/session_call.hpp
===================================================================
--- trunk/include/libtorrent/aux_/session_call.hpp 2015-06-03 03:04:44 UTC (rev 11148)
+++ trunk/include/libtorrent/aux_/session_call.hpp 2015-06-03 04:33:20 UTC (rev 11149)
@@ -64,7 +64,7 @@
{
bool done = false;
session_impl& ses = (session_impl&) h->session();
- ses.m_io_service.dispatch(boost::bind(&aux::fun_wrap
+ ses.get_io_service().dispatch(boost::bind(&aux::fun_wrap
, boost::ref(done)
, boost::ref(ses.cond)
, boost::ref(ses.mut), f));
@@ -77,7 +77,7 @@
{
bool done = false;
Ret r;
- ses.m_io_service.dispatch(boost::bind(&fun_ret<Ret>
+ ses.get_io_service().dispatch(boost::bind(&fun_ret<Ret>
, boost::ref(r)
, boost::ref(done)
, boost::ref(ses.cond)
@@ -92,7 +92,7 @@
{
bool done = false;
session_impl& ses = (session_impl&) h->session();
- ses.m_io_service.dispatch(boost::bind(&aux::fun_ret<Ret>
+ ses.get_io_service().dispatch(boost::bind(&aux::fun_ret<Ret>
, boost::ref(r)
, boost::ref(done)
, boost::ref(ses.cond)
Modified: trunk/include/libtorrent/aux_/session_impl.hpp
===================================================================
--- trunk/include/libtorrent/aux_/session_impl.hpp 2015-06-03 03:04:44 UTC (rev 11148)
+++ trunk/include/libtorrent/aux_/session_impl.hpp 2015-06-03 04:33:20 UTC (rev 11149)
@@ -168,10 +168,9 @@
enum { send_buffer_size_impl = 128 };
#ifdef TORRENT_DEBUG
- friend class ::libtorrent::peer_connection;
+// friend class ::libtorrent::peer_connection;
#endif
- friend struct checker_impl;
- friend class invariant_access;
+ friend class libtorrent::invariant_access;
typedef std::set<boost::shared_ptr<peer_connection> > connection_map;
#if TORRENT_HAS_BOOST_UNORDERED
typedef boost::unordered_map<sha1_hash, boost::shared_ptr<torrent> > torrent_map;
@@ -598,20 +597,15 @@
libtorrent::utp_socket_manager* utp_socket_manager() { return &m_utp_socket_manager; }
void inc_boost_connections() { ++m_boost_connections; }
- private:
+#ifndef TORRENT_NO_DEPRECATE
+ // the time when the next rss feed needs updating
+ time_point m_next_rss_update;
- std::vector<torrent*> m_torrent_lists[num_torrent_lists];
+ // update any rss feeds that need updating and
+ // recalculate m_next_rss_update
+ void update_rss_feeds();
+#endif
- peer_class_pool m_classes;
-
- void init(boost::shared_ptr<settings_pack> pack);
-
- // TODO: 3 fix this. all this should not be public. start by making
- // everything that doesn't have to be public private.
- public:
-
- void submit_disk_jobs();
-
void update_proxy();
void update_i2p_bridge();
void update_peer_tos();
@@ -625,7 +619,6 @@
void update_network_threads();
void update_cache_buffer_chunk_size();
void update_report_web_seed_downloads();
- void trigger_auto_manage();
void update_outgoing_interfaces();
void update_listen_interfaces();
void update_privileged_ports();
@@ -639,8 +632,6 @@
void update_count_slow();
void update_peer_fingerprint();
- void on_trigger_auto_manage();
-
void update_socket_buffer_size();
void update_dht_announce_interval();
void update_anonymous_mode();
@@ -656,6 +647,20 @@
#endif
void update_alert_mask();
+ void trigger_auto_manage();
+
+ private:
+
+ std::vector<torrent*> m_torrent_lists[num_torrent_lists];
+
+ peer_class_pool m_classes;
+
+ void init(boost::shared_ptr<settings_pack> pack);
+
+ void submit_disk_jobs();
+
+ void on_trigger_auto_manage();
+
void on_lsd_peer(tcp::endpoint peer, sha1_hash const& ih);
void setup_socket_buffers(socket_type& s);
@@ -968,15 +973,6 @@
// and stopped (only the auto managed ones)
time_point m_last_auto_manage;
-#ifndef TORRENT_NO_DEPRECATE
- // the time when the next rss feed needs updating
- time_point m_next_rss_update;
-
- // update any rss feeds that need updating and
- // recalculate m_next_rss_update
- void update_rss_feeds();
-#endif
-
// when outgoing_ports is configured, this is the
// port we'll bind the next outgoing socket to
mutable int m_next_port;
@@ -1123,8 +1119,6 @@
std::list<boost::shared_ptr<tracker_logger> > m_tracker_loggers;
#endif
- private:
-
// TODO: 2 the throttling of saving resume data could probably be
// factored out into a separate class
void queue_async_resume_data(boost::shared_ptr<torrent> const& t);
Modified: trunk/src/rss.cpp
===================================================================
--- trunk/src/rss.cpp 2015-06-03 03:04:44 UTC (rev 11148)
+++ trunk/src/rss.cpp 2015-06-03 04:33:20 UTC (rev 11149)
@@ -348,9 +348,9 @@
{
++m_failures;
m_error = ec;
- if (m_ses.m_alerts.should_post<rss_alert>())
+ if (m_ses.alerts().should_post<rss_alert>())
{
- m_ses.m_alerts.emplace_alert<rss_alert>(my_handle(), m_settings.url
+ m_ses.alerts().emplace_alert<rss_alert>(my_handle(), m_settings.url
, rss_alert::state_error, m_error);
}
return;
@@ -360,9 +360,9 @@
{
++m_failures;
m_error = error_code(parser.status_code(), get_http_category());
- if (m_ses.m_alerts.should_post<rss_alert>())
+ if (m_ses.alerts().should_post<rss_alert>())
{
- m_ses.m_alerts.emplace_alert<rss_alert>(my_handle(), m_settings.url
+ m_ses.alerts().emplace_alert<rss_alert>(my_handle(), m_settings.url
, rss_alert::state_error, m_error);
}
return;
@@ -405,9 +405,9 @@
#endif
// report that we successfully updated the feed
- if (m_ses.m_alerts.should_post<rss_alert>())
+ if (m_ses.alerts().should_post<rss_alert>())
{
- m_ses.m_alerts.emplace_alert<rss_alert>(my_handle(), m_settings.url
+ m_ses.alerts().emplace_alert<rss_alert>(my_handle(), m_settings.url
, rss_alert::state_updated, error_code());
}
@@ -435,7 +435,7 @@
{
bdecode_node entry = e.list_at(i);
if (entry.type() != bdecode_node::dict_t) continue;
-
+
m_items.push_back(feed_item());
feed_item& item = m_items.back();
item.url = entry.dict_find_string_value("url");
@@ -560,8 +560,8 @@
if (m_settings.auto_map_handles)
i.handle = torrent_handle(m_ses.find_torrent(i.uuid.empty() ? i.url : i.uuid));
- if (m_ses.m_alerts.should_post<rss_item_alert>())
- m_ses.m_alerts.emplace_alert<rss_item_alert>(my_handle(), i);
+ if (m_ses.alerts().should_post<rss_item_alert>())
+ m_ses.alerts().emplace_alert<rss_item_alert>(my_handle(), i);
if (m_settings.auto_download)
{
@@ -605,9 +605,9 @@
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
- if (m_ses.m_alerts.should_post<rss_alert>())
+ if (m_ses.alerts().should_post<rss_alert>())
{
- m_ses.m_alerts.emplace_alert<rss_alert>(my_handle(), m_settings.url
+ m_ses.alerts().emplace_alert<rss_alert>(my_handle(), m_settings.url
, rss_alert::state_updating, error_code());
}
@@ -616,14 +616,14 @@
#endif
boost::shared_ptr<http_connection> feed(
- new http_connection(m_ses.m_io_service
- , m_ses.m_host_resolver
+ new http_connection(m_ses.get_io_service()
+ , m_ses.get_resolver()
, boost::bind(&feed::on_feed, shared_from_this()
, _1, _2, _3, _4)));
m_updating = true;
feed->get(m_settings.url, seconds(30), 0, 0, 5
- , m_ses.m_settings.get_str(settings_pack::user_agent));
+ , m_ses.settings().get_str(settings_pack::user_agent));
return 60 + m_failures * m_failures * 60;
}
@@ -653,13 +653,13 @@
boost::shared_ptr<feed> f = m_feed_ptr.lock(); \
if (!f) return; \
aux::session_impl& ses = f->session(); \
- ses.m_io_service.post(boost::bind(&feed:: x, f))
+ ses.get_io_service().post(boost::bind(&feed:: x, f))
#define TORRENT_ASYNC_CALL1(x, a1) \
boost::shared_ptr<feed> f = m_feed_ptr.lock(); \
if (!f) return; \
aux::session_impl& ses = f->session(); \
- ses.m_io_service.post(boost::bind(&feed:: x, f, a1))
+ ses.get_io_service().post(boost::bind(&feed:: x, f, a1))
#define TORRENT_SYNC_CALL1(x, a1) \
boost::shared_ptr<feed> f = m_feed_ptr.lock(); \
Modified: trunk/src/session.cpp
===================================================================
--- trunk/src/session.cpp 2015-06-03 03:04:44 UTC (rev 11148)
+++ trunk/src/session.cpp 2015-06-03 04:33:20 UTC (rev 11149)
@@ -336,16 +336,16 @@
#endif
#define TORRENT_ASYNC_CALL(x) \
- m_impl->m_io_service.dispatch(boost::bind(&session_impl:: x, m_impl.get()))
+ m_impl->get_io_service().dispatch(boost::bind(&session_impl:: x, m_impl.get()))
#define TORRENT_ASYNC_CALL1(x, a1) \
- m_impl->m_io_service.dispatch(boost::bind(&session_impl:: x, m_impl.get(), a1))
+ m_impl->get_io_service().dispatch(boost::bind(&session_impl:: x, m_impl.get(), a1))
#define TORRENT_ASYNC_CALL2(x, a1, a2) \
- m_impl->m_io_service.dispatch(boost::bind(&session_impl:: x, m_impl.get(), a1, a2))
+ m_impl->get_io_service().dispatch(boost::bind(&session_impl:: x, m_impl.get(), a1, a2))
#define TORRENT_ASYNC_CALL3(x, a1, a2, a3) \
- m_impl->m_io_service.dispatch(boost::bind(&session_impl:: x, m_impl.get(), a1, a2, a3))
+ m_impl->get_io_service().dispatch(boost::bind(&session_impl:: x, m_impl.get(), a1, a2, a3))
#define TORRENT_SYNC_CALL(x) \
aux::sync_call(*m_impl, boost::function<void(void)>(boost::bind(&session_impl:: x, m_impl.get())))
@@ -552,7 +552,7 @@
boost::shared_ptr<ip_filter> copy = boost::make_shared<ip_filter>(f);
TORRENT_ASYNC_CALL1(set_ip_filter, copy);
}
-
+
ip_filter session::get_ip_filter() const
{
return TORRENT_SYNC_CALL_RET(ip_filter, get_ip_filter);
@@ -571,7 +571,7 @@
apply_settings(p);
}
#endif
-
+
peer_id session::id() const
{
return TORRENT_SYNC_CALL_RET(peer_id, get_peer_id);
@@ -579,7 +579,7 @@
io_service& session::get_io_service()
{
- return m_impl->m_io_service;
+ return m_impl->get_io_service();
}
void session::set_key(int key)
@@ -804,7 +804,7 @@
else
flags = session::disk_cache_no_pieces;
}
- m_impl->m_disk_thread.get_cache_info(ret, flags & session::disk_cache_no_pieces, st);
+ m_impl->disk_thread().get_cache_info(ret, flags & session::disk_cache_no_pieces, st);
}
#ifndef TORRENT_NO_DEPRECATE
@@ -1156,7 +1156,7 @@
void session::set_alert_dispatch(boost::function<void(std::auto_ptr<alert>)> const& fun)
{
- m_impl->m_alerts.set_dispatch_function(fun);
+ m_impl->alerts().set_dispatch_function(fun);
}
#endif // TORRENT_NO_DEPRECATE
@@ -1173,7 +1173,7 @@
void session::set_alert_notify(boost::function<void()> const& fun)
{
- m_impl->m_alerts.set_notify_function(fun);
+ m_impl->alerts().set_notify_function(fun);
}
#ifndef TORRENT_NO_DEPRECATE
Modified: trunk/src/session_call.cpp
===================================================================
--- trunk/src/session_call.cpp 2015-06-03 03:04:44 UTC (rev 11148)
+++ trunk/src/session_call.cpp 2015-06-03 04:33:20 UTC (rev 11149)
@@ -89,7 +89,7 @@
void sync_call(aux::session_impl& ses, boost::function<void(void)> f)
{
bool done = false;
- ses.m_io_service.dispatch(boost::bind(&fun_wrap
+ ses.get_io_service().dispatch(boost::bind(&fun_wrap
, boost::ref(done)
, boost::ref(ses.cond)
, boost::ref(ses.mut)
Modified: trunk/src/torrent_handle.cpp
===================================================================
--- trunk/src/torrent_handle.cpp 2015-06-03 03:04:44 UTC (rev 11148)
+++ trunk/src/torrent_handle.cpp 2015-06-03 04:33:20 UTC (rev 11149)
@@ -146,31 +146,31 @@
boost::shared_ptr<torrent> t = m_torrent.lock(); \
if (!t) return; \
session_impl& ses = (session_impl&) t->session(); \
- ses.m_io_service.dispatch(boost::bind(&torrent:: x, t))
+ ses.get_io_service().dispatch(boost::bind(&torrent:: x, t))
#define TORRENT_ASYNC_CALL1(x, a1) \
boost::shared_ptr<torrent> t = m_torrent.lock(); \
if (!t) return; \
session_impl& ses = (session_impl&) t->session(); \
- ses.m_io_service.dispatch(boost::bind(&torrent:: x, t, a1))
+ ses.get_io_service().dispatch(boost::bind(&torrent:: x, t, a1))
#define TORRENT_ASYNC_CALL2(x, a1, a2) \
boost::shared_ptr<torrent> t = m_torrent.lock(); \
if (!t) return; \
session_impl& ses = (session_impl&) t->session(); \
- ses.m_io_service.dispatch(boost::bind(&torrent:: x, t, a1, a2))
+ ses.get_io_service().dispatch(boost::bind(&torrent:: x, t, a1, a2))
#define TORRENT_ASYNC_CALL3(x, a1, a2, a3) \
boost::shared_ptr<torrent> t = m_torrent.lock(); \
if (!t) return; \
session_impl& ses = (session_impl&) t->session(); \
- ses.m_io_service.dispatch(boost::bind(&torrent:: x, t, a1, a2, a3))
+ ses.get_io_service().dispatch(boost::bind(&torrent:: x, t, a1, a2, a3))
#define TORRENT_ASYNC_CALL4(x, a1, a2, a3, a4) \
boost::shared_ptr<torrent> t = m_torrent.lock(); \
if (!t) return; \
session_impl& ses = (session_impl&) t->session(); \
- ses.m_io_service.dispatch(boost::bind(&torrent:: x, t, a1, a2, a3, a4))
+ ses.get_io_service().dispatch(boost::bind(&torrent:: x, t, a1, a2, a3, a4))
#define TORRENT_SYNC_CALL(x) \
boost::shared_ptr<torrent> t = m_torrent.lock(); \
@@ -719,7 +719,7 @@
bool done = false;
session_impl& ses = (session_impl&) t->session();
storage_error ec;
- ses.m_io_service.dispatch(boost::bind(&aux::fun_wrap, boost::ref(done), boost::ref(ses.cond)
+ ses.get_io_service().dispatch(boost::bind(&aux::fun_wrap, boost::ref(done), boost::ref(ses.cond)
, boost::ref(ses.mut), boost::function<void(void)>(boost::bind(
&piece_manager::write_resume_data, &t->storage(), boost::ref(ret), boost::ref(ec)))));
t.reset();
@@ -776,7 +776,7 @@
boost::shared_ptr<torrent> t = m_torrent.lock();
if (!t || !t->has_storage()) return;
session_impl& ses = (session_impl&) t->session();
- ses.m_disk_thread.files().get_status(&status, &t->storage());
+ ses.disk_thread().files().get_status(&status, &t->storage());
}
void torrent_handle::scrape_tracker() const
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ar...@us...> - 2015-06-03 03:04:46
|
Revision: 11148
http://sourceforge.net/p/libtorrent/code/11148
Author: arvidn
Date: 2015-06-03 03:04:44 +0000 (Wed, 03 Jun 2015)
Log Message:
-----------
separate the main thread and the io_service from session_impl. The io_service object is now simply run() in the main thread, all initialization is done by posting messages to it. This generalizes session_impl to some degree, enables future expansion to run in multiple threads (although, the peers and torrents don't support this). This patch also makes it possible to pass in a third party io_service to the session, but at this point that's mostly useful for tests, as it's not well supported
Modified Paths:
--------------
trunk/include/libtorrent/aux_/session_impl.hpp
trunk/include/libtorrent/session.hpp
trunk/src/session.cpp
trunk/src/session_impl.cpp
Modified: trunk/include/libtorrent/aux_/session_impl.hpp
===================================================================
--- trunk/include/libtorrent/aux_/session_impl.hpp 2015-06-03 02:37:59 UTC (rev 11147)
+++ trunk/include/libtorrent/aux_/session_impl.hpp 2015-06-03 03:04:44 UTC (rev 11148)
@@ -179,10 +179,9 @@
typedef std::map<sha1_hash, boost::shared_ptr<torrent> > torrent_map;
#endif
- session_impl();
+ session_impl(io_service& ios);
virtual ~session_impl();
- void init();
void start_session(settings_pack const& pack);
void set_load_function(user_load_function_t fun)
@@ -205,10 +204,7 @@
bool m_posting_torrent_updates;
#endif
- void main_thread();
-
void open_listen_port();
- void init_settings();
torrent_peer_allocator_interface* get_peer_allocator() { return &m_peer_allocator; }
@@ -608,7 +604,10 @@
peer_class_pool m_classes;
- // TODO: 2 fix this
+ void init(boost::shared_ptr<settings_pack> pack);
+
+ // TODO: 3 fix this. all this should not be public. start by making
+ // everything that doesn't have to be public private.
public:
void submit_disk_jobs();
@@ -679,10 +678,7 @@
boost::pool<> m_send_buffers;
#endif
- // this is where all active sockets are stored.
- // the selector can sleep while there's no activity on
- // them
- mutable io_service m_io_service;
+ io_service& m_io_service;
#ifdef TORRENT_USE_OPENSSL
// this is a generic SSL context used when talking to
@@ -1185,13 +1181,6 @@
// into fewer network writes, saving CPU and possibly
// ending up sending larger network packets
std::vector<peer_connection*> m_delayed_uncorks;
-
- // the main working thread
- boost::scoped_ptr<thread> m_thread;
-
-#if TORRENT_USE_ASSERTS && defined BOOST_HAS_PTHREADS
- pthread_t m_network_thread;
-#endif
};
#ifndef TORRENT_DISABLE_LOGGING
Modified: trunk/include/libtorrent/session.hpp
===================================================================
--- trunk/include/libtorrent/session.hpp 2015-06-03 02:37:59 UTC (rev 11147)
+++ trunk/include/libtorrent/session.hpp 2015-06-03 03:04:44 UTC (rev 11148)
@@ -54,9 +54,12 @@
#include "libtorrent/peer_class.hpp"
#include "libtorrent/peer_class_type_filter.hpp"
#include "libtorrent/build_config.hpp"
+#include "libtorrent/settings_pack.hpp"
+#include "libtorrent/io_service.hpp"
#include "libtorrent/storage.hpp"
#include "libtorrent/session_settings.hpp"
+#include "libtorrent/thread.hpp"
#ifndef TORRENT_NO_DEPRECATE
#include "libtorrent/rss.hpp"
@@ -143,9 +146,18 @@
// default constructor, does not refer to any session
// implementation object.
session_proxy() {}
+ ~session_proxy();
private:
- session_proxy(boost::shared_ptr<aux::session_impl> impl)
- : m_impl(impl) {}
+ session_proxy(
+ boost::shared_ptr<io_service> ios
+ , boost::shared_ptr<thread> t
+ , boost::shared_ptr<aux::session_impl> impl)
+ : m_io_service(ios)
+ , m_thread(t)
+ , m_impl(impl)
+ {}
+ boost::shared_ptr<io_service> m_io_service;
+ boost::shared_ptr<thread> m_thread;
boost::shared_ptr<aux::session_impl> m_impl;
};
@@ -165,26 +177,47 @@
{
public:
- // If the fingerprint in the first overload is omited, the client will get
- // a default fingerprint stating the version of libtorrent. The
- // fingerprint is a short string that will be used in the peer-id to
- // identify the client and the client's version. For more details see the
- // fingerprint class.
+ // Constructs the session obects which acts as the container of torrents.
+ // It provides configuration options across torrents (such as rate limits,
+ // disk cache, ip filter etc.). In order to avoid a race condition between
+ // starting the session and configuring it, you can pass in a
+ // settings_pack object. Its settings will take effect before the session
+ // starts up.
//
- // The flags parameter can be used to start default features (upnp &
+ // The ``flags`` parameter can be used to start default features (upnp &
// nat-pmp) and default plugins (ut_metadata, ut_pex and smart_ban). The
// default is to start those features. If you do not want them to start,
// pass 0 as the flags parameter.
+ session(settings_pack const& pack
+ , int flags = start_default_features | add_default_plugins)
+ {
+ TORRENT_CFG();
+ start(flags, pack, NULL);
+ }
+
+ // overload of the constructor that takes an external io_service to run
+ // the session object on. This is primarily useful for tests that may want
+ // to run multiple sessions on a single io_service, or low resource
+ // systems where additional threads are expensive and sharing an
+ // io_service with other events is fine.
//
- // The ``alert_mask`` is the same mask that you would send to
- // set_alert_mask().
-
+ // .. warning::
+ // The session object does not cleanly terminate with an external
+ // io_service. The io_service::run() call _must_ have returned before
+ // it's safe to destruct the session. Which means you *MUST* call
+ // session::abort() and save the session_proxy first, then destruct the
+ // session object, then sync withthe io_service, then destruct the
+ // session_proxy object.
session(settings_pack const& pack
+ , io_service& ios
, int flags = start_default_features | add_default_plugins)
{
TORRENT_CFG();
- start(flags, pack);
+ start(flags, pack, &ios);
}
+
+#ifndef TORRENT_NO_DEPRECATE
+ TORRENT_DEPRECATED
session(fingerprint const& print = fingerprint("LT"
, LIBTORRENT_VERSION_MAJOR, LIBTORRENT_VERSION_MINOR, 0, 0)
, int flags = start_default_features | add_default_plugins
@@ -192,9 +225,6 @@
{
TORRENT_CFG();
settings_pack pack;
- // TODO: 2 the two second constructors here should probably
- // be deprecated in favor of the more generic one that just
- // takes a settings_pack and a string
pack.set_int(settings_pack::alert_mask, alert_mask);
pack.set_str(settings_pack::peer_fingerprint, print.to_string());
if ((flags & start_default_features) == 0)
@@ -205,8 +235,10 @@
pack.set_bool(settings_pack::enable_dht, false);
}
- start(flags, pack);
+ start(flags, pack, NULL);
}
+
+ TORRENT_DEPRECATED
session(fingerprint const& print
, std::pair<int, int> listen_port_range
, char const* listen_interface = "0.0.0.0"
@@ -232,8 +264,9 @@
pack.set_bool(settings_pack::enable_lsd, false);
pack.set_bool(settings_pack::enable_dht, false);
}
- start(flags, pack);
+ start(flags, pack, NULL);
}
+#endif // TORRENT_NO_DEPRECATE
// The destructor of session will notify all trackers that our torrents
// have been shut down. If some trackers are down, they will time out.
@@ -432,7 +465,7 @@
// session_proxy();
// ~session_proxy()
// };
- session_proxy abort() { return session_proxy(m_impl); }
+ session_proxy abort() { return session_proxy(m_io_service, m_thread, m_impl); }
// Pausing the session has the same effect as pausing every torrent in
// it, except that torrents will not be resumed by the auto-manage
@@ -1218,10 +1251,12 @@
private:
- void start(int flags, settings_pack const& pack);
+ void start(int flags, settings_pack const& pack, io_service* ios);
// data shared between the main thread
// and the working thread
+ boost::shared_ptr<io_service> m_io_service;
+ boost::shared_ptr<thread> m_thread;
boost::shared_ptr<aux::session_impl> m_impl;
};
Modified: trunk/src/session.cpp
===================================================================
--- trunk/src/session.cpp 2015-06-03 02:37:59 UTC (rev 11147)
+++ trunk/src/session.cpp 2015-06-03 03:04:44 UTC (rev 11148)
@@ -389,7 +389,7 @@
{ throw; }
#endif
- void session::start(int flags, settings_pack const& pack)
+ void session::start(int flags, settings_pack const& pack, io_service* ios)
{
#if defined _MSC_VER && defined TORRENT_DEBUG
// workaround for microsofts
@@ -398,7 +398,17 @@
::_set_se_translator(straight_to_debugger);
#endif
- m_impl.reset(new session_impl());
+ bool internal_executor = ios == NULL;
+
+ if (internal_executor)
+ {
+ // the user did not provide an executor, we have to use our own
+ m_io_service = boost::make_shared<io_service>();
+ ios = m_io_service.get();
+ }
+
+ m_impl = boost::make_shared<session_impl>(boost::ref(*ios));
+
#ifndef TORRENT_DISABLE_EXTENSIONS
if (flags & add_default_plugins)
{
@@ -409,6 +419,13 @@
#endif
m_impl->start_session(pack);
+
+ if (internal_executor)
+ {
+ // start a thread for the message pump
+ m_thread = boost::make_shared<thread>(boost::bind(&io_service::run
+ , m_io_service.get()));
+ }
}
session::~session()
@@ -416,13 +433,10 @@
aux::dump_call_profile();
TORRENT_ASSERT(m_impl);
- // if there is at least one destruction-proxy
- // abort the session and let the destructor
- // of the proxy to syncronize
- if (!m_impl.unique())
- {
- TORRENT_ASYNC_CALL(abort);
- }
+ TORRENT_ASYNC_CALL(abort);
+
+ if (m_thread && m_thread.unique())
+ m_thread->join();
}
void session::save_state(entry& e, boost::uint32_t flags) const
@@ -1278,5 +1292,10 @@
session_settings::~session_settings() {}
#endif // TORRENT_NO_DEPRECATE
+ session_proxy::~session_proxy()
+ {
+ if (m_thread && m_thread.unique())
+ m_thread->join();
+ }
}
Modified: trunk/src/session_impl.cpp
===================================================================
--- trunk/src/session_impl.cpp 2015-06-03 02:37:59 UTC (rev 11147)
+++ trunk/src/session_impl.cpp 2015-06-03 03:04:44 UTC (rev 11148)
@@ -336,13 +336,13 @@
}
#endif
- session_impl::session_impl()
+ session_impl::session_impl(io_service& ios)
:
#ifndef TORRENT_DISABLE_POOL_ALLOCATOR
m_send_buffers(send_buffer_size())
,
#endif
- m_io_service()
+ m_io_service(ios)
#ifdef TORRENT_USE_OPENSSL
, m_ssl_ctx(m_io_service, asio::ssl::context::sslv23)
#endif
@@ -548,18 +548,54 @@
#endif
boost::shared_ptr<settings_pack> copy = boost::make_shared<settings_pack>(pack);
- m_io_service.post(boost::bind(&session_impl::apply_settings_pack, this, copy));
- // call update_* after settings set initialized
- m_io_service.post(boost::bind(&session_impl::init_settings, this));
+ m_io_service.post(boost::bind(&session_impl::init, this, copy));
+ }
+ void session_impl::init(boost::shared_ptr<settings_pack> pack)
+ {
+ // this is a debug facility
+ // see single_threaded in debug.hpp
+ thread_started();
+
+ TORRENT_ASSERT(is_single_thread());
+
#ifndef TORRENT_DISABLE_LOGGING
- session_log(" spawning network thread");
+ session_log(" *** session thread init");
#endif
- m_thread.reset(new thread(boost::bind(&session_impl::main_thread, this)));
- }
- void session_impl::init_settings()
- {
+ // this is where we should set up all async operations. This
+ // is called from within the network thread as opposed to the
+ // constructor which is called from the main thread
+
+#if defined TORRENT_ASIO_DEBUGGING
+ async_inc_threads();
+ add_outstanding_async("session_impl::on_tick");
+#endif
+ error_code ec;
+ m_io_service.post(boost::bind(&session_impl::on_tick, this, ec));
+
+#if defined TORRENT_ASIO_DEBUGGING
+ add_outstanding_async("session_impl::on_lsd_announce");
+#endif
+ int delay = (std::max)(m_settings.get_int(settings_pack::local_service_announce_interval)
+ / (std::max)(int(m_torrents.size()), 1), 1);
+ m_lsd_announce_timer.expires_from_now(seconds(delay), ec);
+ m_lsd_announce_timer.async_wait(
+ boost::bind(&session_impl::on_lsd_announce, this, _1));
+ TORRENT_ASSERT(!ec);
+
+#ifndef TORRENT_DISABLE_DHT
+ update_dht_announce_interval();
+#endif
+
+#ifndef TORRENT_DISABLE_LOGGING
+ session_log(" done starting session");
+#endif
+
+ apply_settings_pack(pack);
+
+ // call update_* after settings set initialized
+
#ifndef TORRENT_NO_DEPRECATE
update_local_download_rate();
update_local_upload_rate();
@@ -641,42 +677,6 @@
}
}
- void session_impl::init()
- {
-#ifndef TORRENT_DISABLE_LOGGING
- session_log(" *** session thread init");
-#endif
-
- // this is where we should set up all async operations. This
- // is called from within the network thread as opposed to the
- // constructor which is called from the main thread
-
-#if defined TORRENT_ASIO_DEBUGGING
- async_inc_threads();
- add_outstanding_async("session_impl::on_tick");
-#endif
- error_code ec;
- m_io_service.post(boost::bind(&session_impl::on_tick, this, ec));
-
-#if defined TORRENT_ASIO_DEBUGGING
- add_outstanding_async("session_impl::on_lsd_announce");
-#endif
- int delay = (std::max)(m_settings.get_int(settings_pack::local_service_announce_interval)
- / (std::max)(int(m_torrents.size()), 1), 1);
- m_lsd_announce_timer.expires_from_now(seconds(delay), ec);
- m_lsd_announce_timer.async_wait(
- boost::bind(&session_impl::on_lsd_announce, this, _1));
- TORRENT_ASSERT(!ec);
-
-#ifndef TORRENT_DISABLE_DHT
- update_dht_announce_interval();
-#endif
-
-#ifndef TORRENT_DISABLE_LOGGING
- session_log(" done starting session");
-#endif
- }
-
void session_impl::save_state(entry* eptr, boost::uint32_t flags) const
{
TORRENT_ASSERT(is_single_thread());
@@ -1075,6 +1075,9 @@
// has an internal counter and won't release the network
// thread until they're all dead (via m_work).
m_disk_thread.set_num_threads(0, false);
+
+ // now it's OK for the network thread to exit
+ m_work.reset();
}
bool session_impl::has_connection(peer_connection* p) const
@@ -3988,88 +3991,6 @@
m_delayed_uncorks.clear();
}
-#if defined _MSC_VER && defined TORRENT_DEBUG
- static void straight_to_debugger(unsigned int, _EXCEPTION_POINTERS*)
- { throw; }
-#endif
-
- void session_impl::main_thread()
- {
-#if defined _MSC_VER && defined TORRENT_DEBUG
- // workaround for microsofts
- // hardware exceptions that makes
- // it hard to debug stuff
- ::_set_se_translator(straight_to_debugger);
-#endif
- // this is a debug facility
- // see single_threaded in debug.hpp
- thread_started();
-
- TORRENT_ASSERT(is_single_thread());
-
- // initialize async operations
- init();
-
- bool stop_loop = false;
- while (!stop_loop)
- {
- error_code ec;
- m_io_service.run(ec);
- if (ec)
- {
-#ifdef TORRENT_DEBUG
- fprintf(stderr, "%s\n", ec.message().c_str());
- std::string err = ec.message();
-#endif
- TORRENT_ASSERT(false);
- }
- m_io_service.reset();
-
- stop_loop = m_abort;
- }
-
-#ifndef TORRENT_DISABLE_LOGGING
- session_log(" locking mutex");
-#endif
-
-/*
-#ifdef TORRENT_DEBUG
- for (torrent_map::iterator i = m_torrents.begin();
- i != m_torrents.end(); ++i)
- {
- TORRENT_ASSERT(i->second->num_peers() == 0);
- }
-#endif
-*/
-#ifndef TORRENT_DISABLE_LOGGING
- session_log(" cleaning up torrents");
-#endif
-
- // clear the torrent LRU (probably not strictly necessary)
- list_node* i = m_torrent_lru.get_all();
-#if TORRENT_USE_ASSERTS
- // clear the prev and next pointers in all torrents
- // to avoid the assert when destructing them
- while (i)
- {
- list_node* tmp = i;
- i = i->next;
- tmp->next = NULL;
- tmp->prev= NULL;
- }
-#else
- TORRENT_UNUSED(i);
-#endif
- m_torrents.clear();
-
- TORRENT_ASSERT(m_torrents.empty());
- TORRENT_ASSERT(m_connections.empty());
-
-#if TORRENT_USE_ASSERTS && defined BOOST_HAS_PTHREADS
- m_network_thread = 0;
-#endif
- }
-
boost::shared_ptr<torrent> session_impl::delay_load_torrent(sha1_hash const& info_hash
, peer_connection* pc)
{
@@ -5623,11 +5544,6 @@
// this is not allowed to be the network thread!
TORRENT_ASSERT(is_not_thread());
- m_io_service.post(boost::bind(&session_impl::abort, this));
-
- // now it's OK for the network thread to exit
- m_work.reset();
-
#if defined TORRENT_ASIO_DEBUGGING
int counter = 0;
while (log_async())
@@ -5640,12 +5556,8 @@
async_dec_threads();
fprintf(stderr, "\n\nEXPECTS NO MORE ASYNC OPS\n\n\n");
-
-// m_io_service.post(boost::bind(&io_service::stop, &m_io_service));
#endif
- if (m_thread) m_thread->join();
-
m_udp_socket.unsubscribe(this);
m_udp_socket.unsubscribe(&m_utp_socket_manager);
m_udp_socket.unsubscribe(&m_tracker_manager);
@@ -5684,6 +5596,22 @@
fclose(f);
}
#endif
+
+ // clear the torrent LRU. We do this to avoid having the torrent
+ // destructor assert because it's still linked into the lru list
+#if TORRENT_USE_ASSERTS
+ list_node* i = m_torrent_lru.get_all();
+ // clear the prev and next pointers in all torrents
+ // to avoid the assert when destructing them
+ while (i)
+ {
+ list_node* tmp = i;
+ i = i->next;
+ tmp->next = NULL;
+ tmp->prev = NULL;
+ }
+#endif
+
}
#ifndef TORRENT_NO_DEPRECATE
@@ -5944,9 +5872,6 @@
m_pending_auto_manage = true;
m_need_auto_manage = true;
- // if we haven't started yet, don't actually trigger this
- if (!m_thread) return;
-
m_io_service.post(boost::bind(&session_impl::on_trigger_auto_manage, this));
}
@@ -5998,15 +5923,6 @@
m_dht_interval_update_torrents = m_torrents.size();
- // if we haven't started yet, don't actually trigger this
- if (!m_thread)
- {
-#ifndef TORRENT_DISABLE_LOGGING
- session_log("not starting DHT announce timer: thread not running yet");
-#endif
- return;
- }
-
if (m_abort)
{
#ifndef TORRENT_DISABLE_LOGGING
@@ -6044,9 +5960,6 @@
if (!m_settings.get_bool(settings_pack::force_proxy)) return;
- // if we haven't started yet, don't actually trigger this
- if (!m_thread) return;
-
// enable force_proxy mode. We don't want to accept any incoming
// connections, except through a proxy.
stop_lsd();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ar...@us...> - 2015-06-03 02:38:02
|
Revision: 11147
http://sourceforge.net/p/libtorrent/code/11147
Author: arvidn
Date: 2015-06-03 02:37:59 +0000 (Wed, 03 Jun 2015)
Log Message:
-----------
improve test_tracker
Modified Paths:
--------------
trunk/test/test_tracker.cpp
trunk/test/udp_tracker.cpp
Modified: trunk/test/test_tracker.cpp
===================================================================
--- trunk/test/test_tracker.cpp 2015-06-02 23:43:14 UTC (rev 11146)
+++ trunk/test/test_tracker.cpp 2015-06-03 02:37:59 UTC (rev 11147)
@@ -44,7 +44,18 @@
using namespace libtorrent;
namespace lt = libtorrent;
-void test_parse_hostname_peers()
+// TODO: test parse peers6
+// TODO: test parse tracker-id
+// TODO: test parse failure-reason
+// TODO: test all failure paths, including
+// invalid bencoding
+// not a dictionary
+// no files entry in scrape response
+// no info-hash entry in scrape response
+// malformed peers in peer list of dictionaries
+// uneven number of bytes in peers and peers6 string responses
+
+TORRENT_TEST(parse_hostname_peers)
{
char const response[] = "d5:peersld7:peer id20:aaaaaaaaaaaaaaaaaaaa2:ip13:test_hostname4:porti1000eed7:peer id20:bbbbabaababababababa2:ip12:another_host4:porti1001eeee";
error_code ec;
@@ -67,7 +78,7 @@
}
}
-void test_parse_peers4()
+TORRENT_TEST(parse_peers4)
{
char const response[] = "d5:peers12:\x01\x02\x03\x04\x30\x10"
"\x09\x08\x07\x06\x20\x10" "e";
@@ -89,7 +100,7 @@
}
}
-void test_parse_interval()
+TORRENT_TEST(parse_interval)
{
char const response[] = "d8:intervali1042e12:min intervali10e5:peers0:e";
error_code ec;
@@ -103,7 +114,7 @@
TEST_EQUAL(resp.min_interval, 10);
}
-void test_parse_warning()
+TORRENT_TEST(parse_warning)
{
char const response[] = "d5:peers0:15:warning message12:test messagee";
error_code ec;
@@ -115,7 +126,7 @@
TEST_EQUAL(resp.warning_message, "test message");
}
-void test_parse_failure_reason()
+TORRENT_TEST(parse_failure_reason)
{
char const response[] = "d5:peers0:14:failure reason12:test messagee";
error_code ec;
@@ -127,7 +138,7 @@
TEST_EQUAL(resp.failure_reason, "test message");
}
-void test_parse_scrape_response()
+TORRENT_TEST(parse_scrape_response)
{
char const response[] = "d5:filesd20:aaaaaaaaaaaaaaaaaaaad8:completei1e10:incompletei2e10:downloadedi3e11:downloadersi6eeee";
error_code ec;
@@ -141,7 +152,7 @@
TEST_EQUAL(resp.downloaders, 6);
}
-void test_parse_scrape_response_with_zero()
+TORRENT_TEST(parse_scrape_response_with_zero)
{
char const response[] = "d5:filesd20:aaa\0aaaaaaaaaaaaaaaad8:completei4e10:incompletei5e10:downloadedi6eeee";
error_code ec;
@@ -155,7 +166,7 @@
TEST_EQUAL(resp.downloaders, -1);
}
-void test_parse_external_ip()
+TORRENT_TEST(parse_external_ip)
{
char const response[] = "d5:peers0:11:external ip4:\x01\x02\x03\x04" "e";
error_code ec;
@@ -168,7 +179,7 @@
}
#if TORRENT_USE_IPV6
-void test_parse_external_ip6()
+TORRENT_TEST(parse_external_ip6)
{
char const response[] = "d5:peers0:11:external ip16:\xf1\x02\x03\x04\0\0\0\0\0\0\0\0\0\0\xff\xff" "e";
error_code ec;
@@ -195,7 +206,7 @@
return result;
}
-void test_extract_peer()
+TORRENT_TEST(extract_peer)
{
{
peer_entry result = extract_peer("d7:peer id20:abababababababababab2:ip4:abcd4:porti1337ee"
@@ -234,43 +245,21 @@
}
}
-TORRENT_TEST(traccker)
+int const alert_mask = alert::all_categories
+ & ~alert::progress_notification
+ & ~alert::stats_notification;
+
+TORRENT_TEST(udp_tracker)
{
- test_extract_peer();
- test_parse_hostname_peers();
- test_parse_peers4();
- test_parse_interval();
- test_parse_warning();
- test_parse_failure_reason();
- test_parse_scrape_response();
- test_parse_scrape_response_with_zero();
- test_parse_external_ip();
-#if TORRENT_USE_IPV6
- test_parse_external_ip6();
-#endif
-
- // TODO: test parse peers6
- // TODO: test parse tracker-id
- // TODO: test parse failure-reason
- // TODO: test all failure paths, including
- // invalid bencoding
- // not a dictionary
- // no files entry in scrape response
- // no info-hash entry in scrape response
- // malformed peers in peer list of dictionaries
- // uneven number of bytes in peers and peers6 string responses
-
int http_port = start_web_server();
int udp_port = start_udp_tracker();
int prev_udp_announces = num_udp_announces();
- int const alert_mask = alert::all_categories
- & ~alert::progress_notification
- & ~alert::stats_notification;
+ boost::scoped_ptr<lt::session> s(new lt::session(
+ fingerprint("LT", 0, 1, 0, 0)
+ , std::make_pair(48875, 49800), "0.0.0.0", 0, alert_mask));
- lt::session* s = new lt::session(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48875, 49800), "0.0.0.0", 0, alert_mask);
-
settings_pack pack;
#ifndef TORRENT_NO_DEPRECATE
pack.set_int(settings_pack::half_open_limit, 1);
@@ -316,19 +305,28 @@
TEST_EQUAL(num_udp_announces(), prev_udp_announces + 1);
fprintf(stderr, "destructing session\n");
- delete s;
+ s.reset();
fprintf(stderr, "done\n");
// we should have announced the stopped event now
TEST_EQUAL(num_udp_announces(), prev_udp_announces + 2);
+}
- // ========================================
- // test that we move on to try the next tier if the first one fails
- // ========================================
+// ========================================
+// test that we move on to try the next tier if the first one fails
+// ========================================
- s = new lt::session(fingerprint("LT", 0, 1, 0, 0), std::make_pair(39775, 39800), "0.0.0.0", 0, alert_mask);
+TORRENT_TEST(try_next)
+{
+ int http_port = start_web_server();
+ int udp_port = start_udp_tracker();
- pack.clear();
+ int prev_udp_announces = num_udp_announces();
+ boost::scoped_ptr<lt::session> s(
+ new lt::session(fingerprint("LT", 0, 1, 0, 0)
+ , std::make_pair(39775, 39800), "0.0.0.0", 0, alert_mask));
+
+ settings_pack pack;
#ifndef TORRENT_NO_DEPRECATE
pack.set_int(settings_pack::half_open_limit, 1);
#endif
@@ -338,13 +336,15 @@
pack.set_int(settings_pack::tracker_receive_timeout, 1);
s->apply_settings(pack);
+ error_code ec;
remove_all("tmp2_tracker", ec);
create_directory("tmp2_tracker", ec);
- file.open(combine_path("tmp2_tracker", "temporary").c_str());
- t = ::create_torrent(&file, 16 * 1024, 13, false);
+ std::ofstream file(combine_path("tmp2_tracker", "temporary").c_str());
+ boost::shared_ptr<torrent_info> t = ::create_torrent(&file, 16 * 1024, 13, false);
file.close();
// this should fail
+ char tracker_url[200];
snprintf(tracker_url, sizeof(tracker_url), "udp://www1.non-existent.com:80/announce");
t->add_tracker(tracker_url, 0);
@@ -364,12 +364,13 @@
prev_udp_announces = num_udp_announces();
+ add_torrent_params addp;
addp.flags &= ~add_torrent_params::flag_paused;
addp.flags &= ~add_torrent_params::flag_auto_managed;
addp.flags |= add_torrent_params::flag_seed_mode;
addp.ti = t;
addp.save_path = "tmp2_tracker";
- h = s->add_torrent(addp);
+ torrent_handle h = s->add_torrent(addp);
for (int i = 0; i < 50; ++i)
{
@@ -386,7 +387,7 @@
TEST_EQUAL(num_udp_announces(), prev_udp_announces + 1);
fprintf(stderr, "destructing session\n");
- delete s;
+ s.reset();
fprintf(stderr, "done\n");
fprintf(stderr, "stop_tracker\n");
Modified: trunk/test/udp_tracker.cpp
===================================================================
--- trunk/test/udp_tracker.cpp 2015-06-02 23:43:14 UTC (rev 11146)
+++ trunk/test/udp_tracker.cpp 2015-06-03 02:37:59 UTC (rev 11147)
@@ -188,7 +188,7 @@
void thread_fun()
{
char buffer[2000];
-
+
error_code ec;
udp::endpoint from;
m_socket.async_receive_from(
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ar...@us...> - 2015-06-02 23:43:17
|
Revision: 11146
http://sourceforge.net/p/libtorrent/code/11146
Author: arvidn
Date: 2015-06-02 23:43:14 +0000 (Tue, 02 Jun 2015)
Log Message:
-----------
whitespace
Modified Paths:
--------------
branches/RC_1_0/include/libtorrent/bencode.hpp
branches/RC_1_0/src/entry.cpp
Modified: branches/RC_1_0/include/libtorrent/bencode.hpp
===================================================================
--- branches/RC_1_0/include/libtorrent/bencode.hpp 2015-06-02 03:06:48 UTC (rev 11145)
+++ branches/RC_1_0/include/libtorrent/bencode.hpp 2015-06-02 23:43:14 UTC (rev 11146)
@@ -256,11 +256,11 @@
// integer
case 'i':
{
- ++in; // 'i'
+ ++in; // 'i'
std::string val = read_until(in, end, 'e', err);
if (err) return;
TORRENT_ASSERT(*in == 'e');
- ++in; // 'e'
+ ++in; // 'e'
ret = entry(entry::int_t);
char* end_pointer;
ret.integer() = strtoll(val.c_str(), &end_pointer, 10);
@@ -319,7 +319,7 @@
entry key;
bdecode_recursive(in, end, key, err, depth + 1);
if (err || key.type() != entry::string_t)
- {
+ {
#ifdef TORRENT_DEBUG
ret.m_type_queried = false;
#endif
@@ -390,7 +390,7 @@
}
}
}
-
+
// These functions will encode data to bencoded_ or decode bencoded_ data.
//
// If possible, lazy_bdecode() should be preferred over ``bdecode()``.
Modified: branches/RC_1_0/src/entry.cpp
===================================================================
--- branches/RC_1_0/src/entry.cpp 2015-06-02 03:06:48 UTC (rev 11145)
+++ branches/RC_1_0/src/entry.cpp 2015-06-02 23:43:14 UTC (rev 11146)
@@ -110,7 +110,7 @@
if (i == dict().end()) return 0;
return &i->second;
}
-
+
entry* entry::find_key(std::string const& key)
{
dictionary_type::iterator i = dict().find(key);
@@ -124,7 +124,7 @@
if (i == dict().end()) return 0;
return &i->second;
}
-
+
#ifndef BOOST_NO_EXCEPTIONS
const entry& entry::operator[](char const* key) const
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ar...@us...> - 2015-06-02 03:06:51
|
Revision: 11145
http://sourceforge.net/p/libtorrent/code/11145
Author: arvidn
Date: 2015-06-02 03:06:48 +0000 (Tue, 02 Jun 2015)
Log Message:
-----------
add some bdecoding unit tests
Modified Paths:
--------------
trunk/src/bdecode.cpp
trunk/test/test_bdecode.cpp
trunk/test/test_bencoding.cpp
trunk/test/test_heterogeneous_queue.cpp
Modified: trunk/src/bdecode.cpp
===================================================================
--- trunk/src/bdecode.cpp 2015-06-02 01:29:05 UTC (rev 11144)
+++ trunk/src/bdecode.cpp 2015-06-02 03:06:48 UTC (rev 11145)
@@ -836,7 +836,10 @@
start = parse_int(start, end, ':', len, e);
if (e)
TORRENT_FAIL_BDECODE(e);
- if (start + len + 1 > end)
+
+ // remaining buffer size excluding ':'
+ const ptrdiff_t buff_size = end - start - 1;
+ if (len > buff_size)
TORRENT_FAIL_BDECODE(bdecode_errors::unexpected_eof);
if (len < 0)
TORRENT_FAIL_BDECODE(bdecode_errors::overflow);
Modified: trunk/test/test_bdecode.cpp
===================================================================
--- trunk/test/test_bdecode.cpp 2015-06-02 01:29:05 UTC (rev 11144)
+++ trunk/test/test_bdecode.cpp 2015-06-02 03:06:48 UTC (rev 11145)
@@ -721,6 +721,27 @@
TEST_EQUAL(e, b + 18);
}
+TORRENT_TEST(parse_length_overflow)
+{
+ char const* b[] = {
+ "d1:a1919191010:11111",
+ "d2143289344:a4:aaaae",
+ "d214328934114:a4:aaaae",
+ "d9205357638345293824:a4:aaaae",
+ "d1:a9205357638345293824:11111",
+ };
+
+ for (int i = 0; i < sizeof(b)/sizeof(b[0]); ++i)
+ {
+ error_code ec;
+ bdecode_node e;
+ int ret = bdecode(b[i], b[i] + strlen(b[i]), e, ec);
+ TEST_EQUAL(ret, -1);
+ TEST_CHECK(ec == error_code(bdecode_errors::unexpected_eof));
+ }
+}
+
+
TORRENT_TEST(expected_colon_string)
{
char b[] = "928";
Modified: trunk/test/test_bencoding.cpp
===================================================================
--- trunk/test/test_bencoding.cpp 2015-06-02 01:29:05 UTC (rev 11144)
+++ trunk/test/test_bencoding.cpp 2015-06-02 03:06:48 UTC (rev 11145)
@@ -585,6 +585,28 @@
char const* e = parse_int(b, b + sizeof(b)-1, ':', val, ec);
TEST_CHECK(ec == bdecode_errors::expected_colon);
}
+
+ {
+ char const* b[] = {
+ "d1:a1919191010:11111",
+ "d2143289344:a4:aaaae",
+ "d214328934114:a4:aaaae",
+ "d9205357638345293824:a4:aaaae",
+ "d1:a9205357638345293824:11111",
+ };
+
+ for (int i = 0; i < sizeof(b)/sizeof(b[0]); ++i)
+ {
+ lazy_entry e;
+ error_code ec;
+ int ret = lazy_bdecode(b[i], b[i] + strlen(b[i]), e, ec, NULL);
+ TEST_EQUAL(ret, -1);
+ TEST_CHECK(ec == error_code(bdecode_errors::unexpected_eof));
+ printf("%s\n", print_entry(e).c_str());
+ }
+ }
+
+
#endif // TORRENT_NO_DEPRECATE
}
Modified: trunk/test/test_heterogeneous_queue.cpp
===================================================================
--- trunk/test/test_heterogeneous_queue.cpp 2015-06-02 01:29:05 UTC (rev 11144)
+++ trunk/test/test_heterogeneous_queue.cpp 2015-06-02 03:06:48 UTC (rev 11145)
@@ -102,6 +102,7 @@
, f(f_.f)
, constructed(f_.constructed)
, destructed(f_.destructed)
+ , gutted(f_.gutted)
{
TEST_EQUAL(f_.constructed, true);
TEST_EQUAL(f_.destructed, false);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ar...@us...> - 2015-06-02 01:29:08
|
Revision: 11144
http://sourceforge.net/p/libtorrent/code/11144
Author: arvidn
Date: 2015-06-02 01:29:05 +0000 (Tue, 02 Jun 2015)
Log Message:
-----------
merged fix from RC_1_0
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/lazy_bdecode.cpp
Property Changed:
----------------
trunk/
Index: trunk
===================================================================
--- trunk 2015-06-02 01:17:24 UTC (rev 11143)
+++ trunk 2015-06-02 01:29:05 UTC (rev 11144)
Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
## -1,5 +1,5 ##
/branches/RC_0_16:6640,6657,6662,6665,6669,6673-6675,6678,6684,6686,6688,6690,6692,6694-6695,6698,6700,6715,6936,6938,6946,6951,6956,6971,6974,6976,6979,7166,7200,7206,7258,7311,7314,7323,7333,7339,7348,7358,7371,7373,7375,7379,7395,7422,7433,7458,7461,7464,7466,7469,7471,7473,7480,7482,7487,7489,7492-7493,7497,7500,7507,7511,7514,7529,7536,7542,7546,7548-7549,7551,7553,7555,7560-7561,7564,7572,7577,7579,7587,7593-7594,7598-7599,7609,7611,7623-7624,7627,7633,7642,7644,7651,7667,7671,7675,7677,7681,7683,7685,7694,7699,7701,7704-7706,7711,7719,7729,7739,7752,7758,7760,7762,7765,7767,7771,7773,7784,7786,7788,7809,7814,7826,7828,7834,7838,7840,7847,7851,7853,7863-7864,7868,7870,7875,7884,7886,7890,7902,7905-7906,7909,7912,7914-7915,7925,7928,7930,7932,7934,7941,7947,7951,7955,7962,7964,7966,7971,7973,7984,7986,7988,7999,8002-8003,8005,8010,8012,8015,8017,8019,8021,8025,8041,8050,8066,8080,8082,8087,8091,8111,8130,8144,8171,8216,8221,8229,8235,8251,8288,8303,8331,8333,8340,8342,8345,8348,8357,8359-8361,8363,8371,8375,8382,8391,8393,8397,8399-8401,8416,8423,8426,8429,8431,8433,8436,8439,8445,8448,8452,8460,8462,8464,8466,8536,8564,8577,8580,8584,8587,8591,8605-8606,8612,8615,8619,8682,8693-8694,8696,8698,8700,8702,8704,8730,8732-8734,8760,8776-8777,8786,8797,8800,8815,8824,8826,8869,8884,8887,8917,8921-8922,8934,8936,8938,8943,8966,8971,8981-8982,8992,8994,8997,9000,9032-9033,9037,9046,9122,9127,9132,9154,9197,9204,9224,9232,9235,9237,9240,9253-9254,9260,9266-9267,9273,9285,9291,9294-9295,9297,9300,9333,9341,9343,9345,9347,9377,9408,9410,9414,9453,9480,9482,9487,9514,9520,9526,9530,9540,9543,9584,9616,9620,9627,9635,9652,9654,9661,9664,9684,9686,9691,9710,9716,9722,9729,9731,9738,9744,9752,9762,9766-9767,9772,9776,9779,9799,9805,9822,9826,9870,9872,9882,9889,9892,9894,9897,9947,9955,9994,10012,10017,10025,10134,10186,10189,10192,10195,10210,10214,10220,10223,10261,10289,10325,10338,10341,10344,10348,10391,10467,10576,10625,10629,10641
-/branches/RC_1_0:10069-11141
+/branches/RC_1_0:10069-11143
/branches/alert_queue:10881-10930
/branches/bdecoder:10825-10866
/branches/libtorrent_aio:4468-10083
\ No newline at end of property
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2015-06-02 01:17:24 UTC (rev 11143)
+++ trunk/ChangeLog 2015-06-02 01:29:05 UTC (rev 11144)
@@ -70,6 +70,7 @@
* almost completely changed the storage interface (for custom storage)
* added support for hashing pieces in multiple threads
+ * fix bound-checking issue in bdecoder
* expose missing dht_settings fields to python
* add function to query the DHT settings
* fix bug in 'dont_count_slow_torrents' feature, which would start too many
Modified: trunk/src/lazy_bdecode.cpp
===================================================================
--- trunk/src/lazy_bdecode.cpp 2015-06-02 01:17:24 UTC (rev 11143)
+++ trunk/src/lazy_bdecode.cpp 2015-06-02 01:29:05 UTC (rev 11144)
@@ -130,7 +130,9 @@
if (e)
TORRENT_FAIL_BDECODE(e);
- if (start + len + 1 > end)
+ // remaining buffer size excluding ':'
+ const ptrdiff_t buff_size = end - start - 1;
+ if (len > buff_size)
TORRENT_FAIL_BDECODE(bdecode_errors::unexpected_eof);
if (len < 0)
@@ -196,15 +198,19 @@
start = parse_int(start, end, ':', len, e);
if (e)
TORRENT_FAIL_BDECODE(e);
- if (start + len + 1 > end)
+
+ // remaining buffer size excluding ':'
+ const ptrdiff_t buff_size = end - start - 1;
+ if (len > buff_size)
TORRENT_FAIL_BDECODE(bdecode_errors::unexpected_eof);
if (len < 0)
TORRENT_FAIL_BDECODE(bdecode_errors::overflow);
++start;
+ if (start == end) TORRENT_FAIL_BDECODE(bdecode_errors::unexpected_eof);
top->construct_string(start, int(len));
+ start += len;
stack.pop_back();
- start += len;
break;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ar...@us...> - 2015-06-02 01:17:26
|
Revision: 11143
http://sourceforge.net/p/libtorrent/code/11143
Author: arvidn
Date: 2015-06-02 01:17:24 +0000 (Tue, 02 Jun 2015)
Log Message:
-----------
fix bound-checking issue in bdecoder
Modified Paths:
--------------
branches/RC_1_0/ChangeLog
branches/RC_1_0/src/lazy_bdecode.cpp
Modified: branches/RC_1_0/ChangeLog
===================================================================
--- branches/RC_1_0/ChangeLog 2015-06-02 01:14:52 UTC (rev 11142)
+++ branches/RC_1_0/ChangeLog 2015-06-02 01:17:24 UTC (rev 11143)
@@ -1,3 +1,4 @@
+ * fix bound-checking issue in bdecoder
* expose missing dht_settings fields to python
* add function to query the DHT settings
* fix bug in 'dont_count_slow_torrents' feature, which would start too many
Modified: branches/RC_1_0/src/lazy_bdecode.cpp
===================================================================
--- branches/RC_1_0/src/lazy_bdecode.cpp 2015-06-02 01:14:52 UTC (rev 11142)
+++ branches/RC_1_0/src/lazy_bdecode.cpp 2015-06-02 01:17:24 UTC (rev 11143)
@@ -160,7 +160,9 @@
if (e)
TORRENT_FAIL_BDECODE(e);
- if (start + len + 1 > end)
+ // remaining buffer size excluding ':'
+ const ptrdiff_t buff_size = end - start - 1;
+ if (len > buff_size)
TORRENT_FAIL_BDECODE(bdecode_errors::unexpected_eof);
if (len < 0)
@@ -226,15 +228,19 @@
start = parse_int(start, end, ':', len, e);
if (e)
TORRENT_FAIL_BDECODE(e);
- if (start + len + 1 > end)
+
+ // remaining buffer size excluding ':'
+ const ptrdiff_t buff_size = end - start - 1;
+ if (len > buff_size)
TORRENT_FAIL_BDECODE(bdecode_errors::unexpected_eof);
if (len < 0)
TORRENT_FAIL_BDECODE(bdecode_errors::overflow);
++start;
+ if (start == end) TORRENT_FAIL_BDECODE(bdecode_errors::unexpected_eof);
top->construct_string(start, int(len));
+ start += len;
stack.pop_back();
- start += len;
continue;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ar...@us...> - 2015-06-02 01:14:54
|
Revision: 11142
http://sourceforge.net/p/libtorrent/code/11142
Author: arvidn
Date: 2015-06-02 01:14:52 +0000 (Tue, 02 Jun 2015)
Log Message:
-----------
merged changes from RC_1_0
Modified Paths:
--------------
trunk/include/libtorrent/udp_socket.hpp
trunk/src/udp_socket.cpp
trunk/test/socks.py
trunk/test/test_transfer.cpp
Property Changed:
----------------
trunk/
Index: trunk
===================================================================
--- trunk 2015-06-02 00:42:01 UTC (rev 11141)
+++ trunk 2015-06-02 01:14:52 UTC (rev 11142)
Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
## -1,5 +1,5 ##
/branches/RC_0_16:6640,6657,6662,6665,6669,6673-6675,6678,6684,6686,6688,6690,6692,6694-6695,6698,6700,6715,6936,6938,6946,6951,6956,6971,6974,6976,6979,7166,7200,7206,7258,7311,7314,7323,7333,7339,7348,7358,7371,7373,7375,7379,7395,7422,7433,7458,7461,7464,7466,7469,7471,7473,7480,7482,7487,7489,7492-7493,7497,7500,7507,7511,7514,7529,7536,7542,7546,7548-7549,7551,7553,7555,7560-7561,7564,7572,7577,7579,7587,7593-7594,7598-7599,7609,7611,7623-7624,7627,7633,7642,7644,7651,7667,7671,7675,7677,7681,7683,7685,7694,7699,7701,7704-7706,7711,7719,7729,7739,7752,7758,7760,7762,7765,7767,7771,7773,7784,7786,7788,7809,7814,7826,7828,7834,7838,7840,7847,7851,7853,7863-7864,7868,7870,7875,7884,7886,7890,7902,7905-7906,7909,7912,7914-7915,7925,7928,7930,7932,7934,7941,7947,7951,7955,7962,7964,7966,7971,7973,7984,7986,7988,7999,8002-8003,8005,8010,8012,8015,8017,8019,8021,8025,8041,8050,8066,8080,8082,8087,8091,8111,8130,8144,8171,8216,8221,8229,8235,8251,8288,8303,8331,8333,8340,8342,8345,8348,8357,8359-8361,8363,8371,8375,8382,8391,8393,8397,8399-8401,8416,8423,8426,8429,8431,8433,8436,8439,8445,8448,8452,8460,8462,8464,8466,8536,8564,8577,8580,8584,8587,8591,8605-8606,8612,8615,8619,8682,8693-8694,8696,8698,8700,8702,8704,8730,8732-8734,8760,8776-8777,8786,8797,8800,8815,8824,8826,8869,8884,8887,8917,8921-8922,8934,8936,8938,8943,8966,8971,8981-8982,8992,8994,8997,9000,9032-9033,9037,9046,9122,9127,9132,9154,9197,9204,9224,9232,9235,9237,9240,9253-9254,9260,9266-9267,9273,9285,9291,9294-9295,9297,9300,9333,9341,9343,9345,9347,9377,9408,9410,9414,9453,9480,9482,9487,9514,9520,9526,9530,9540,9543,9584,9616,9620,9627,9635,9652,9654,9661,9664,9684,9686,9691,9710,9716,9722,9729,9731,9738,9744,9752,9762,9766-9767,9772,9776,9779,9799,9805,9822,9826,9870,9872,9882,9889,9892,9894,9897,9947,9955,9994,10012,10017,10025,10134,10186,10189,10192,10195,10210,10214,10220,10223,10261,10289,10325,10338,10341,10344,10348,10391,10467,10576,10625,10629,10641
-/branches/RC_1_0:10069-11138
+/branches/RC_1_0:10069-11141
/branches/alert_queue:10881-10930
/branches/bdecoder:10825-10866
/branches/libtorrent_aio:4468-10083
\ No newline at end of property
Modified: trunk/include/libtorrent/udp_socket.hpp
===================================================================
--- trunk/include/libtorrent/udp_socket.hpp 2015-06-02 00:42:01 UTC (rev 11141)
+++ trunk/include/libtorrent/udp_socket.hpp 2015-06-02 01:14:52 UTC (rev 11142)
@@ -139,6 +139,11 @@
struct queued_packet
{
+ queued_packet()
+ : hostname(NULL)
+ , flags(0)
+ {}
+
udp::endpoint ep;
char* hostname;
buffer buf;
Modified: trunk/src/udp_socket.cpp
===================================================================
--- trunk/src/udp_socket.cpp 2015-06-02 00:42:01 UTC (rev 11141)
+++ trunk/src/udp_socket.cpp 2015-06-02 01:14:52 UTC (rev 11142)
@@ -188,7 +188,7 @@
{
// send udp packets through SOCKS5 server
wrap(ep, p, len, ec);
- return;
+ return;
}
if (m_queue_packets)
@@ -556,13 +556,11 @@
iovec[1] = asio::const_buffer(p, len);
#if TORRENT_USE_IPV6
- if (m_udp_proxy_addr.address().is_v4() && m_ipv4_sock.is_open())
+ if (m_udp_proxy_addr.address().is_v6() && m_ipv6_sock.is_open())
+ m_ipv6_sock.send_to(iovec, m_udp_proxy_addr, 0, ec);
+ else
#endif
m_ipv4_sock.send_to(iovec, m_udp_proxy_addr, 0, ec);
-#if TORRENT_USE_IPV6
- else
- m_ipv6_sock.send_to(iovec, m_udp_proxy_addr, 0, ec);
-#endif
}
// unwrap the UDP packet from the SOCKS5 header
@@ -767,7 +765,7 @@
error_code ec;
m_socks5_sock.close(ec);
m_tunnel_packets = false;
-
+
m_proxy_settings = ps;
if (m_abort) return;
@@ -1269,7 +1267,7 @@
drain_queue();
return;
}
-
+
m_tunnel_packets = true;
drain_queue();
Modified: trunk/test/socks.py
===================================================================
--- trunk/test/socks.py 2015-06-02 00:42:01 UTC (rev 11141)
+++ trunk/test/socks.py 2015-06-02 01:14:52 UTC (rev 11142)
@@ -10,10 +10,10 @@
import sys
def debug(s):
- print >>sys.stderr, 'socks.py: ', s
+ print >>sys.stderr, 'socks.py: ', s
def error(s):
- print >>sys.stderr, 'socks.py, ERROR: ', s
+ print >>sys.stderr, 'socks.py, ERROR: ', s
class MyTCPServer(ThreadingTCPServer):
allow_reuse_address = True
@@ -27,6 +27,7 @@
NOAUTH = '\x00'
USERPASS = '\x02'
CONNECT = '\x01'
+UDP_ASSOCIATE = '\x03'
IPV4 = '\x01'
IPV6 = '\x04'
DOMAIN_NAME = '\x03'
@@ -90,8 +91,8 @@
if allow_v4 and version == '\x04':
cmd = self.read(1)
- if cmd != CONNECT:
- error('Only supports connect method not (%r) closing' % cmd)
+ if cmd != CONNECT and cmd != UDP_ASSOCIATE:
+ error('Only supports connect and udp-associate method not (%r) closing' % cmd)
self.close_request()
return
@@ -160,8 +161,8 @@
if version != '\x05':
error('Wrong version number (%r) closing...' % version)
self.close_request()
- elif cmd != CONNECT:
- error('Only supports connect method not (%r) closing' % cmd)
+ elif cmd != CONNECT and cmd != UDP_ASSOCIATE:
+ error('Only supports connect and udp-associate method not (%r) closing' % cmd)
self.close_request()
elif zero != '\x00':
error('Mangled request. Reserved field (%r) is not null' % zero)
@@ -193,6 +194,11 @@
except Exception, e:
print e
return
+
+ if cmd == UDP_ASSOCIATE:
+ debug("no UDP support yet, closing")
+ return;
+
debug("Creating forwarder connection to %s:%d" % (out_address[0], out_address[1]))
try:
Modified: trunk/test/test_transfer.cpp
===================================================================
--- trunk/test/test_transfer.cpp 2015-06-02 00:42:01 UTC (rev 11141)
+++ trunk/test/test_transfer.cpp 2015-06-02 01:14:52 UTC (rev 11142)
@@ -142,7 +142,7 @@
fprintf(stderr, "\n\n ==== TESTING %s proxy ==== disk-full: %s\n\n\n"
, test_name[proxy_type], test_disk_full ? "true": "false");
-
+
// in case the previous run was terminated
error_code ec;
remove_all("tmp1_transfer", ec);
@@ -381,7 +381,7 @@
fprintf(stderr, "compact mode\n");
test_transfer(0, p, false, storage_mode_compact);
#endif
-
+
error_code ec;
remove_all("tmp1_transfer", ec);
remove_all("tmp2_transfer", ec);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ar...@us...> - 2015-06-02 00:42:04
|
Revision: 11141
http://sourceforge.net/p/libtorrent/code/11141
Author: arvidn
Date: 2015-06-02 00:42:01 +0000 (Tue, 02 Jun 2015)
Log Message:
-----------
fix uninitialized pointer in udp_socket when forwarding packets to hostnames via socks5 proxy
Modified Paths:
--------------
branches/RC_1_0/include/libtorrent/udp_socket.hpp
branches/RC_1_0/src/udp_socket.cpp
Modified: branches/RC_1_0/include/libtorrent/udp_socket.hpp
===================================================================
--- branches/RC_1_0/include/libtorrent/udp_socket.hpp 2015-06-01 02:38:41 UTC (rev 11140)
+++ branches/RC_1_0/include/libtorrent/udp_socket.hpp 2015-06-02 00:42:01 UTC (rev 11141)
@@ -138,6 +138,11 @@
struct queued_packet
{
+ queued_packet()
+ : hostname(NULL)
+ , flags(0)
+ {}
+
udp::endpoint ep;
char* hostname;
buffer buf;
@@ -150,7 +155,7 @@
{
return m_v4_outstanding
#if TORRENT_USE_IPV6
- + m_v6_outstanding
+ + m_v6_outstanding
#endif
;
}
Modified: branches/RC_1_0/src/udp_socket.cpp
===================================================================
--- branches/RC_1_0/src/udp_socket.cpp 2015-06-01 02:38:41 UTC (rev 11140)
+++ branches/RC_1_0/src/udp_socket.cpp 2015-06-02 00:42:01 UTC (rev 11141)
@@ -558,13 +558,11 @@
iovec[1] = asio::const_buffer(p, len);
#if TORRENT_USE_IPV6
- if (m_udp_proxy_addr.address().is_v4() && m_ipv4_sock.is_open())
+ if (m_udp_proxy_addr.address().is_v6() && m_ipv6_sock.is_open())
+ m_ipv6_sock.send_to(iovec, m_udp_proxy_addr, 0, ec);
+ else
#endif
m_ipv4_sock.send_to(iovec, m_udp_proxy_addr, 0, ec);
-#if TORRENT_USE_IPV6
- else
- m_ipv6_sock.send_to(iovec, m_udp_proxy_addr, 0, ec);
-#endif
}
// unwrap the UDP packet from the SOCKS5 header
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ar...@us...> - 2015-06-01 02:38:44
|
Revision: 11140
http://sourceforge.net/p/libtorrent/code/11140
Author: arvidn
Date: 2015-06-01 02:38:41 +0000 (Mon, 01 Jun 2015)
Log Message:
-----------
attempt to make the socks5 proxy disconnect at a different time when issuing a udp associate command. the hope was to reproduce a bug, but it didn't
Modified Paths:
--------------
branches/RC_1_0/src/udp_socket.cpp
branches/RC_1_0/test/socks.py
branches/RC_1_0/test/test_transfer.cpp
Modified: branches/RC_1_0/src/udp_socket.cpp
===================================================================
--- branches/RC_1_0/src/udp_socket.cpp 2015-05-31 21:57:38 UTC (rev 11139)
+++ branches/RC_1_0/src/udp_socket.cpp 2015-06-01 02:38:41 UTC (rev 11140)
@@ -148,7 +148,7 @@
{
// send udp packets through SOCKS5 server
wrap(hostname, port, p, len, ec);
- return;
+ return;
}
// this function is only supported when we're using a proxy
@@ -192,7 +192,7 @@
{
// send udp packets through SOCKS5 server
wrap(ep, p, len, ec);
- return;
+ return;
}
if (m_queue_packets)
@@ -793,7 +793,7 @@
error_code ec;
m_socks5_sock.close(ec);
m_tunnel_packets = false;
-
+
m_proxy_settings = ps;
if (m_abort) return;
@@ -863,7 +863,7 @@
m_proxy_addr.address(i->endpoint().address());
m_proxy_addr.port(i->endpoint().port());
// on_connect may be called from within this thread
- // the semantics for on_connect and on_timeout is
+ // the semantics for on_connect and on_timeout is
// a bit complicated. See comments in connection_queue.hpp
// for more details. This semantic determines how and
// when m_outstanding_ops may be decremented
@@ -1387,7 +1387,7 @@
drain_queue();
return;
}
-
+
m_tunnel_packets = true;
drain_queue();
Modified: branches/RC_1_0/test/socks.py
===================================================================
--- branches/RC_1_0/test/socks.py 2015-05-31 21:57:38 UTC (rev 11139)
+++ branches/RC_1_0/test/socks.py 2015-06-01 02:38:41 UTC (rev 11140)
@@ -10,10 +10,10 @@
import sys
def debug(s):
- print >>sys.stderr, 'socks.py: ', s
+ print >>sys.stderr, 'socks.py: ', s
def error(s):
- print >>sys.stderr, 'socks.py, ERROR: ', s
+ print >>sys.stderr, 'socks.py, ERROR: ', s
class MyTCPServer(ThreadingTCPServer):
allow_reuse_address = True
@@ -27,6 +27,7 @@
NOAUTH = '\x00'
USERPASS = '\x02'
CONNECT = '\x01'
+UDP_ASSOCIATE = '\x03'
IPV4 = '\x01'
IPV6 = '\x04'
DOMAIN_NAME = '\x03'
@@ -90,8 +91,8 @@
if allow_v4 and version == '\x04':
cmd = self.read(1)
- if cmd != CONNECT:
- error('Only supports connect method not (%r) closing' % cmd)
+ if cmd != CONNECT and cmd != UDP_ASSOCIATE:
+ error('Only supports connect and udp-associate method not (%r) closing' % cmd)
self.close_request()
return
@@ -160,8 +161,8 @@
if version != '\x05':
error('Wrong version number (%r) closing...' % version)
self.close_request()
- elif cmd != CONNECT:
- error('Only supports connect method not (%r) closing' % cmd)
+ elif cmd != CONNECT and cmd != UDP_ASSOCIATE:
+ error('Only supports connect and udp-associate method not (%r) closing' % cmd)
self.close_request()
elif zero != '\x00':
error('Mangled request. Reserved field (%r) is not null' % zero)
@@ -193,6 +194,11 @@
except Exception, e:
print e
return
+
+ if cmd == UDP_ASSOCIATE:
+ debug("no UDP support yet, closing")
+ return;
+
debug("Creating forwarder connection to %s:%d" % (out_address[0], out_address[1]))
try:
Modified: branches/RC_1_0/test/test_transfer.cpp
===================================================================
--- branches/RC_1_0/test/test_transfer.cpp 2015-05-31 21:57:38 UTC (rev 11139)
+++ branches/RC_1_0/test/test_transfer.cpp 2015-06-01 02:38:41 UTC (rev 11140)
@@ -181,7 +181,7 @@
fprintf(stderr, "\n\n ==== TESTING %s proxy ==== disk-full: %s allow-fast: %s\n\n\n"
, test_name[proxy_type], test_disk_full ? "true": "false", test_allowed_fast ? "true" : "false");
-
+
// in case the previous run was terminated
error_code ec;
remove_all("tmp1_transfer", ec);
@@ -352,7 +352,7 @@
if (st2.state != torrent_status::downloading)
{
- static char const* state_str[] =
+ static char const* state_str[] =
{"checking (q)", "checking", "dl metadata"
, "downloading", "finished", "seeding", "allocating", "checking (r)"};
std::cerr << "st2 state: " << state_str[st2.state] << std::endl;
@@ -388,10 +388,10 @@
// test with all kinds of proxies
for (int i = 0; i < 6; ++i)
test_transfer(i);
-
+
// test with a (simulated) full disk
test_transfer(0, true, true);
-
+
// test allowed fast
test_transfer(0, false, true);
@@ -403,7 +403,7 @@
fprintf(stderr, "compact mode\n");
test_transfer(0, false, false, storage_mode_compact);
#endif
-
+
error_code ec;
remove_all("tmp1_transfer", ec);
remove_all("tmp2_transfer", ec);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ar...@us...> - 2015-05-31 21:57:40
|
Revision: 11139
http://sourceforge.net/p/libtorrent/code/11139
Author: arvidn
Date: 2015-05-31 21:57:38 +0000 (Sun, 31 May 2015)
Log Message:
-----------
merged changes from RC_1_0
Modified Paths:
--------------
trunk/include/libtorrent/extensions.hpp
trunk/include/libtorrent/session.hpp
Property Changed:
----------------
trunk/
Index: trunk
===================================================================
--- trunk 2015-05-31 21:32:18 UTC (rev 11138)
+++ trunk 2015-05-31 21:57:38 UTC (rev 11139)
Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
## -1,5 +1,5 ##
/branches/RC_0_16:6640,6657,6662,6665,6669,6673-6675,6678,6684,6686,6688,6690,6692,6694-6695,6698,6700,6715,6936,6938,6946,6951,6956,6971,6974,6976,6979,7166,7200,7206,7258,7311,7314,7323,7333,7339,7348,7358,7371,7373,7375,7379,7395,7422,7433,7458,7461,7464,7466,7469,7471,7473,7480,7482,7487,7489,7492-7493,7497,7500,7507,7511,7514,7529,7536,7542,7546,7548-7549,7551,7553,7555,7560-7561,7564,7572,7577,7579,7587,7593-7594,7598-7599,7609,7611,7623-7624,7627,7633,7642,7644,7651,7667,7671,7675,7677,7681,7683,7685,7694,7699,7701,7704-7706,7711,7719,7729,7739,7752,7758,7760,7762,7765,7767,7771,7773,7784,7786,7788,7809,7814,7826,7828,7834,7838,7840,7847,7851,7853,7863-7864,7868,7870,7875,7884,7886,7890,7902,7905-7906,7909,7912,7914-7915,7925,7928,7930,7932,7934,7941,7947,7951,7955,7962,7964,7966,7971,7973,7984,7986,7988,7999,8002-8003,8005,8010,8012,8015,8017,8019,8021,8025,8041,8050,8066,8080,8082,8087,8091,8111,8130,8144,8171,8216,8221,8229,8235,8251,8288,8303,8331,8333,8340,8342,8345,8348,8357,8359-8361,8363,8371,8375,8382,8391,8393,8397,8399-8401,8416,8423,8426,8429,8431,8433,8436,8439,8445,8448,8452,8460,8462,8464,8466,8536,8564,8577,8580,8584,8587,8591,8605-8606,8612,8615,8619,8682,8693-8694,8696,8698,8700,8702,8704,8730,8732-8734,8760,8776-8777,8786,8797,8800,8815,8824,8826,8869,8884,8887,8917,8921-8922,8934,8936,8938,8943,8966,8971,8981-8982,8992,8994,8997,9000,9032-9033,9037,9046,9122,9127,9132,9154,9197,9204,9224,9232,9235,9237,9240,9253-9254,9260,9266-9267,9273,9285,9291,9294-9295,9297,9300,9333,9341,9343,9345,9347,9377,9408,9410,9414,9453,9480,9482,9487,9514,9520,9526,9530,9540,9543,9584,9616,9620,9627,9635,9652,9654,9661,9664,9684,9686,9691,9710,9716,9722,9729,9731,9738,9744,9752,9762,9766-9767,9772,9776,9779,9799,9805,9822,9826,9870,9872,9882,9889,9892,9894,9897,9947,9955,9994,10012,10017,10025,10134,10186,10189,10192,10195,10210,10214,10220,10223,10261,10289,10325,10338,10341,10344,10348,10391,10467,10576,10625,10629,10641
-/branches/RC_1_0:10069-11127
+/branches/RC_1_0:10069-11138
/branches/alert_queue:10881-10930
/branches/bdecoder:10825-10866
/branches/libtorrent_aio:4468-10083
\ No newline at end of property
Modified: trunk/include/libtorrent/extensions.hpp
===================================================================
--- trunk/include/libtorrent/extensions.hpp 2015-05-31 21:32:18 UTC (rev 11138)
+++ trunk/include/libtorrent/extensions.hpp 2015-05-31 21:57:38 UTC (rev 11139)
@@ -357,7 +357,7 @@
// can add entries to the extension handshake
// this is not called for web seeds
virtual void add_handshake(entry&) {}
-
+
// called when the peer is being disconnected.
virtual void on_disconnect(error_code const& /*ec*/) {}
@@ -369,13 +369,13 @@
// throwing an exception from any of the handlers (except add_handshake)
// closes the connection
-
+
// this is called when the initial BT handshake is received. Returning false
// means that the other end doesn't support this extension and will remove
// it from the list of plugins.
// this is not called for web seeds
virtual bool on_handshake(char const* /*reserved_bits*/) { return true; }
-
+
// called when the extension handshake from the other end is received
// if this returns false, it means that this extension isn't
// supported by this peer. It will result in this peer_plugin
Modified: trunk/include/libtorrent/session.hpp
===================================================================
--- trunk/include/libtorrent/session.hpp 2015-05-31 21:32:18 UTC (rev 11138)
+++ trunk/include/libtorrent/session.hpp 2015-05-31 21:57:38 UTC (rev 11139)
@@ -165,13 +165,13 @@
{
public:
- // If the fingerprint in the first overload is omited, the client will
- // get a default fingerprint stating the version of libtorrent. The
+ // If the fingerprint in the first overload is omited, the client will get
+ // a default fingerprint stating the version of libtorrent. The
// fingerprint is a short string that will be used in the peer-id to
// identify the client and the client's version. For more details see the
// fingerprint class.
//
- // The flags paramater can be used to start default features (upnp &
+ // The flags parameter can be used to start default features (upnp &
// nat-pmp) and default plugins (ut_metadata, ut_pex and smart_ban). The
// default is to start those features. If you do not want them to start,
// pass 0 as the flags parameter.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ar...@us...> - 2015-05-31 21:32:20
|
Revision: 11138
http://sourceforge.net/p/libtorrent/code/11138
Author: arvidn
Date: 2015-05-31 21:32:18 +0000 (Sun, 31 May 2015)
Log Message:
-----------
fix documentation bug in session constructor
Modified Paths:
--------------
branches/RC_1_0/include/libtorrent/session.hpp
Modified: branches/RC_1_0/include/libtorrent/session.hpp
===================================================================
--- branches/RC_1_0/include/libtorrent/session.hpp 2015-05-31 17:28:37 UTC (rev 11137)
+++ branches/RC_1_0/include/libtorrent/session.hpp 2015-05-31 21:32:18 UTC (rev 11138)
@@ -153,18 +153,21 @@
{
public:
- // If the fingerprint in the first overload is omited, the client will
- // get a default fingerprint stating the version of libtorrent. The
+ // If the fingerprint in the first overload is omited, the client will get
+ // a default fingerprint stating the version of libtorrent. The
// fingerprint is a short string that will be used in the peer-id to
// identify the client and the client's version. For more details see the
- // fingerprint class. The constructor that only takes a fingerprint will
- // not open a listen port for the session, to get it running you'll have
- // to call ``session::listen_on()``. The other constructor, that takes a
- // port range and an interface as well as the fingerprint will
- // automatically try to listen on a port on the given interface. For more
- // information about the parameters, see ``listen_on()`` function.
+ // fingerprint class. The first overload (that takes a fingerprint, flags
+ // and alert_mask) will listen on INADDR_ANY and let the OS pick a listen
+ // port. To listen on a specific interface or specific port, you'll have
+ // to call ``session::listen_on()``.
//
- // The flags paramater can be used to start default features (upnp &
+ // The second overload, that takes a port range and an interface as well
+ // as the fingerprint will automatically try to listen on a port on the
+ // given interface. For more information about the parameters, see
+ // ``listen_on()`` function.
+ //
+ // The flags parameter can be used to start default features (upnp &
// nat-pmp) and default plugins (ut_metadata, ut_pex and smart_ban). The
// default is to start those things. If you do not want them to start,
// pass 0 as the flags parameter.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ar...@us...> - 2015-05-31 17:28:39
|
Revision: 11137
http://sourceforge.net/p/libtorrent/code/11137
Author: arvidn
Date: 2015-05-31 17:28:37 +0000 (Sun, 31 May 2015)
Log Message:
-----------
fix unit test
Modified Paths:
--------------
trunk/test/test_alert_manager.cpp
Modified: trunk/test/test_alert_manager.cpp
===================================================================
--- trunk/test/test_alert_manager.cpp 2015-05-31 17:16:44 UTC (rev 11136)
+++ trunk/test/test_alert_manager.cpp 2015-05-31 17:28:37 UTC (rev 11137)
@@ -203,6 +203,7 @@
TORRENT_TEST(extensions)
{
#ifndef TORRENT_DISABLE_EXTENSIONS
+ memset(plugin_alerts, 0, sizeof(plugin_alerts));
alert_manager mgr(100, 0xffffffff);
mgr.add_extension(boost::make_shared<test_plugin>(0));
@@ -236,7 +237,7 @@
alert_manager mgr(100, 0xffffffff);
time_point start = clock_type::now();
-
+
alert* a = mgr.wait_for_alert(seconds(1));
time_point end = clock_type::now();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ar...@us...> - 2015-05-31 17:16:47
|
Revision: 11136
http://sourceforge.net/p/libtorrent/code/11136
Author: arvidn
Date: 2015-05-31 17:16:44 +0000 (Sun, 31 May 2015)
Log Message:
-----------
test names
Modified Paths:
--------------
trunk/test/test_packet_buffer.cpp
Modified: trunk/test/test_packet_buffer.cpp
===================================================================
--- trunk/test/test_packet_buffer.cpp 2015-05-31 16:14:46 UTC (rev 11135)
+++ trunk/test/test_packet_buffer.cpp 2015-05-31 17:16:44 UTC (rev 11136)
@@ -36,7 +36,7 @@
using libtorrent::packet_buffer;
// test packet_buffer
-TORRENT_TEST(packet_buffer)
+TORRENT_TEST(insert)
{
packet_buffer pb;
@@ -99,7 +99,7 @@
}
}
-TORRENT_TEST(packet_buffer_wrap)
+TORRENT_TEST(wrap)
{
// test wrapping the indices
packet_buffer pb;
@@ -117,7 +117,7 @@
TEST_CHECK(pb.at(2) == (void*)2);
}
-TORRENT_TEST(packet_buffer_wrap2)
+TORRENT_TEST(wrap2)
{
// test wrapping the indices
packet_buffer pb;
@@ -137,7 +137,7 @@
TEST_CHECK(pb.at(new_index) == (void*)2);
}
-TORRENT_TEST(packet_buffer_reverse_wrap)
+TORRENT_TEST(reverse_wrap)
{
// test wrapping the indices backwards
packet_buffer pb;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ar...@us...> - 2015-05-31 16:14:49
|
Revision: 11135
http://sourceforge.net/p/libtorrent/code/11135
Author: arvidn
Date: 2015-05-31 16:14:46 +0000 (Sun, 31 May 2015)
Log Message:
-----------
some test fixes
Modified Paths:
--------------
trunk/src/assert.cpp
trunk/test/main.cpp
trunk/test/test.cpp
trunk/test/test.hpp
trunk/test/test_web_seed.cpp
trunk/test/test_web_seed_http.cpp
trunk/test/test_web_seed_http_pw.cpp
Modified: trunk/src/assert.cpp
===================================================================
--- trunk/src/assert.cpp 2015-05-31 12:21:16 UTC (rev 11134)
+++ trunk/src/assert.cpp 2015-05-31 16:14:46 UTC (rev 11135)
@@ -266,7 +266,7 @@
message = "A precondition of a libtorrent function has been violated.\n"
"This indicates a bug in the client application using libtorrent\n";
}
-
+
assert_print("%s\n"
#ifdef TORRENT_PRODUCTION_ASSERTS
"#: %d\n"
@@ -288,10 +288,10 @@
// if production asserts are defined, don't abort, just print the error
#ifndef TORRENT_PRODUCTION_ASSERTS
- // send SIGINT to the current process
- // to break into the debugger
- raise(SIGINT);
- abort();
+ // send SIGINT to the current process
+ // to break into the debugger
+ raise(SIGINT);
+ abort();
#endif
}
Modified: trunk/test/main.cpp
===================================================================
--- trunk/test/main.cpp 2015-05-31 12:21:16 UTC (rev 11134)
+++ trunk/test/main.cpp 2015-05-31 16:14:46 UTC (rev 11135)
@@ -58,6 +58,34 @@
using namespace libtorrent;
+// these are global so we can restore them on abnormal exits and print stuff
+// out, such as the log
+int old_stdout = -1;
+int old_stderr = -1;
+
+// the current tests file descriptor
+unit_test_t* current_test = NULL;
+
+void output_test_log_to_terminal()
+{
+ if (current_test == NULL || old_stdout == -1 || old_stderr == -1)
+ return;
+
+ fflush(stdout);
+ fflush(stderr);
+ dup2(old_stdout, fileno(stdout));
+ dup2(old_stderr, fileno(stderr));
+
+ fseek(current_test->output, 0, SEEK_SET);
+ fprintf(stderr, "\x1b[1m[%s]\x1b[0m\n\n", current_test->name);
+ char buf[4096];
+ int size = 0;
+ do {
+ size = fread(buf, 1, sizeof(buf), current_test->output);
+ if (size > 0) fwrite(buf, 1, size, stderr);
+ } while (size > 0);
+}
+
void sig_handler(int sig)
{
char stack_text[10000];
@@ -90,6 +118,9 @@
#undef SIG
};
fprintf(stderr, "signal: %s caught:\n%s\n", sig_name, stack_text);
+
+ output_test_log_to_terminal();
+
exit(138);
}
@@ -159,6 +190,7 @@
signal(SIGBUS, &sig_handler);
#endif
signal(SIGILL, &sig_handler);
+ signal(SIGINT, &sig_handler);
signal(SIGABRT, &sig_handler);
signal(SIGFPE, &sig_handler);
#ifdef SIGSYS
@@ -190,8 +222,8 @@
return 1;
}
- int old_stdout = dup(fileno(stdout));
- int old_stderr = dup(fileno(stderr));
+ old_stdout = dup(fileno(stdout));
+ old_stderr = dup(fileno(stderr));
int num_run = 0;
for (int i = 0; i < _g_num_unit_tests; ++i)
@@ -215,6 +247,8 @@
continue;
}
+ current_test = &t;
+
#ifndef BOOST_NO_EXCEPTIONS
try
{
@@ -240,19 +274,7 @@
if (_g_test_failures > 0)
{
- fflush(stdout);
- fflush(stderr);
- dup2(old_stdout, fileno(stdout));
- dup2(old_stderr, fileno(stderr));
-
- fseek(t.output, 0, SEEK_SET);
- fprintf(stderr, "\x1b[1m[%s]\x1b[0m\n\n", t.name);
- char buf[4096];
- int size = 0;
- do {
- size = fread(buf, 1, sizeof(buf), t.output);
- if (size > 0) fwrite(buf, 1, size, stderr);
- } while (size > 0);
+ output_test_log_to_terminal();
}
t.num_failures = _g_test_failures;
Modified: trunk/test/test.cpp
===================================================================
--- trunk/test/test.cpp 2015-05-31 12:21:16 UTC (rev 11134)
+++ trunk/test/test.cpp 2015-05-31 16:14:46 UTC (rev 11135)
@@ -66,12 +66,12 @@
if (_g_unit_tests[i].num_failures == 0)
{
- fprintf(stderr, "\x1b[32m[%*s] ***PASS***\n"
+ fprintf(stderr, "\x1b[32m[%-*s] ***PASS***\n"
, longest_name, _g_unit_tests[i].name);
}
else
{
- fprintf(stderr, "\x1b[31m[%*s] %d FAILURES\n"
+ fprintf(stderr, "\x1b[31m[%-*s] %d FAILURES\n"
, longest_name
, _g_unit_tests[i].name
, _g_unit_tests[i].num_failures);
Modified: trunk/test/test.hpp
===================================================================
--- trunk/test/test.hpp 2015-05-31 12:21:16 UTC (rev 11134)
+++ trunk/test/test.hpp 2015-05-31 16:14:46 UTC (rev 11135)
@@ -71,7 +71,7 @@
extern int EXPORT _g_test_failures;
#define TORRENT_TEST(test_name) \
- void BOOST_PP_CAT(unit_test_, test_name)(); \
+ static void BOOST_PP_CAT(unit_test_, test_name)(); \
static struct BOOST_PP_CAT(register_class, __LINE__) { \
BOOST_PP_CAT(register_class, __LINE__) () { \
unit_test_t& t = _g_unit_tests[_g_num_unit_tests]; \
Modified: trunk/test/test_web_seed.cpp
===================================================================
--- trunk/test/test_web_seed.cpp 2015-05-31 12:21:16 UTC (rev 11134)
+++ trunk/test/test_web_seed.cpp 2015-05-31 16:14:46 UTC (rev 11135)
@@ -38,11 +38,15 @@
const int proxy = libtorrent::settings_pack::none;
-TORRENT_TEST(web_seed)
+#ifdef TORRENT_USE_OPENSSL
+TORRENT_TEST(web_seed_ssl)
{
-#ifdef TORRENT_USE_OPENSSL
run_http_suite(proxy, "https", false);
+}
#endif
+
+TORRENT_TEST(web_seed)
+{
run_http_suite(proxy, "http", false);
}
Modified: trunk/test/test_web_seed_http.cpp
===================================================================
--- trunk/test/test_web_seed_http.cpp 2015-05-31 12:21:16 UTC (rev 11134)
+++ trunk/test/test_web_seed_http.cpp 2015-05-31 16:14:46 UTC (rev 11135)
@@ -40,12 +40,23 @@
TORRENT_TEST(web_seed_http)
{
- for (int url_seed = 0; url_seed < 2; ++url_seed)
- {
+ run_http_suite(proxy, "http", false);
+}
+
+TORRENT_TEST(url_seed_http)
+{
+ run_http_suite(proxy, "http", true);
+}
+
#ifdef TORRENT_USE_OPENSSL
- run_http_suite(proxy, "https", url_seed);
-#endif
- run_http_suite(proxy, "http", url_seed);
- }
+TORRENT_TEST(web_seed_https)
+{
+ run_http_suite(proxy, "https", false);
}
+TORRENT_TEST(url_seed_https)
+{
+ run_http_suite(proxy, "https", true);
+}
+#endif
+
Modified: trunk/test/test_web_seed_http_pw.cpp
===================================================================
--- trunk/test/test_web_seed_http_pw.cpp 2015-05-31 12:21:16 UTC (rev 11134)
+++ trunk/test/test_web_seed_http_pw.cpp 2015-05-31 16:14:46 UTC (rev 11135)
@@ -40,12 +40,23 @@
TORRENT_TEST(web_seed_http_pw)
{
- for (int url_seed = 0; url_seed < 2; ++url_seed)
- {
+ run_http_suite(proxy, "http", false);
+}
+
+TORRENT_TEST(url_seed_http_pw)
+{
+ run_http_suite(proxy, "http", true);
+}
+
#ifdef TORRENT_USE_OPENSSL
- run_http_suite(proxy, "https", url_seed);
-#endif
- run_http_suite(proxy, "http", url_seed);
- }
+TORRENT_TEST(web_seed_http_pw_ssl)
+{
+ run_http_suite(proxy, "https", false);
}
+TORRENT_TEST(url_seed_http_pw_ssl)
+{
+ run_http_suite(proxy, "https", true);
+}
+#endif
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ar...@us...> - 2015-05-31 12:21:20
|
Revision: 11134
http://sourceforge.net/p/libtorrent/code/11134
Author: arvidn
Date: 2015-05-31 12:21:16 +0000 (Sun, 31 May 2015)
Log Message:
-----------
msvc fixes
Modified Paths:
--------------
trunk/include/libtorrent/create_torrent.hpp
trunk/test/Jamfile
trunk/test/test.hpp
trunk/test/test_alert_manager.cpp
trunk/test/test_bandwidth_limiter.cpp
trunk/test/test_bdecode.cpp
trunk/test/test_bencoding.cpp
trunk/test/test_bitfield.cpp
trunk/test/test_bloom_filter.cpp
trunk/test/test_crc32.cpp
trunk/test/test_dht.cpp
trunk/test/test_dos_blocker.cpp
trunk/test/test_fence.cpp
trunk/test/test_file_storage.cpp
trunk/test/test_gzip.cpp
trunk/test/test_hasher.cpp
trunk/test/test_heterogeneous_queue.cpp
trunk/test/test_http_parser.cpp
trunk/test/test_ip_filter.cpp
trunk/test/test_ip_voter.cpp
trunk/test/test_magnet.cpp
trunk/test/test_merkle.cpp
trunk/test/test_packet_buffer.cpp
trunk/test/test_part_file.cpp
trunk/test/test_peer_list.cpp
trunk/test/test_peer_priority.cpp
trunk/test/test_piece_picker.cpp
trunk/test/test_random.cpp
trunk/test/test_resolve_links.cpp
trunk/test/test_settings_pack.cpp
trunk/test/test_sliding_average.cpp
trunk/test/test_socket_io.cpp
trunk/test/test_string.cpp
trunk/test/test_tailqueue.cpp
trunk/test/test_threads.cpp
trunk/test/test_time.cpp
trunk/test/test_torrent_info.cpp
trunk/test/test_transfer.cpp
trunk/test/test_upnp.cpp
trunk/test/test_xml.cpp
Modified: trunk/include/libtorrent/create_torrent.hpp
===================================================================
--- trunk/include/libtorrent/create_torrent.hpp 2015-05-31 09:02:42 UTC (rev 11133)
+++ trunk/include/libtorrent/create_torrent.hpp 2015-05-31 12:21:16 UTC (rev 11134)
@@ -460,7 +460,7 @@
#ifndef BOOST_NO_EXCEPTIONS
template <class Fun>
TORRENT_DEPRECATED
- void TORRENT_DEPRECATED set_piece_hashes(create_torrent& t
+ void set_piece_hashes(create_torrent& t
, std::wstring const& p, Fun f)
{
error_code ec;
@@ -469,7 +469,7 @@
}
TORRENT_DEPRECATED
- inline void TORRENT_DEPRECATED set_piece_hashes(create_torrent& t
+ inline void set_piece_hashes(create_torrent& t
, std::wstring const& p)
{
error_code ec;
@@ -479,7 +479,7 @@
#endif
TORRENT_DEPRECATED
- inline void TORRENT_DEPRECATED set_piece_hashes(create_torrent& t
+ inline void set_piece_hashes(create_torrent& t
, std::wstring const& p, error_code& ec)
{
set_piece_hashes_deprecated(t, p, detail::nop, ec);
Modified: trunk/test/Jamfile
===================================================================
--- trunk/test/Jamfile 2015-05-31 09:02:42 UTC (rev 11133)
+++ trunk/test/Jamfile 2015-05-31 12:21:16 UTC (rev 11134)
@@ -50,6 +50,7 @@
lib libtorrent_test
: # sources
+ test.cpp
setup_transfer.cpp
dht_server.cpp
udp_tracker.cpp
@@ -83,7 +84,6 @@
project
: requirements
<source>main.cpp
- <source>test.cpp
<conditional>@link_test
<conditional>@link_libtorrent
: default-build
Modified: trunk/test/test.hpp
===================================================================
--- trunk/test/test.hpp 2015-05-31 09:02:42 UTC (rev 11133)
+++ trunk/test/test.hpp 2015-05-31 12:21:16 UTC (rev 11134)
@@ -66,9 +66,9 @@
FILE* output;
};
-extern unit_test_t _g_unit_tests[1024];
-extern int _g_num_unit_tests;
-extern int _g_test_failures;
+extern unit_test_t EXPORT _g_unit_tests[1024];
+extern int EXPORT _g_num_unit_tests;
+extern int EXPORT _g_test_failures;
#define TORRENT_TEST(test_name) \
void BOOST_PP_CAT(unit_test_, test_name)(); \
@@ -76,14 +76,14 @@
BOOST_PP_CAT(register_class, __LINE__) () { \
unit_test_t& t = _g_unit_tests[_g_num_unit_tests]; \
t.fun = &BOOST_PP_CAT(unit_test_, test_name); \
- t.name = #test_name; \
+ t.name = __FILE__ "." #test_name; \
t.num_failures = 0; \
t.run = false; \
t.output = NULL; \
_g_num_unit_tests++; \
} \
} BOOST_PP_CAT(_static_registrar, __LINE__); \
- void BOOST_PP_CAT(unit_test_, test_name)()
+ static void BOOST_PP_CAT(unit_test_, test_name)()
#define TEST_REPORT_AUX(x, line, file) \
report_failure(x, line, file)
Modified: trunk/test/test_alert_manager.cpp
===================================================================
--- trunk/test/test_alert_manager.cpp 2015-05-31 09:02:42 UTC (rev 11133)
+++ trunk/test/test_alert_manager.cpp 2015-05-31 12:21:16 UTC (rev 11134)
@@ -44,7 +44,7 @@
using namespace libtorrent;
-void test_limit()
+TORRENT_TEST(limit)
{
alert_manager mgr(500, 0xffffffff);
@@ -81,7 +81,7 @@
TEST_EQUAL(alerts.size(), 200);
}
-void test_priority_limit()
+TORRENT_TEST(priority_limit)
{
alert_manager mgr(100, 0xffffffff);
@@ -109,7 +109,7 @@
++cnt;
}
-void test_dispatch_function()
+TORRENT_TEST(dispatch_function)
{
#ifndef TORRENT_NO_DEPRECATE
int cnt = 0;
@@ -142,7 +142,7 @@
++cnt;
}
-void test_notify_function()
+TORRENT_TEST(notify_function)
{
int cnt = 0;
alert_manager mgr(100, 0xffffffff);
@@ -200,7 +200,7 @@
#endif
-void test_extensions()
+TORRENT_TEST(extensions)
{
#ifndef TORRENT_DISABLE_EXTENSIONS
alert_manager mgr(100, 0xffffffff);
@@ -231,7 +231,7 @@
mgr->emplace_alert<torrent_added_alert>(torrent_handle());
}
-void test_wait_for_alert()
+TORRENT_TEST(wait_for_alert)
{
alert_manager mgr(100, 0xffffffff);
@@ -267,7 +267,7 @@
posting_thread.join();
}
-void test_queued_resume()
+TORRENT_TEST(queued_resume)
{
alert_manager mgr(100, 0xffffffff);
@@ -301,7 +301,7 @@
TEST_EQUAL(mgr.num_queued_resume(), 0);
}
-void test_alert_mask()
+TORRENT_TEST(alert_mask)
{
alert_manager mgr(100, 0xffffffff);
@@ -314,17 +314,3 @@
TEST_CHECK(!mgr.should_post<torrent_paused_alert>());
}
-TORRENT_TEST(alert_manager)
-{
- test_limit();
- test_priority_limit();
- test_dispatch_function();
- test_notify_function();
- test_extensions();
- test_wait_for_alert();
- test_queued_resume();
- test_alert_mask();
-
- return 0;
-}
-
Modified: trunk/test/test_bandwidth_limiter.cpp
===================================================================
--- trunk/test/test_bandwidth_limiter.cpp 2015-05-31 09:02:42 UTC (rev 11133)
+++ trunk/test/test_bandwidth_limiter.cpp 2015-05-31 12:21:16 UTC (rev 11134)
@@ -457,10 +457,8 @@
TEST_CHECK(close_to(p->m_quota / sample_time, limit / 200 / num_peers, 5));
}
-TORRENT_TEST(bandwidth_limiter)
+TORRENT_TEST(equal_connection)
{
- using namespace libtorrent;
-
test_equal_connections(2, 20);
test_equal_connections(2, 2000);
test_equal_connections(2, 20000);
@@ -470,11 +468,19 @@
test_equal_connections(33, 60000);
test_equal_connections(33, 500000);
test_equal_connections(1, 100000000);
+}
+
+TORRENT_TEST(conn_var_rate)
+{
test_connections_variable_rate(2, 20, 0);
test_connections_variable_rate(5, 20000, 0);
test_connections_variable_rate(3, 2000, 6000);
test_connections_variable_rate(5, 2000, 30000);
test_connections_variable_rate(33, 500000, 0);
+}
+
+TORRENT_TEST(torrents)
+{
test_torrents(2, 400, 400, 0);
test_torrents(2, 100, 500, 0);
test_torrents(2, 3000, 3000, 6000);
@@ -483,15 +489,29 @@
test_torrents(5, 6000, 6000, 3000);
test_torrents(5, 6000, 5000, 4000);
test_torrents(5, 20000, 20000, 30000);
+}
+
+TORRENT_TEST(torrent_var_rate)
+{
test_torrents_variable_rate(5, 6000, 3000);
test_torrents_variable_rate(5, 20000, 30000);
+}
+
+TORRENT_TEST(bandwidth_limiter)
+{
test_single_peer(40000, true);
test_single_peer(40000, false);
+}
+
+TORRENT_TEST(peer_priority)
+{
test_peer_priority(40000, false);
test_peer_priority(40000, true);
+}
+
+TORRENT_TEST(no_starvation)
+{
test_no_starvation(40000);
-
- return 0;
}
Modified: trunk/test/test_bdecode.cpp
===================================================================
--- trunk/test/test_bdecode.cpp 2015-05-31 09:02:42 UTC (rev 11133)
+++ trunk/test/test_bdecode.cpp 2015-05-31 12:21:16 UTC (rev 11134)
@@ -35,1157 +35,1203 @@
using namespace libtorrent;
-TORRENT_TEST(bdecode)
+// test integer
+TORRENT_TEST(integer)
{
- // test integer
- {
- char b[] = "i12453e";
- bdecode_node e;
- error_code ec;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec);
- TEST_CHECK(ret == 0);
- printf("%s\n", print_entry(e).c_str());
- std::pair<const char*, int> section = e.data_section();
- TEST_CHECK(std::memcmp(b, section.first, section.second) == 0);
- TEST_CHECK(section.second == sizeof(b) - 1);
- TEST_CHECK(e.type() == bdecode_node::int_t);
- TEST_CHECK(e.int_value() == 12453);
- }
+ char b[] = "i12453e";
+ bdecode_node e;
+ error_code ec;
+ int ret = bdecode(b, b + sizeof(b)-1, e, ec);
+ TEST_CHECK(ret == 0);
+ printf("%s\n", print_entry(e).c_str());
+ std::pair<const char*, int> section = e.data_section();
+ TEST_CHECK(std::memcmp(b, section.first, section.second) == 0);
+ TEST_CHECK(section.second == sizeof(b) - 1);
+ TEST_CHECK(e.type() == bdecode_node::int_t);
+ TEST_CHECK(e.int_value() == 12453);
+}
- // test string
- {
- char b[] = "26:abcdefghijklmnopqrstuvwxyz";
- bdecode_node e;
- error_code ec;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec);
- TEST_CHECK(ret == 0);
- printf("%s\n", print_entry(e).c_str());
- std::pair<const char*, int> section = e.data_section();
- TEST_CHECK(std::memcmp(b, section.first, section.second) == 0);
- TEST_CHECK(section.second == sizeof(b) - 1);
- TEST_CHECK(e.type() == bdecode_node::string_t);
- TEST_CHECK(e.string_value() == std::string("abcdefghijklmnopqrstuvwxyz"));
- TEST_CHECK(e.string_length() == 26);
- }
+// test string
+TORRENT_TEST(string)
+{
+ char b[] = "26:abcdefghijklmnopqrstuvwxyz";
+ bdecode_node e;
+ error_code ec;
+ int ret = bdecode(b, b + sizeof(b)-1, e, ec);
+ TEST_CHECK(ret == 0);
+ printf("%s\n", print_entry(e).c_str());
+ std::pair<const char*, int> section = e.data_section();
+ TEST_CHECK(std::memcmp(b, section.first, section.second) == 0);
+ TEST_CHECK(section.second == sizeof(b) - 1);
+ TEST_CHECK(e.type() == bdecode_node::string_t);
+ TEST_CHECK(e.string_value() == std::string("abcdefghijklmnopqrstuvwxyz"));
+ TEST_CHECK(e.string_length() == 26);
+}
- // test list
- {
- char b[] = "li12453e3:aaae";
- bdecode_node e;
- error_code ec;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec);
- TEST_CHECK(ret == 0);
- printf("%s\n", print_entry(e).c_str());
- std::pair<const char*, int> section = e.data_section();
- TEST_CHECK(std::memcmp(b, section.first, section.second) == 0);
- TEST_CHECK(section.second == sizeof(b) - 1);
- TEST_CHECK(e.type() == bdecode_node::list_t);
- TEST_CHECK(e.list_size() == 2);
- TEST_CHECK(e.list_at(0).type() == bdecode_node::int_t);
- TEST_CHECK(e.list_at(1).type() == bdecode_node::string_t);
- TEST_CHECK(e.list_at(0).int_value() == 12453);
- TEST_CHECK(e.list_at(1).string_value() == std::string("aaa"));
- TEST_CHECK(e.list_at(1).string_length() == 3);
- section = e.list_at(1).data_section();
- TEST_CHECK(std::memcmp("3:aaa", section.first, section.second) == 0);
- TEST_CHECK(section.second == 5);
- }
+// test list
+TORRENT_TEST(list)
+{
+ char b[] = "li12453e3:aaae";
+ bdecode_node e;
+ error_code ec;
+ int ret = bdecode(b, b + sizeof(b)-1, e, ec);
+ TEST_CHECK(ret == 0);
+ printf("%s\n", print_entry(e).c_str());
+ std::pair<const char*, int> section = e.data_section();
+ TEST_CHECK(std::memcmp(b, section.first, section.second) == 0);
+ TEST_CHECK(section.second == sizeof(b) - 1);
+ TEST_CHECK(e.type() == bdecode_node::list_t);
+ TEST_CHECK(e.list_size() == 2);
+ TEST_CHECK(e.list_at(0).type() == bdecode_node::int_t);
+ TEST_CHECK(e.list_at(1).type() == bdecode_node::string_t);
+ TEST_CHECK(e.list_at(0).int_value() == 12453);
+ TEST_CHECK(e.list_at(1).string_value() == std::string("aaa"));
+ TEST_CHECK(e.list_at(1).string_length() == 3);
+ section = e.list_at(1).data_section();
+ TEST_CHECK(std::memcmp("3:aaa", section.first, section.second) == 0);
+ TEST_CHECK(section.second == 5);
+}
- // test dict
- {
- char b[] = "d1:ai12453e1:b3:aaa1:c3:bbb1:X10:0123456789e";
- bdecode_node e;
- error_code ec;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec);
- TEST_EQUAL(ret, 0);
- printf("%s\n", print_entry(e).c_str());
- std::pair<const char*, int> section = e.data_section();
- TEST_CHECK(std::memcmp(b, section.first, section.second) == 0);
- TEST_CHECK(section.second == sizeof(b) - 1);
- TEST_CHECK(e.type() == bdecode_node::dict_t);
- TEST_CHECK(e.dict_size() == 4);
- TEST_CHECK(e.dict_find("a").type() == bdecode_node::int_t);
- TEST_CHECK(e.dict_find("a").int_value() == 12453);
- TEST_CHECK(e.dict_find("b").type() == bdecode_node::string_t);
- TEST_CHECK(e.dict_find("b").string_value() == std::string("aaa"));
- TEST_CHECK(e.dict_find("b").string_length() == 3);
- TEST_CHECK(e.dict_find("c").type() == bdecode_node::string_t);
- TEST_CHECK(e.dict_find("c").string_value() == std::string("bbb"));
- TEST_CHECK(e.dict_find("c").string_length() == 3);
- TEST_CHECK(e.dict_find_string_value("X") == "0123456789");
- }
+// test dict
+TORRENT_TEST(dict)
+{
+ char b[] = "d1:ai12453e1:b3:aaa1:c3:bbb1:X10:0123456789e";
+ bdecode_node e;
+ error_code ec;
+ int ret = bdecode(b, b + sizeof(b)-1, e, ec);
+ TEST_EQUAL(ret, 0);
+ printf("%s\n", print_entry(e).c_str());
+ std::pair<const char*, int> section = e.data_section();
+ TEST_CHECK(std::memcmp(b, section.first, section.second) == 0);
+ TEST_CHECK(section.second == sizeof(b) - 1);
+ TEST_CHECK(e.type() == bdecode_node::dict_t);
+ TEST_CHECK(e.dict_size() == 4);
+ TEST_CHECK(e.dict_find("a").type() == bdecode_node::int_t);
+ TEST_CHECK(e.dict_find("a").int_value() == 12453);
+ TEST_CHECK(e.dict_find("b").type() == bdecode_node::string_t);
+ TEST_CHECK(e.dict_find("b").string_value() == std::string("aaa"));
+ TEST_CHECK(e.dict_find("b").string_length() == 3);
+ TEST_CHECK(e.dict_find("c").type() == bdecode_node::string_t);
+ TEST_CHECK(e.dict_find("c").string_value() == std::string("bbb"));
+ TEST_CHECK(e.dict_find("c").string_length() == 3);
+ TEST_CHECK(e.dict_find_string_value("X") == "0123456789");
+}
- // test dictionary with a key without a value
- {
- char b[] = "d1:ai1e1:be";
- bdecode_node e;
- error_code ec;
- int pos;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
- TEST_EQUAL(ret, -1);
- TEST_EQUAL(pos, 10);
- TEST_EQUAL(ec, error_code(bdecode_errors::expected_value));
- printf("%s\n", print_entry(e).c_str());
- }
+// test dictionary with a key without a value
+TORRENT_TEST(dict_key_novalue)
+{
+ char b[] = "d1:ai1e1:be";
+ bdecode_node e;
+ error_code ec;
+ int pos;
+ int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
+ TEST_EQUAL(ret, -1);
+ TEST_EQUAL(pos, 10);
+ TEST_EQUAL(ec, error_code(bdecode_errors::expected_value));
+ printf("%s\n", print_entry(e).c_str());
+}
- // test dictionary with a key that's not a string
- {
- char b[] = "di5e1:ae";
- bdecode_node e;
- error_code ec;
- int pos;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
- TEST_EQUAL(ret, -1);
- TEST_EQUAL(pos, 1);
- TEST_EQUAL(ec, error_code(bdecode_errors::expected_digit));
- printf("%s\n", print_entry(e).c_str());
- }
+// test dictionary with a key that's not a string
+TORRENT_TEST(dict_nonstring_key)
+{
+ char b[] = "di5e1:ae";
+ bdecode_node e;
+ error_code ec;
+ int pos;
+ int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
+ TEST_EQUAL(ret, -1);
+ TEST_EQUAL(pos, 1);
+ TEST_EQUAL(ec, error_code(bdecode_errors::expected_digit));
+ printf("%s\n", print_entry(e).c_str());
+}
- // dictionary key with \0
- {
- char b[] = "d3:a\0bi1ee";
- bdecode_node e;
- error_code ec;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec);
- TEST_CHECK(ret == 0);
- TEST_CHECK(e.dict_size() == 1);
- bdecode_node d = e.dict_find(std::string("a\0b", 3));
- TEST_EQUAL(d.type(), bdecode_node::int_t);
- TEST_EQUAL(d.int_value(), 1);
- }
+// dictionary key with \0
+TORRENT_TEST(dict_null_key)
+{
+ char b[] = "d3:a\0bi1ee";
+ bdecode_node e;
+ error_code ec;
+ int ret = bdecode(b, b + sizeof(b)-1, e, ec);
+ TEST_CHECK(ret == 0);
+ TEST_CHECK(e.dict_size() == 1);
+ bdecode_node d = e.dict_find(std::string("a\0b", 3));
+ TEST_EQUAL(d.type(), bdecode_node::int_t);
+ TEST_EQUAL(d.int_value(), 1);
+}
- // premature e
- {
- char b[] = "e";
- bdecode_node e;
- error_code ec;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec);
- TEST_EQUAL(ret, -1);
- TEST_EQUAL(ec, error_code(bdecode_errors::unexpected_eof));
- printf("%s\n", print_entry(e).c_str());
- }
+// premature e
+TORRENT_TEST(premature_e)
+{
+ char b[] = "e";
+ bdecode_node e;
+ error_code ec;
+ int ret = bdecode(b, b + sizeof(b)-1, e, ec);
+ TEST_EQUAL(ret, -1);
+ TEST_EQUAL(ec, error_code(bdecode_errors::unexpected_eof));
+ printf("%s\n", print_entry(e).c_str());
+}
- // test strings with negative length-prefix
- {
- char b[] = "-10:foobar";
- bdecode_node e;
- error_code ec;
- int pos;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
- TEST_EQUAL(ret, -1);
- TEST_EQUAL(pos, 0);
- TEST_EQUAL(ec, error_code(bdecode_errors::expected_value));
- printf("%s\n", print_entry(e).c_str());
- }
+// test strings with negative length-prefix
+TORRENT_TEST(negative_length_prefix)
+{
+ char b[] = "-10:foobar";
+ bdecode_node e;
+ error_code ec;
+ int pos;
+ int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
+ TEST_EQUAL(ret, -1);
+ TEST_EQUAL(pos, 0);
+ TEST_EQUAL(ec, error_code(bdecode_errors::expected_value));
+ printf("%s\n", print_entry(e).c_str());
+}
- // test strings with overflow length-prefix
- {
- char b[] = "18446744073709551615:foobar";
- bdecode_node e;
- error_code ec;
- int pos;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
- TEST_EQUAL(ret, -1);
- TEST_EQUAL(pos, 19);
- TEST_EQUAL(ec, error_code(bdecode_errors::overflow));
- printf("%s\n", print_entry(e).c_str());
- }
+// test strings with overflow length-prefix
+TORRENT_TEST(overflow_length_prefix)
+{
+ char b[] = "18446744073709551615:foobar";
+ bdecode_node e;
+ error_code ec;
+ int pos;
+ int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
+ TEST_EQUAL(ret, -1);
+ TEST_EQUAL(pos, 19);
+ TEST_EQUAL(ec, error_code(bdecode_errors::overflow));
+ printf("%s\n", print_entry(e).c_str());
+}
- // test strings with almost overflow (more than 8 digits)
- {
- char b[] = "99999999:foobar";
- bdecode_node e;
- error_code ec;
- int pos;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
- TEST_EQUAL(ret, -1);
- TEST_EQUAL(pos, 8);
- TEST_EQUAL(ec, error_code(bdecode_errors::unexpected_eof));
- printf("%s\n", print_entry(e).c_str());
- }
+// test strings with almost overflow (more than 8 digits)
+TORRENT_TEST(close_overflow_length_prefix)
+{
+ char b[] = "99999999:foobar";
+ bdecode_node e;
+ error_code ec;
+ int pos;
+ int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
+ TEST_EQUAL(ret, -1);
+ TEST_EQUAL(pos, 8);
+ TEST_EQUAL(ec, error_code(bdecode_errors::unexpected_eof));
+ printf("%s\n", print_entry(e).c_str());
+}
- // test strings with overflow (more than 8 digits)
- {
- char b[] = "199999999:foobar";
- bdecode_node e;
- error_code ec;
- int pos;
- // pretend that we have a large buffer like that
- int ret = bdecode(b, b + 999999999, e, ec, &pos);
- TEST_EQUAL(ret, -1);
- TEST_EQUAL(pos, 0);
- TEST_EQUAL(ec, error_code(bdecode_errors::limit_exceeded));
- printf("%s\n", print_entry(e).c_str());
- }
+// test strings with overflow (more than 8 digits)
+TORRENT_TEST(overflow_length_prefix2)
+{
+ char b[] = "199999999:foobar";
+ bdecode_node e;
+ error_code ec;
+ int pos;
+ // pretend that we have a large buffer like that
+ int ret = bdecode(b, b + 999999999, e, ec, &pos);
+ TEST_EQUAL(ret, -1);
+ TEST_EQUAL(pos, 0);
+ TEST_EQUAL(ec, error_code(bdecode_errors::limit_exceeded));
+ printf("%s\n", print_entry(e).c_str());
+}
- // test integer without any digits
- {
- char b[] = "ie";
- bdecode_node e;
- error_code ec;
- int pos;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
- TEST_EQUAL(ret, -1);
- TEST_EQUAL(pos, 1);
- TEST_EQUAL(ec, error_code(bdecode_errors::expected_digit));
- printf("%s\n", print_entry(e).c_str());
- }
+// test integer without any digits
+TORRENT_TEST(nodigit_int)
+{
+ char b[] = "ie";
+ bdecode_node e;
+ error_code ec;
+ int pos;
+ int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
+ TEST_EQUAL(ret, -1);
+ TEST_EQUAL(pos, 1);
+ TEST_EQUAL(ec, error_code(bdecode_errors::expected_digit));
+ printf("%s\n", print_entry(e).c_str());
+}
- // test integer with just a minus
- {
- char b[] = "i-e";
- bdecode_node e;
- error_code ec;
- int pos;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
- TEST_EQUAL(ret, -1);
- TEST_EQUAL(pos, 2);
- TEST_EQUAL(ec, error_code(bdecode_errors::expected_digit));
- printf("%s\n", print_entry(e).c_str());
- }
+// test integer with just a minus
+TORRENT_TEST(minus_int)
+{
+ char b[] = "i-e";
+ bdecode_node e;
+ error_code ec;
+ int pos;
+ int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
+ TEST_EQUAL(ret, -1);
+ TEST_EQUAL(pos, 2);
+ TEST_EQUAL(ec, error_code(bdecode_errors::expected_digit));
+ printf("%s\n", print_entry(e).c_str());
+}
+// test integer with a minus inserted in it
+TORRENT_TEST(interior_minus_int)
+{
+ char b[] = "i35412-5633e";
+ bdecode_node e;
+ error_code ec;
+ int pos;
+ int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
+ TEST_EQUAL(ret, -1);
+ TEST_EQUAL(pos, 6);
+ TEST_EQUAL(ec, error_code(bdecode_errors::expected_digit));
+ printf("%s\n", print_entry(e).c_str());
+}
- // test integer with a minus inserted in it
- {
- char b[] = "i35412-5633e";
- bdecode_node e;
- error_code ec;
- int pos;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
- TEST_EQUAL(ret, -1);
- TEST_EQUAL(pos, 6);
- TEST_EQUAL(ec, error_code(bdecode_errors::expected_digit));
- printf("%s\n", print_entry(e).c_str());
- }
+// test integers that don't fit in 64 bits
+TORRENT_TEST(int_overflow)
+{
+ char b[] = "i18446744073709551615e";
+ bdecode_node e;
+ error_code ec;
+ int ret = bdecode(b, b + sizeof(b)-1, e, ec);
+ TEST_EQUAL(ret, 0);
+ printf("%s\n", print_entry(e).c_str());
+ // the lazy aspect makes this overflow when asking for
+ // the value. turning it to zero.
+ TEST_EQUAL(e.int_value(), 0);
+}
+// test integers with more than 20 digits (overflow on parsing)
+TORRENT_TEST(int_overflow2)
+{
+ char b[] = "i184467440737095516154e";
+ bdecode_node e;
+ error_code ec;
+ int pos;
+ int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
+ TEST_EQUAL(ret, -1);
+ TEST_EQUAL(pos, 22);
+ TEST_EQUAL(ec, error_code(bdecode_errors::overflow));
+ printf("%s\n", print_entry(e).c_str());
+}
- // test integers that don't fit in 64 bits
- {
- char b[] = "i18446744073709551615e";
- bdecode_node e;
- error_code ec;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec);
- TEST_EQUAL(ret, 0);
- printf("%s\n", print_entry(e).c_str());
- // the lazy aspect makes this overflow when asking for
- // the value. turning it to zero.
- TEST_EQUAL(e.int_value(), 0);
- }
+// test truncated negative integer
+TORRENT_TEST(int_truncated)
+{
+ char b[] = "i-";
+ bdecode_node e;
+ error_code ec;
+ int pos;
+ int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
+ TEST_EQUAL(ret, -1);
+ TEST_EQUAL(pos, 2);
+ TEST_EQUAL(ec, error_code(bdecode_errors::unexpected_eof));
+ printf("%s\n", print_entry(e).c_str());
+}
- // test integers with more than 20 digits (overflow on parsing)
- {
- char b[] = "i184467440737095516154e";
- bdecode_node e;
- error_code ec;
- int pos;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
- TEST_EQUAL(ret, -1);
- TEST_EQUAL(pos, 22);
- TEST_EQUAL(ec, error_code(bdecode_errors::overflow));
- printf("%s\n", print_entry(e).c_str());
- }
+// bdecode_error
+TORRENT_TEST(bdecode_error)
+{
+ error_code ec(bdecode_errors::overflow);
+ TEST_EQUAL(ec.message(), "integer overflow");
+ TEST_EQUAL(ec.category().name(), std::string("bdecode error"));
+ ec.assign(5434, get_bdecode_category());
+ TEST_EQUAL(ec.message(), "Unknown error");
+}
- // test truncated negative integer
- {
- char b[] = "i-";
- bdecode_node e;
- error_code ec;
- int pos;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
- TEST_EQUAL(ret, -1);
- TEST_EQUAL(pos, 2);
- TEST_EQUAL(ec, error_code(bdecode_errors::unexpected_eof));
- printf("%s\n", print_entry(e).c_str());
- }
+// test integers that just exactly fit in 64 bits
+TORRENT_TEST(64bit_int)
+{
+ char b[] = "i9223372036854775807e";
+ bdecode_node e;
+ error_code ec;
+ int ret = bdecode(b, b + sizeof(b)-1, e, ec);
+ TEST_CHECK(ret == 0);
+ printf("%s\n", print_entry(e).c_str());
+ TEST_CHECK(e.int_value() == 9223372036854775807LL);
+}
- // test truncated negative integer
- {
- char b[] = "i-e";
- bdecode_node e;
- error_code ec;
- int pos;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
- TEST_EQUAL(ret, -1);
- TEST_EQUAL(pos, 2);
- TEST_EQUAL(ec, error_code(bdecode_errors::expected_digit));
- printf("%s\n", print_entry(e).c_str());
- }
+// test integers that just exactly fit in 64 bits
+TORRENT_TEST(64bit_int_negative)
+{
+ char b[] = "i-9223372036854775807e";
+ bdecode_node e;
+ error_code ec;
+ int ret = bdecode(b, b + sizeof(b)-1, e, ec);
+ TEST_CHECK(ret == 0);
+ printf("%s\n", print_entry(e).c_str());
+ TEST_CHECK(e.int_value() == -9223372036854775807LL);
+}
- // bdecode_error
- {
- error_code ec(bdecode_errors::overflow);
- TEST_EQUAL(ec.message(), "integer overflow");
- TEST_EQUAL(ec.category().name(), std::string("bdecode error"));
- ec.assign(5434, get_bdecode_category());
- TEST_EQUAL(ec.message(), "Unknown error");
- }
+// test integers that have invalid digits
+TORRENT_TEST(int_invalid_digit)
+{
+ char b[] = "i92337203t854775807e";
+ bdecode_node e;
+ error_code ec;
+ int pos = 0;
+ int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
+ TEST_EQUAL(ret, -1);
+ TEST_EQUAL(pos, 9);
+ TEST_EQUAL(ec, error_code(bdecode_errors::expected_digit));
+ printf("%s\n", print_entry(e).c_str());
+}
- // test integers that just exactly fit in 64 bits
- {
- char b[] = "i9223372036854775807e";
- bdecode_node e;
- error_code ec;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec);
- TEST_CHECK(ret == 0);
- printf("%s\n", print_entry(e).c_str());
- TEST_CHECK(e.int_value() == 9223372036854775807LL);
- }
+// test invalid encoding
+TORRENT_TEST(invalid_encoding)
+{
+ unsigned char buf[] =
+ { 0x64, 0x31, 0x3a, 0x61, 0x64, 0x32, 0x3a, 0x69
+ , 0x64, 0x32, 0x30, 0x3a, 0x2a, 0x21, 0x19, 0x89
+ , 0x9f, 0xcd, 0x5f, 0xc9, 0xbc, 0x80, 0xc1, 0x76
+ , 0xfe, 0xe0, 0xc6, 0x84, 0x2d, 0xf6, 0xfc, 0xb8
+ , 0x39, 0x3a, 0x69, 0x6e, 0x66, 0x6f, 0x5f, 0x68
+ , 0x61, 0xae, 0x68, 0x32, 0x30, 0x3a, 0x14, 0x78
+ , 0xd5, 0xb0, 0xdc, 0xf6, 0x82, 0x42, 0x32, 0xa0
+ , 0xd6, 0x88, 0xeb, 0x48, 0x57, 0x01, 0x89, 0x40
+ , 0x4e, 0xbc, 0x65, 0x31, 0x3a, 0x71, 0x39, 0x3a
+ , 0x67, 0x65, 0x74, 0x5f, 0x70, 0x65, 0x65, 0x72
+ , 0x78, 0xff, 0x3a, 0x74, 0x38, 0x3a, 0xaa, 0xd4
+ , 0xa1, 0x88, 0x7a, 0x8d, 0xc3, 0xd6, 0x31, 0x3a
+ , 0x79, 0x31, 0xae, 0x71, 0x65, 0};
- // test integers that just exactly fit in 64 bits
- {
- char b[] = "i-9223372036854775807e";
- bdecode_node e;
- error_code ec;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec);
- TEST_CHECK(ret == 0);
- printf("%s\n", print_entry(e).c_str());
- TEST_CHECK(e.int_value() == -9223372036854775807LL);
- }
+ printf("%s\n", buf);
+ bdecode_node e;
+ error_code ec;
+ int ret = bdecode((char*)buf, (char*)buf + sizeof(buf), e, ec);
+ TEST_CHECK(ret == -1);
+}
- // test integers that have invalid digits
- {
- char b[] = "i92337203t854775807e";
- bdecode_node e;
- error_code ec;
- int pos = 0;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
- TEST_EQUAL(ret, -1);
- TEST_EQUAL(pos, 9);
- TEST_EQUAL(ec, error_code(bdecode_errors::expected_digit));
- printf("%s\n", print_entry(e).c_str());
- }
+// test the depth limit
+TORRENT_TEST(depth_limit)
+{
+ char b[2048];
+ for (int i = 0; i < 1024; ++i)
+ b[i]= 'l';
- // test invalid encoding
- {
- unsigned char buf[] =
- { 0x64, 0x31, 0x3a, 0x61, 0x64, 0x32, 0x3a, 0x69
- , 0x64, 0x32, 0x30, 0x3a, 0x2a, 0x21, 0x19, 0x89
- , 0x9f, 0xcd, 0x5f, 0xc9, 0xbc, 0x80, 0xc1, 0x76
- , 0xfe, 0xe0, 0xc6, 0x84, 0x2d, 0xf6, 0xfc, 0xb8
- , 0x39, 0x3a, 0x69, 0x6e, 0x66, 0x6f, 0x5f, 0x68
- , 0x61, 0xae, 0x68, 0x32, 0x30, 0x3a, 0x14, 0x78
- , 0xd5, 0xb0, 0xdc, 0xf6, 0x82, 0x42, 0x32, 0xa0
- , 0xd6, 0x88, 0xeb, 0x48, 0x57, 0x01, 0x89, 0x40
- , 0x4e, 0xbc, 0x65, 0x31, 0x3a, 0x71, 0x39, 0x3a
- , 0x67, 0x65, 0x74, 0x5f, 0x70, 0x65, 0x65, 0x72
- , 0x78, 0xff, 0x3a, 0x74, 0x38, 0x3a, 0xaa, 0xd4
- , 0xa1, 0x88, 0x7a, 0x8d, 0xc3, 0xd6, 0x31, 0x3a
- , 0x79, 0x31, 0xae, 0x71, 0x65, 0};
+ for (int i = 1024; i < 2048; ++i)
+ b[i]= 'e';
- printf("%s\n", buf);
- bdecode_node e;
- error_code ec;
- int ret = bdecode((char*)buf, (char*)buf + sizeof(buf), e, ec);
- TEST_CHECK(ret == -1);
- }
+ // 1024 levels nested lists
- // test the depth limit
- {
- char b[2048];
- for (int i = 0; i < 1024; ++i)
- b[i]= 'l';
+ bdecode_node e;
+ error_code ec;
+ int ret = bdecode(b, b + sizeof(b), e, ec, NULL, 100);
+ TEST_CHECK(ret != 0);
+ TEST_EQUAL(ec, error_code(bdecode_errors::depth_exceeded
+ , get_bdecode_category()));
+}
- for (int i = 1024; i < 2048; ++i)
- b[i]= 'e';
+// test the item limit
+TORRENT_TEST(item_limit)
+{
+ char b[10240];
+ b[0] = 'l';
+ int i = 1;
+ for (i = 1; i < 10239; i += 2)
+ memcpy(&b[i], "0:", 2);
+ b[i] = 'e';
- // 1024 levels nested lists
+ bdecode_node e;
+ error_code ec;
+ int ret = bdecode(b, b + i + 1, e, ec, NULL, 1000, 1000);
+ TEST_CHECK(ret != 0);
+ TEST_EQUAL(ec, error_code(bdecode_errors::limit_exceeded
+ , get_bdecode_category()));
+}
- bdecode_node e;
- error_code ec;
- int ret = bdecode(b, b + sizeof(b), e, ec, NULL, 100);
- TEST_CHECK(ret != 0);
- TEST_EQUAL(ec, error_code(bdecode_errors::depth_exceeded
- , get_bdecode_category()));
- }
+// test unexpected EOF
+TORRENT_TEST(unepected_eof)
+{
+ char b[] = "l2:.."; // expected terminating 'e'
- // test the item limit
- {
- char b[10240];
- b[0] = 'l';
- int i = 1;
- for (i = 1; i < 10239; i += 2)
- memcpy(&b[i], "0:", 2);
- b[i] = 'e';
+ bdecode_node e;
+ error_code ec;
+ int pos;
+ int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
+ TEST_EQUAL(ret, -1);
+ TEST_EQUAL(pos, 5);
+ TEST_EQUAL(ec, error_code(bdecode_errors::unexpected_eof));
+ printf("%s\n", print_entry(e).c_str());
+}
- bdecode_node e;
- error_code ec;
- int ret = bdecode(b, b + i + 1, e, ec, NULL, 1000, 1000);
- TEST_CHECK(ret != 0);
- TEST_EQUAL(ec, error_code(bdecode_errors::limit_exceeded
- , get_bdecode_category()));
- }
+// test unexpected EOF (really expected terminator)
+TORRENT_TEST(unepected_eof2)
+{
+ char b[] = "l2:..0"; // expected terminating 'e' instead of '0'
- // test unexpected EOF
- {
- char b[] = "l2:.."; // expected terminating 'e'
+ bdecode_node e;
+ error_code ec;
+ int pos;
+ int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
+ TEST_EQUAL(ret, -1);
+ TEST_EQUAL(pos, 6);
+ TEST_EQUAL(ec, error_code(bdecode_errors::expected_colon));
+ printf("%s\n", print_entry(e).c_str());
+}
- bdecode_node e;
- error_code ec;
- int pos;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
- TEST_EQUAL(ret, -1);
- TEST_EQUAL(pos, 5);
- TEST_EQUAL(ec, error_code(bdecode_errors::unexpected_eof));
- printf("%s\n", print_entry(e).c_str());
- }
+// test expected string
+TORRENT_TEST(expected_string)
+{
+ char b[] = "di2ei0ee";
+ // expected string (dict keys must be strings)
- // test unexpected EOF (really expected terminator)
- {
- char b[] = "l2:..0"; // expected terminating 'e' instead of '0'
+ bdecode_node e;
+ error_code ec;
+ int pos;
+ int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
+ TEST_EQUAL(ret, -1);
+ TEST_EQUAL(pos, 1);
+ TEST_EQUAL(ec, error_code(bdecode_errors::expected_digit));
+ printf("%s\n", print_entry(e).c_str());
+}
- bdecode_node e;
- error_code ec;
- int pos;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
- TEST_EQUAL(ret, -1);
- TEST_EQUAL(pos, 6);
- TEST_EQUAL(ec, error_code(bdecode_errors::expected_colon));
- printf("%s\n", print_entry(e).c_str());
- }
+// test unexpected EOF while parsing dict key
+TORRENT_TEST(unexpected_eof_dict_key)
+{
+ char b[] = "d1000:..e";
- // test expected string
- {
- char b[] = "di2ei0ee";
- // expected string (dict keys must be strings)
+ bdecode_node e;
+ error_code ec;
+ int pos;
+ int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
+ TEST_EQUAL(ret, -1);
+ TEST_EQUAL(pos, 5);
+ TEST_EQUAL(ec, error_code(bdecode_errors::unexpected_eof));
+ printf("%s\n", print_entry(e).c_str());
+}
- bdecode_node e;
- error_code ec;
- int pos;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
- TEST_EQUAL(ret, -1);
- TEST_EQUAL(pos, 1);
- TEST_EQUAL(ec, error_code(bdecode_errors::expected_digit));
- printf("%s\n", print_entry(e).c_str());
- }
+// test unexpected EOF while parsing dict key
+TORRENT_TEST(unexpected_eof_dict_key2)
+{
+ char b[] = "d1000:";
- // test unexpected EOF while parsing dict key
- {
- char b[] = "d1000:..e";
+ bdecode_node e;
+ error_code ec;
+ int pos;
+ int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
+ TEST_EQUAL(ret, -1);
+ TEST_EQUAL(pos, 5);
+ TEST_EQUAL(ec, error_code(bdecode_errors::unexpected_eof));
+ printf("%s\n", print_entry(e).c_str());
+}
- bdecode_node e;
- error_code ec;
- int pos;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
- TEST_EQUAL(ret, -1);
- TEST_EQUAL(pos, 5);
- TEST_EQUAL(ec, error_code(bdecode_errors::unexpected_eof));
- printf("%s\n", print_entry(e).c_str());
- }
+// test expected string while parsing dict key
+TORRENT_TEST(expected_string_dict_key2)
+{
+ char b[] = "df00:";
- // test unexpected EOF while parsing dict key
- {
- char b[] = "d1000:";
+ bdecode_node e;
+ error_code ec;
+ int pos;
+ int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
+ TEST_EQUAL(ret, -1);
+ TEST_EQUAL(pos, 1);
+ TEST_EQUAL(ec, error_code(bdecode_errors::expected_digit));
+ printf("%s\n", print_entry(e).c_str());
+}
- bdecode_node e;
- error_code ec;
- int pos;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
- TEST_EQUAL(ret, -1);
- TEST_EQUAL(pos, 5);
- TEST_EQUAL(ec, error_code(bdecode_errors::unexpected_eof));
- printf("%s\n", print_entry(e).c_str());
- }
+// test unexpected EOF while parsing int
+TORRENT_TEST(unexpected_eof_int)
+{
+ char b[] = "i";
- // test expected string while parsing dict key
- {
- char b[] = "df00:";
+ bdecode_node e;
+ error_code ec;
+ int pos;
+ int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
+ TEST_EQUAL(ret, -1);
+ TEST_EQUAL(pos, 1);
+ TEST_EQUAL(ec, error_code(bdecode_errors::unexpected_eof));
+ printf("%s\n", print_entry(e).c_str());
+}
- bdecode_node e;
- error_code ec;
- int pos;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
- TEST_EQUAL(ret, -1);
- TEST_EQUAL(pos, 1);
- TEST_EQUAL(ec, error_code(bdecode_errors::expected_digit));
- printf("%s\n", print_entry(e).c_str());
- }
+// test unexpected EOF while parsing int
+TORRENT_TEST(unexpected_eof_int2)
+{
+ char b[] = "i10";
- // test unexpected EOF while parsing int
- {
- char b[] = "i";
+ bdecode_node e;
+ error_code ec;
+ int pos;
+ int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
+ TEST_EQUAL(ret, -1);
+ TEST_EQUAL(pos, 3);
+ TEST_EQUAL(ec, error_code(bdecode_errors::unexpected_eof));
+ printf("%s\n", print_entry(e).c_str());
+}
- bdecode_node e;
- error_code ec;
- int pos;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
- TEST_EQUAL(ret, -1);
- TEST_EQUAL(pos, 1);
- TEST_EQUAL(ec, error_code(bdecode_errors::unexpected_eof));
- printf("%s\n", print_entry(e).c_str());
- }
- // test unexpected EOF while parsing int
- {
- char b[] = "i10";
+// test expected colon
+TORRENT_TEST(expected_colon_dict)
+{
+ char b[] = "d1000";
- bdecode_node e;
- error_code ec;
- int pos;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
- TEST_EQUAL(ret, -1);
- TEST_EQUAL(pos, 3);
- TEST_EQUAL(ec, error_code(bdecode_errors::unexpected_eof));
- printf("%s\n", print_entry(e).c_str());
- }
+ bdecode_node e;
+ error_code ec;
+ int pos;
+ int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
+ TEST_EQUAL(ret, -1);
+ TEST_EQUAL(pos, 5);
+ TEST_EQUAL(ec, error_code(bdecode_errors::expected_colon));
+ printf("%s\n", print_entry(e).c_str());
+}
+// test empty string
+TORRENT_TEST(empty_string)
+{
+ char b[] = "";
- // test expected colon
- {
- char b[] = "d1000";
+ bdecode_node e;
+ error_code ec;
+ int ret = bdecode(b, b + sizeof(b)-1, e, ec, NULL);
+ TEST_EQUAL(ret, 0);
+ printf("%s\n", print_entry(e).c_str());
+}
- bdecode_node e;
- error_code ec;
- int pos;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
- TEST_EQUAL(ret, -1);
- TEST_EQUAL(pos, 5);
- TEST_EQUAL(ec, error_code(bdecode_errors::expected_colon));
- printf("%s\n", print_entry(e).c_str());
- }
+// test partial string
+TORRENT_TEST(partial_string)
+{
+ char b[] = "100:..";
- // test empty string
+ bdecode_node e;
+ error_code ec;
+ int pos;
+ int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
+ TEST_EQUAL(ret, -1);
+ TEST_EQUAL(pos, 3);
+ TEST_EQUAL(ec, error_code(bdecode_errors::unexpected_eof));
+ printf("%s\n", print_entry(e).c_str());
+}
+
+TORRENT_TEST(list_ints)
+{
+ std::string buf;
+ buf += "l";
+ for (int i = 0; i < 1000; ++i)
{
- char b[] = "";
-
- bdecode_node e;
- error_code ec;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec, NULL);
- TEST_EQUAL(ret, 0);
- printf("%s\n", print_entry(e).c_str());
+ char tmp[20];
+ snprintf(tmp, sizeof(tmp), "i%de", i);
+ buf += tmp;
}
+ buf += "e";
- // test partial string
+ bdecode_node e;
+ error_code ec;
+ int ret = bdecode((char*)&buf[0], (char*)&buf[0] + buf.size(), e, ec);
+ TEST_EQUAL(ret, 0);
+ TEST_EQUAL(e.type(), bdecode_node::list_t);
+ TEST_EQUAL(e.list_size(), 1000);
+ for (int i = 0; i < 1000; ++i)
{
- char b[] = "100:..";
-
- bdecode_node e;
- error_code ec;
- int pos;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
- TEST_EQUAL(ret, -1);
- TEST_EQUAL(pos, 3);
- TEST_EQUAL(ec, error_code(bdecode_errors::unexpected_eof));
- printf("%s\n", print_entry(e).c_str());
+ TEST_EQUAL(e.list_int_value_at(i), i);
}
+}
+TORRENT_TEST(dict_ints)
+{
+ std::string buf;
+ buf += "d";
+ for (int i = 0; i < 1000; ++i)
{
- std::string buf;
- buf += "l";
- for (int i = 0; i < 1000; ++i)
- {
- char tmp[20];
- snprintf(tmp, sizeof(tmp), "i%de", i);
- buf += tmp;
- }
- buf += "e";
-
- bdecode_node e;
- error_code ec;
- int ret = bdecode((char*)&buf[0], (char*)&buf[0] + buf.size(), e, ec);
- TEST_EQUAL(ret, 0);
- TEST_EQUAL(e.type(), bdecode_node::list_t);
- TEST_EQUAL(e.list_size(), 1000);
- for (int i = 0; i < 1000; ++i)
- {
- TEST_EQUAL(e.list_int_value_at(i), i);
- }
+ char tmp[30];
+ snprintf(tmp, sizeof(tmp), "4:%04di%de", i, i);
+ buf += tmp;
}
+ buf += "e";
+ printf("%s\n", buf.c_str());
+ bdecode_node e;
+ error_code ec;
+ int ret = bdecode((char*)&buf[0], (char*)&buf[0] + buf.size(), e, ec);
+ TEST_EQUAL(ret, 0);
+ TEST_EQUAL(e.type(), bdecode_node::dict_t);
+ TEST_EQUAL(e.dict_size(), 1000);
+ for (int i = 0; i < 1000; ++i)
{
- std::string buf;
- buf += "d";
- for (int i = 0; i < 1000; ++i)
- {
- char tmp[30];
- snprintf(tmp, sizeof(tmp), "4:%04di%de", i, i);
- buf += tmp;
- }
- buf += "e";
-
- printf("%s\n", buf.c_str());
- bdecode_node e;
- error_code ec;
- int ret = bdecode((char*)&buf[0], (char*)&buf[0] + buf.size(), e, ec);
- TEST_EQUAL(ret, 0);
- TEST_EQUAL(e.type(), bdecode_node::dict_t);
- TEST_EQUAL(e.dict_size(), 1000);
- for (int i = 0; i < 1000; ++i)
- {
- char tmp[30];
- snprintf(tmp, sizeof(tmp), "%04d", i);
- TEST_EQUAL(e.dict_find_int_value(tmp), i);
- }
+ char tmp[30];
+ snprintf(tmp, sizeof(tmp), "%04d", i);
+ TEST_EQUAL(e.dict_find_int_value(tmp), i);
}
+}
- // test dict_at
- {
- char b[] = "d3:fooi1e3:bari2ee";
+// test dict_at
+TORRENT_TEST(dict_at)
+{
+ char b[] = "d3:fooi1e3:bari2ee";
- bdecode_node e;
- error_code ec;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec);
- TEST_EQUAL(ret, 0);
+ bdecode_node e;
+ error_code ec;
+ int ret = bdecode(b, b + sizeof(b)-1, e, ec);
+ TEST_EQUAL(ret, 0);
- TEST_EQUAL(e.type(), bdecode_node::dict_t);
- TEST_EQUAL(e.dict_size(), 2);
- TEST_EQUAL(e.dict_at(0).first, "foo");
- TEST_EQUAL(e.dict_at(0).second.type(), bdecode_node::int_t);
- TEST_EQUAL(e.dict_at(0).second.int_value(), 1);
- TEST_EQUAL(e.dict_at(1).first, "bar");
- TEST_EQUAL(e.dict_at(1).second.type(), bdecode_node::int_t);
- TEST_EQUAL(e.dict_at(1).second.int_value(), 2);
- }
+ TEST_EQUAL(e.type(), bdecode_node::dict_t);
+ TEST_EQUAL(e.dict_size(), 2);
+ TEST_EQUAL(e.dict_at(0).first, "foo");
+ TEST_EQUAL(e.dict_at(0).second.type(), bdecode_node::int_t);
+ TEST_EQUAL(e.dict_at(0).second.int_value(), 1);
+ TEST_EQUAL(e.dict_at(1).first, "bar");
+ TEST_EQUAL(e.dict_at(1).second.type(), bdecode_node::int_t);
+ TEST_EQUAL(e.dict_at(1).second.int_value(), 2);
+}
- // test string_ptr
- {
- char b[] = "l3:fooe";
+// test string_ptr
+TORRENT_TEST(string_ptr)
+{
+ char b[] = "l3:fooe";
- bdecode_node e;
- error_code ec;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec);
- TEST_EQUAL(ret, 0);
+ bdecode_node e;
+ error_code ec;
+ int ret = bdecode(b, b + sizeof(b)-1, e, ec);
+ TEST_EQUAL(ret, 0);
- TEST_EQUAL(e.type(), bdecode_node::list_t);
- TEST_EQUAL(e.list_size(), 1);
- TEST_EQUAL(e.list_at(0).type(), bdecode_node::string_t);
- TEST_EQUAL(e.list_at(0).string_ptr(), b + 3);
- TEST_EQUAL(e.list_at(0).string_length(), 3);
- }
+ TEST_EQUAL(e.type(), bdecode_node::list_t);
+ TEST_EQUAL(e.list_size(), 1);
+ TEST_EQUAL(e.list_at(0).type(), bdecode_node::string_t);
+ TEST_EQUAL(e.list_at(0).string_ptr(), b + 3);
+ TEST_EQUAL(e.list_at(0).string_length(), 3);
+}
- // test exceeding buffer size limit
- {
- char b[] = "l3:fooe";
+// test exceeding buffer size limit
+TORRENT_TEST(exceed_buf_limit)
+{
+ char b[] = "l3:fooe";
- bdecode_node e;
- error_code ec;
- int ret = bdecode(b, b + 0x3fffffff, e, ec);
- TEST_EQUAL(ret, -1);
- TEST_EQUAL(ec, error_code(bdecode_errors::limit_exceeded));
- printf("%s\n", print_entry(e).c_str());
- }
+ bdecode_node e;
+ error_code ec;
+ int ret = bdecode(b, b + 0x3fffffff, e, ec);
+ TEST_EQUAL(ret, -1);
+ TEST_EQUAL(ec, error_code(bdecode_errors::limit_exceeded));
+ printf("%s\n", print_entry(e).c_str());
+}
- // test parse_int
- {
- char b[] = "1234567890e";
- boost::int64_t val = 0;
- bdecode_errors::error_code_enum ec;
- char const* e = parse_int(b, b + sizeof(b)-1, 'e', val, ec);
- TEST_EQUAL(val, 1234567890);
- TEST_EQUAL(e, b + sizeof(b) - 2);
- }
+// test parse_int
+TORRENT_TEST(parse_int)
+{
+ char b[] = "1234567890e";
+ boost::int64_t val = 0;
+ bdecode_errors::error_code_enum ec;
+ char const* e = parse_int(b, b + sizeof(b)-1, 'e', val, ec);
+ TEST_EQUAL(val, 1234567890);
+ TEST_EQUAL(e, b + sizeof(b) - 2);
+}
- // test invalid digit
- {
- char b[] = "0o";
- boost::int64_t val = 0;
- bdecode_errors::error_code_enum ec;
- char const* e = parse_int(b, b + sizeof(b)-1, 'e', val, ec);
- TEST_EQUAL(ec, bdecode_errors::expected_digit);
- TEST_EQUAL(e, b + 1);
- }
+// test invalid digit
+TORRENT_TEST(invalid_digit)
+{
+ char b[] = "0o";
+ boost::int64_t val = 0;
+ bdecode_errors::error_code_enum ec;
+ char const* e = parse_int(b, b + sizeof(b)-1, 'e', val, ec);
+ TEST_EQUAL(ec, bdecode_errors::expected_digit);
+ TEST_EQUAL(e, b + 1);
+}
- // test parse_int overflow
- {
- char b[] = "9223372036854775808:";
- boost::int64_t val = 0;
- bdecode_errors::error_code_enum ec;
- char const* e = parse_int(b, b + sizeof(b)-1, ':', val, ec);
- TEST_EQUAL(ec, bdecode_errors::overflow);
- TEST_EQUAL(e, b + 18);
- }
+// test parse_int overflow
+TORRENT_TEST(parse_int_overflow)
+{
+ char b[] = "9223372036854775808:";
+ boost::int64_t val = 0;
+ bdecode_errors::error_code_enum ec;
+ char const* e = parse_int(b, b + sizeof(b)-1, ':', val, ec);
+ TEST_EQUAL(ec, bdecode_errors::overflow);
+ TEST_EQUAL(e, b + 18);
+}
- {
- char b[] = "928";
- boost::int64_t val = 0;
- bdecode_errors::error_code_enum ec;
- char const* e = parse_int(b, b + sizeof(b)-1, ':', val, ec);
- TEST_EQUAL(ec, bdecode_errors::expected_colon);
- TEST_EQUAL(e, b + 3);
- }
+TORRENT_TEST(expected_colon_string)
+{
+ char b[] = "928";
+ boost::int64_t val = 0;
+ bdecode_errors::error_code_enum ec;
+ char const* e = parse_int(b, b + sizeof(b)-1, ':', val, ec);
+ TEST_EQUAL(ec, bdecode_errors::expected_colon);
+ TEST_EQUAL(e, b + 3);
+}
- // test dict_find_* functions
- {
- // a: int
- // b: string
- // c: list
- // d: dict
- char b[] = "d1:ai1e1:b3:foo1:cli1ei2ee1:dd1:xi1eee";
- bdecode_node e;
- error_code ec;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec);
- TEST_EQUAL(ret, 0);
- printf("%s\n", print_entry(e).c_str());
+// test dict_find_* functions
+TORRENT_TEST(dict_find_funs)
+{
+ // a: int
+ // b: string
+ // c: list
+ // d: dict
+ char b[] = "d1:ai1e1:b3:foo1:cli1ei2ee1:dd1:xi1eee";
+ bdecode_node e;
+ error_code ec;
+ int ret = bdecode(b, b + sizeof(b)-1, e, ec);
+ TEST_EQUAL(ret, 0);
+ printf("%s\n", print_entry(e).c_str());
- TEST_EQUAL(e.type(), bdecode_node::dict_t);
+ TEST_EQUAL(e.type(), bdecode_node::dict_t);
- // dict_find_int*
+ // dict_find_int*
- TEST_EQUAL(e.dict_find_int_value("a"), 1);
- TEST_EQUAL(e.dict_find_int("a").type(), bdecode_node::int_t);
- TEST_EQUAL(e.dict_find_int_value("b", -10), -10);
- TEST_EQUAL(e.dict_find_int_value("x", -10), -10);
- TEST_EQUAL(e.dict_find_int("b").type(), bdecode_node::none_t);
- TEST_EQUAL(e.dict_find_int("x").type(), bdecode_node::none_t);
+ TEST_EQUAL(e.dict_find_int_value("a"), 1);
+ TEST_EQUAL(e.dict_find_int("a").type(), bdecode_node::int_t);
+ TEST_EQUAL(e.dict_find_int_value("b", -10), -10);
+ TEST_EQUAL(e.dict_find_int_value("x", -10), -10);
+ TEST_EQUAL(e.dict_find_int("b").type(), bdecode_node::none_t);
+ TEST_EQUAL(e.dict_find_int("x").type(), bdecode_node::none_t);
- // dict_find_string*
+ // dict_find_string*
- TEST_EQUAL(e.dict_find_string_value("b"), "foo");
- TEST_EQUAL(e.dict_find_string("b").type(), bdecode_node::string_t);
- TEST_EQUAL(e.dict_find_string_value("c", "blah"), "blah");
- TEST_EQUAL(e.dict_find_string_value("x", "blah"), "blah");
- TEST_EQUAL(e.dict_find_string("c").type(), bdecode_node::none_t);
- TEST_EQUAL(e.dict_find_string("x").type(), bdecode_node::none_t);
+ TEST_EQUAL(e.dict_find_string_value("b"), "foo");
+ TEST_EQUAL(e.dict_find_string("b").type(), bdecode_node::string_t);
+ TEST_EQUAL(e.dict_find_string_value("c", "blah"), "blah");
+ TEST_EQUAL(e.dict_find_string_value("x", "blah"), "blah");
+ TEST_EQUAL(e.dict_find_string("c").type(), bdecode_node::none_t);
+ TEST_EQUAL(e.dict_find_string("x").type(), bdecode_node::none_t);
- // dict_find_list
+ // dict_find_list
- TEST_CHECK(e.dict_find_list("c"));
- TEST_EQUAL(e.dict_find_list("c").list_size(), 2);
- TEST_EQUAL(e.dict_find_list("c").list_int_value_at(0), 1);
- TEST_EQUAL(e.dict_find_list("c").list_int_value_at(1), 2);
- TEST_CHECK(!e.dict_find_list("d"));
+ TEST_CHECK(e.dict_find_list("c"));
+ TEST_EQUAL(e.dict_find_list("c").list_size(), 2);
+ TEST_EQUAL(e.dict_find_list("c").list_int_value_at(0), 1);
+ TEST_EQUAL(e.dict_find_list("c").list_int_value_at(1), 2);
+ TEST_CHECK(!e.dict_find_list("d"));
- // dict_find_dict
+ // dict_find_dict
- TEST_CHECK(e.dict_find_dict("d"));
- TEST_EQUAL(e.dict_find_dict("d").dict_find_int_value("x"), 1);
- TEST_EQUAL(e.dict_find_dict("d").dict_find_int_value("y", -10), -10);
- TEST_CHECK(!e.dict_find_dict("c"));
+ TEST_CHECK(e.dict_find_dict("d"));
+ TEST_EQUAL(e.dict_find_dict("d").dict_find_int_value("x"), 1);
+ TEST_EQUAL(e.dict_find_dict("d").dict_find_int_value("y", -10), -10);
+ TEST_CHECK(!e.dict_find_dict("c"));
- // variants taking std::string
- TEST_EQUAL(e.dict_find_dict(std::string("d")).dict_find_int_value("x"), 1);
- TEST_CHECK(!e.dict_find_dict(std::string("c")));
- TEST_CHECK(!e.dict_find_dict(std::string("x")));
+ // variants taking std::string
+ TEST_EQUAL(e.dict_find_dict(std::string("d")).dict_find_int_value("x"), 1);
+ TEST_CHECK(!e.dict_find_dict(std::string("c")));
+ TEST_CHECK(!e.dict_find_dict(std::string("x")));
- TEST_EQUAL(e.dict_size(), 4);
- TEST_EQUAL(e.dict_size(), 4);
+ TEST_EQUAL(e.dict_size(), 4);
+ TEST_EQUAL(e.dict_size(), 4);
- // dict_at
+ // dict_at
- TEST_EQUAL(e.dict_at(0).first, "a");
- TEST_EQUAL(e.dict_at(0).second.int_value(), 1);
- TEST_EQUAL(e.dict_at(1).first, "b");
- TEST_EQUAL(e.dict_at(1).second.string_value(), "foo");
- TEST_EQUAL(e.dict_at(2).first, "c");
- TEST_EQUAL(e.dict_at(2).second.type(), bdecode_node::list_t);
- TEST_EQUAL(e.dict_at(3).first, "d");
- TEST_EQUAL(e.dict_at(3).second.type(), bdecode_node::dict_t);
- }
+ TEST_EQUAL(e.dict_at(0).first, "a");
+ TEST_EQUAL(e.dict_at(0).second.int_value(), 1);
+ TEST_EQUAL(e.dict_at(1).first, "b");
+ TEST_EQUAL(e.dict_at(1).second.string_value(), "foo");
+ TEST_EQUAL(e.dict_at(2).first, "c");
+ TEST_EQUAL(e.dict_at(2).second.type(), bdecode_node::list_t);
+ TEST_EQUAL(e.dict_at(3).first, "d");
+ TEST_EQUAL(e.dict_at(3).second.type(), bdecode_node::dict_t);
+}
- // test list_*_at functions
- {
- // int
- // string
- // list
- // dict
- char b[] = "li1e3:fooli1ei2eed1:xi1eee";
- bdecode_node e;
- error_code ec;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec);
- TEST_EQUAL(ret, 0);
- printf("%s\n", print_entry(e).c_str());
+// test list_*_at functions
+TORRENT_TEST(list_at_funs)
+{
+ // int
+ // string
+ // list
+ // dict
+ char b[] = "li1e3:fooli1ei2eed1:xi1eee";
+ bdecode_node e;
+ error_code ec;
+ int ret = bdecode(b, b + sizeof(b)-1, e, ec);
+ TEST_EQUAL(ret, 0);
+ printf("%s\n", print_entry(e).c_str());
- TEST_EQUAL(e.type(), bdecode_node::list_t);
+ TEST_EQUAL(e.type(), bdecode_node::list_t);
- TEST_EQUAL(e.list_int_value_at(0), 1);
- // make sure default values work
- TEST_EQUAL(e.list_int_value_at(1, -10), -10);
+ TEST_EQUAL(e.list_int_value_at(0), 1);
+ // make sure default values work
+ TEST_EQUAL(e.list_int_value_at(1, -10), -10);
- TEST_EQUAL(e.list_string_value_at(1), "foo");
- // make sure default values work
- TEST_EQUAL(e.list_string_value_at(2, "blah"), "blah");
+ TEST_EQUAL(e.list_string_value_at(1), "foo");
+ // make sure default values work
+ TEST_EQUAL(e.list_string_value_at(2, "blah"), "blah");
- TEST_EQUAL(e.list_at(2).type(), bdecode_node::list_t);
- TEST_EQUAL(e.list_at(2).list_size(), 2);
- TEST_EQUAL(e.list_at(2).list_int_value_at(0), 1);
- TEST_EQUAL(e.list_at(2).list_int_value_at(1), 2);
+ TEST_EQUAL(e.list_at(2).type(), bdecode_node::list_t);
+ TEST_EQUAL(e.list_at(2).list_size(), 2);
+ TEST_EQUAL(e.list_at(2).list_int_value_at(0), 1);
+ TEST_EQUAL(e.list_at(2).list_int_value_at(1), 2);
- TEST_EQUAL(e.list_at(3).type(), bdecode_node::dict_t);
- TEST_EQUAL(e.list_at(3).dict_size(), 1);
- TEST_EQUAL(e.list_at(3).dict_find_int_value("x"), 1);
- TEST_EQUAL(e.list_at(3).dict_find_int_value("y", -10), -10);
+ TEST_EQUAL(e.list_at(3).type(), bdecode_node::dict_t);
+ TEST_EQUAL(e.list_at(3).dict_size(), 1);
+ TEST_EQUAL(e.list_at(3).dict_find_int_value("x"), 1);
+ TEST_EQUAL(e.list_at(3).dict_find_int_value("y", -10), -10);
- TEST_EQUAL(e.list_size(), 4);
- TEST_EQUAL(e.list_size(), 4);
- }
+ TEST_EQUAL(e.list_size(), 4);
+ TEST_EQUAL(e.list_size(), 4);
+}
- // test list_at in reverse order
- {
- // int
- // string
- // list
- // dict
- char b[] = "li1e3:fooli1ei2eed1:xi1eee";
- bdecode_node e;
- error_code ec;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec);
- TEST_EQUAL(ret, 0);
- printf("%s\n", print_entry(e).c_str());
+// test list_at in reverse order
+TORRENT_TEST(list_at_reverse)
+{
+ // int
+ // string
+ // list
+ // dict
+ char b[] = "li1e3:fooli1ei2eed1:xi1eee";
+ bdecode_node e;
+ error_code ec;
+ int ret = bdecode(b, b + sizeof(b)-1, e, ec);
+ TEST_EQUAL(ret, 0);
+ printf("%s\n", print_entry(e).c_str());
- TEST_EQUAL(e.type(), bdecode_node::list_t);
+ TEST_EQUAL(e.type(), bdecode_node::list_t);
- TEST_EQUAL(e.list_at(3).type(), bdecode_node::dict_t);
- TEST_EQUAL(e.list_at(2).type(), bdecode_node::list_t);
- TEST_EQUAL(e.list_string_value_at(1), "foo");
- TEST_EQUAL(e.list_int_value_at(0), 1);
+ TEST_EQUAL(e.list_at(3).type(), bdecode_node::dict_t);
+ TEST_EQUAL(e.list_at(2).type(), bdecode_node::list_t);
+ TEST_EQUAL(e.list_string_value_at(1), "foo");
+ TEST_EQUAL(e.list_int_value_at(0), 1);
- TEST_EQUAL(e.list_size(), 4);
- TEST_EQUAL(e.list_size(), 4);
- }
+ TEST_EQUAL(e.list_size(), 4);
+ TEST_EQUAL(e.list_size(), 4);
+}
- // test dict_find_* functions
- {
- // a: int
- // b: string
- // c: list
- // d: dict
- char b[] = "d1:ai1e1:b3:foo1:cli1ei2ee1:dd1:xi1eee";
- bdecode_node e;
- error_code ec;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec);
- TEST_EQUAL(ret, 0);
- printf("%s\n", print_entry(e).c_str());
+// test dict_find_* functions
+TORRENT_TEST(dict_find_funs2)
+{
+ // a: int
+ // b: string
+ // c: list
+ // d: dict
+ char b[] = "d1:ai1e1:b3:foo1:cli1ei2ee1:dd1:xi1eee";
+ bdecode_node e;
+ error_code ec;
+ int ret = bdecode(b, b + sizeof(b)-1, e, ec);
+ TEST_EQUAL(ret, 0);
+ printf("%s\n", print_entry(e).c_str());
- TEST_EQUAL(e.type(), bdecode_node::dict_t);
+ TEST_EQUAL(e.type(), bdecode_node::dict_t);
- // try finding the last item in a dict (to skip all the other ones)
- TEST_EQUAL(e.dict_find("d").type(), bdecode_node::dict_t);
- TEST_EQUAL(e.dict_find(std::string("d")).type(), bdecode_node::dict_t);
- }
+ // try finding the last item in a dict (to skip all the other ones)
+ TEST_EQUAL(e.dict_find("d").type(), bdecode_node::dict_t);
+ TEST_EQUAL(e.dict_find(std::string("d")).type(), bdecode_node::dict_t);
+}
- // print_entry
+// print_entry
- {
- char b[] = "li1e3:fooli1ei2eed1:xi1eee";
- bdecode_node e;
- error_code ec;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec);
- TEST_EQUAL(ret, 0);
- printf("%s\n", print_entry(e).c_str());
+TORRENT_TEST(print_entry)
+{
+ char b[] = "li1e3:fooli1ei2eed1:xi1eee";
+ bdecode_node e;
+ error_code ec;
+ int ret = bdecode(b, b + sizeof(b)-1, e, ec);
+ TEST_EQUAL(ret, 0);
+ printf("%s\n", print_entry(e).c_str());
- TEST_EQUAL(print_entry(e), "[ 1, 'foo', [ 1, 2 ], { 'x': 1 } ]");
- }
+ TEST_EQUAL(print_entry(e), "[ 1, 'foo', [ 1, 2 ], { 'x': 1 } ]");
+}
- {
- char b[] = "d1:ai1e1:b3:foo1:cli1ei2ee1:dd1:xi1eee";
- bdecode_node e;
- error_code ec;
- int ret = bdecode(b, b + sizeof(b)-1, e, ec);
- TEST_EQUAL(ret, 0);
- printf("%s\n", print_entry(e).c_str());
+TORRENT_TEST(print_entry2)
+{
+ char b[] = "d1:ai1e1:b3:foo1:cli1ei2ee1:dd1:xi1eee";
+ bdecode_node e;
+ error_code ec;
+ int ret = bdecode(b, b + sizeof(b)-1, e, ec);
+ TEST_EQUAL(ret, 0);
+ printf("%s\n", print_entry(e).c_str());
- TEST_EQUAL(print_entry(e), "{ 'a': 1, 'b': 'foo', 'c': [ 1, 2 ], 'd': { 'x': 1 } }");
- }
+ TEST_EQUAL(print_entry(e), "{ 'a': 1, 'b': 'foo', 'c': [ 1, 2 ], 'd': { 'x': 1 } }");
+}
- // test swap()
- {
- char b1[] = "d1:ai1e1:b3:foo1:cli1ei2ee1:dd1:xi1eee";
- char b2[] = "i1e";
+// test swap()
+TORRENT_TEST(swap)
+{
+ char b1[] = "d1:ai1e1:b3:foo1:cli1ei2ee1:dd1:xi1eee";
+ char b2[] = "i1e";
- bdecode_node e1;
- bdecode_node e2;
+ bdecode_node e1;
+ bdecode_node e2;
- error_code ec;
+ error_code ec;
- int ret = bdecode(b1, b1 + sizeof(b1)-1, e1, ec);
- TEST_EQUAL(ret, 0);
- ret = bdecode(b2, b2 + sizeof(b2)-1, e2, ec);
- TEST_EQUAL(ret, 0);
+ int ret = bdecode(b1, b1 + sizeof(b1)-1, e1, ec);
+ TEST_EQUAL(ret, 0);
+ ret = bdecode(b2, b2 + sizeof(b2)-1, e2, ec);
+ TEST_EQUAL(ret, 0);
- std::string str1 = print_entry(e1);
- std::string str2 = print_entry(e2);
- TEST_EQUAL(e1.type(), bdecode_node::dict_t);
- TEST_EQUAL(e2.type(), bdecode_node::int_t);
- printf("%s\n", print_entry(e1).c_str());
+ std::string str1 = print_entry(e1);
+ std::string str2 = print_entry(e2);
+ TEST_EQUAL(e1.type(), bdecode_node::dict_t);
+ TEST_EQUAL(e2.type(), bdecode_node::int_t);
+ printf("%s\n", print_entry(e1).c_str());
- e1.swap(e2);
+ e1.swap(e2);
- TEST_EQUAL(e1.type(), bdecode_node::int_t);
- TEST_EQUAL(e2.type(), bdecode_node::dict_t);
- TEST_EQUAL(print_entry(e1), str2);
- TEST_EQUAL(print_entry(e2), str1);
- printf("%s\n", print_entry(e1).c_str());
+ TEST_EQUAL(e1.type(), bdecode_node::int_t);
+ TEST_EQUAL(e2.type(), bdecode_node::dict_t);
+ TEST_EQUAL(print_entry(e1), str2);
+ TEST_EQUAL(print_entry(e2), str1);
+ printf("%s\n", print_entry(e1).c_str());
- e1.swap(e2);
+ e1.swap(e2);
- TEST_EQUAL(e1.type(), bdecode_node::dict_t);
- TEST_EQUAL(e2.type(), bdecode_node::int_t);
- TEST_EQUAL(print_entry(e1), str1);
- TEST_EQUAL(print_entry(e2), str2);
- printf("%s\n", print_entry(e1).c_str());
- }
+ TEST_EQUAL(e1.type(), bdecode_node::dict_t);
+ TEST_EQUAL(e2.type(), bdecode_node::int_t);
+ TEST_EQUAL(print_entry(e1), str1);
+ TEST_EQUAL(print_entry(e2), str2);
+ printf("%s\n", print_entry(e1).c_str());
+}
- // test swap() (one node is the root of the other node)
- {
- char b1[] = "d1:ai1e1:b3:foo1:cli1ei2ee1:dd1:xi1eee";
+// test swap() (one node is the root of the other node)
+TORRENT_TEST(swap_root)
+{
+ char b1[] = "d1:ai1e1:b3:foo1:cli1ei2ee1:dd1:xi1eee";
- bdecode_node e1;
- bdecode_node e2;
+ bdecode_node e1;
+ bdecode_node e2;
- error_code ec;
+ error_code ec;
- int ret = bdecode(b1, b1 + sizeof(b1)-1, e1, ec);
- TEST_EQUAL(ret, 0);
+ int ret = bdecode(b1, b1 + sizeof(b1)-1, e1, ec);
+ TEST_EQUAL(ret, 0);
- e2 = e1.dict_find("c").list_at(0);
+ e2 = e1.dict_find("c").list_at(0);
- std::string str1 = print_entry(e1);
- std::string str2 = print_entry(e2);
- TEST_EQUAL(e1.type(), bdecode_node::dict_t);
- TEST_EQUAL(e2.type(), bdecode_node::int_t);
- printf("%s\n", print_entry(e1).c_str());
+ std::string str1 = print_entry(e1);
+ std::string str2 = print_entry(e2);
+ TEST_EQUAL(e1.type(), bdecode_node::dict_t);
+ TEST_EQUAL(e2.type(), bdecode_node::int_t);
+ printf("%s\n", print_entry(e1).c_str());
- e1.swap(e2);
+ e1.swap(e2);
- TEST_EQUAL(e1.type(), bdecode_node::int_t);
- TEST_EQUAL(e2.type(), bdecode_node::dict_t);
- TEST_EQUAL(print_entry(e1), str2);
- TEST_EQUAL(print_entry(e2), str1);
- printf("%s\n", print_entry(e1).c_str());
+ TEST_EQUAL(e1.type(), bdecode_node::int_t);
+ TEST_EQUAL(e2.type(), bdecode_node::dict_t);
+ TEST_EQUAL(print_entry(e1), str2);
+ TEST_EQUAL(print_entry(e2), str1);
+ printf("%s\n", print_entry(e1).c_str());
- // swap back
- e1.swap(e2);
+ // swap back
+ e1.swap(e2);
- TEST_EQUAL(e1.type(), bdecode_node::dict_t);
- TEST_EQUAL(e2.type(), bdecode_node::int_t);
- TEST_EQUAL(print_entry(e1), str1);
- TEST_EQUAL(print_entry(e2), str2);
- printf("%s\n", print_entry(e1).c_str());
- }
+ TEST_EQUAL(e1.type(), bdecode_node::dict_t);
+ TEST_EQUAL(e2.type(), bdecode_node::int_t);
+ TEST_EQUAL(print_entry(e1), str1);
+ TEST_EQUAL(print_entry(e2), str2);
+ printf("%s\n", print_entry(e1).c_str());
+}
- // test swap() (neither is a root and they don't share a root)
- {
- char b1[] = "d1:ai1e1:b3:foo1:cli1ei2ee1:dd1:xi1eee";
- char b2[] = "li1e3:fooli1ei2eed1:xi1eee";
+// test swap() (neither is a root and they don't share a root)
+TORRENT_TEST(swap_disjoint)
+{
+ char b1[] = "d1:ai1e1:b3:foo1:cli1ei2ee1:dd1:xi1eee";
+ char b2[] = "li1e3:fooli1ei2eed1:xi1eee";
- bdecode_node e1_root;
- bdecode_node e2_root;
+ bdecode_node e1_root;
+ bdecode_node e2_root;
- error_code ec;
+ error_code ec;
- int ret = bdecode(b1, b1 + sizeof(b1)-1, e1_root, ec);
- TEST_EQUAL(ret, 0);
- ret = bdecode(b2, b2 + sizeof(b2)-1, e2_root, ec);
- TEST_EQUAL(ret, 0);
+ int ret = bdecode(b1, b1 + sizeof(b1)-1, e1_root, ec);
+ TEST_EQUAL(ret, 0);
+ ret = bdecode(b2, b2 + sizeof(b2)-1, e2_root, ec);
+ TEST_EQUAL(ret, 0);
- bdecode_node e1 = e1_root.dict_find("c").list_at(0);
- bdecode_node e2 = e2_root.list_at(1);
+ bdecode_node e1 = e1_root.dict_find("c").list_at(0);
+ bdecode_node e2 = e2_root.list_at(1);
- std::string str1 = print_entry(e1);
- std::string str2 = print_entry(e2);
- TEST_EQUAL(e1.type(), bdecode_node::int_t);
- TEST_EQUAL(e2.type(), bdecode_node::string_t);
+ std::string str1 = print_entry(e1);
+ std::string str2 = print_entry(e2);
+ TEST_EQUAL(e1.type(), bdecode_node::int_t);
+ TEST_EQUAL(e2.type(), bdecode_node::string_t);
- e1.swap(e2);
+ e1.swap(e2);
- TEST_EQUAL(e1.type(), bdecode_node::string_t);
- TEST_EQUAL(e2.type(), bdecode_node::int_t);
- TEST_EQUAL(print_entry(e1), str2);
- TEST_EQUAL(print_entry(e2), str1);
+ TEST_EQUAL(e1.type(), bdecode_node::string_t);
+ TEST_EQUAL(e2.type(), bdecode_node::int_...
[truncated message content] |
|
From: <ar...@us...> - 2015-05-31 09:02:44
|
Revision: 11133
http://sourceforge.net/p/libtorrent/code/11133
Author: arvidn
Date: 2015-05-31 09:02:42 +0000 (Sun, 31 May 2015)
Log Message:
-----------
more msvc fixes
Modified Paths:
--------------
trunk/include/libtorrent/settings_pack.hpp
trunk/src/asio.cpp
Modified: trunk/include/libtorrent/settings_pack.hpp
===================================================================
--- trunk/include/libtorrent/settings_pack.hpp 2015-05-30 21:46:59 UTC (rev 11132)
+++ trunk/include/libtorrent/settings_pack.hpp 2015-05-31 09:02:42 UTC (rev 11133)
@@ -35,10 +35,7 @@
#include "libtorrent/entry.hpp"
#include <vector>
-
-#ifndef TORRENT_NO_DEPRECATE
#include <boost/smart_ptr.hpp>
-#endif
// OVERVIEW
//
Modified: trunk/src/asio.cpp
===================================================================
--- trunk/src/asio.cpp 2015-05-30 21:46:59 UTC (rev 11132)
+++ trunk/src/asio.cpp 2015-05-31 09:02:42 UTC (rev 11133)
@@ -1,14 +1,13 @@
// builds all boost.asio source as a separate compilation unit
#include <boost/version.hpp>
+#include <boost/preprocessor/facilities/is_empty.hpp>
#include "libtorrent/config.hpp"
// only define BOOST_ASIO_DECL if it hasn't already been defined
// or if it has been defined to an empty string
-#define TORRENT_IS_EMPTY_IMPL(VAL) VAL ## 1
-#define TORRENT_IS_EMPTY(VAL) TORRENT_IS_EMPTY_IMPL(VAL)
-#if !defined BOOST_ASIO_DECL || TORRENT_IS_EMPTY(BOOST_ASIO_DECL) == 1
+#if !defined BOOST_ASIO_DECL || !BOOST_PP_IS_EMPTY(BOOST_ASIO_DECL)
#ifdef BOOST_ASIO_DECL
#undef BOOST_ASIO_DECL
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ar...@us...> - 2015-05-30 21:47:02
|
Revision: 11132
http://sourceforge.net/p/libtorrent/code/11132
Author: arvidn
Date: 2015-05-30 21:46:59 +0000 (Sat, 30 May 2015)
Log Message:
-----------
some msvc fixes
Modified Paths:
--------------
trunk/include/libtorrent/disk_io_job.hpp
trunk/include/libtorrent/identify_client.hpp
trunk/include/libtorrent/kademlia/node.hpp
trunk/test/main.cpp
trunk/test/test_auto_unchoke.cpp
trunk/test/test_checking.cpp
trunk/test/test_fast_extension.cpp
trunk/test/test_http_connection.cpp
trunk/test/test_lsd.cpp
trunk/test/test_metadata_extension.cpp
trunk/test/test_pe_crypto.cpp
trunk/test/test_peer_classes.cpp
trunk/test/test_pex.cpp
trunk/test/test_primitives.cpp
trunk/test/test_priority.cpp
trunk/test/test_privacy.cpp
trunk/test/test_read_piece.cpp
trunk/test/test_recheck.cpp
trunk/test/test_remap_files.cpp
trunk/test/test_resume.cpp
trunk/test/test_session.cpp
trunk/test/test_ssl.cpp
trunk/test/test_stat_cache.cpp
trunk/test/test_storage.cpp
trunk/test/test_super_seeding.cpp
trunk/test/test_swarm.cpp
trunk/test/test_time_critical.cpp
trunk/test/test_torrent.cpp
trunk/test/test_tracker.cpp
trunk/test/test_trackers_extension.cpp
trunk/test/test_url_seed.cpp
trunk/test/test_utf8.cpp
trunk/test/test_utp.cpp
trunk/test/test_web_seed.cpp
trunk/test/test_web_seed_ban.cpp
trunk/test/test_web_seed_chunked.cpp
trunk/test/test_web_seed_http.cpp
trunk/test/test_web_seed_http_pw.cpp
trunk/test/test_web_seed_redirect.cpp
trunk/test/test_web_seed_socks4.cpp
trunk/test/test_web_seed_socks5.cpp
trunk/test/test_web_seed_socks5_pw.cpp
Modified: trunk/include/libtorrent/disk_io_job.hpp
===================================================================
--- trunk/include/libtorrent/disk_io_job.hpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/include/libtorrent/disk_io_job.hpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -53,7 +53,7 @@
class piece_manager;
struct cached_piece_entry;
struct bdecode_node;
- struct torrent_info;
+ class torrent_info;
struct block_cache_reference
{
Modified: trunk/include/libtorrent/identify_client.hpp
===================================================================
--- trunk/include/libtorrent/identify_client.hpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/include/libtorrent/identify_client.hpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -53,15 +53,16 @@
// This function can can be used to extract a string describing a client
// version from its peer-id. It will recognize most clients that have this
// kind of identification in the peer-id.
- TORRENT_DEPRECATED_EXPORT std::string identify_client(const peer_id& p)
- TORRENT_DEPRECATED;
+ TORRENT_DEPRECATED_EXPORT TORRENT_DEPRECATED
+ std::string identify_client(const peer_id& p);
// Returns an optional fingerprint if any can be identified from the peer
// id. This can be used to automate the identification of clients. It will
// not be able to identify peers with non- standard encodings. Only Azureus
// style, Shadow's style and Mainline style.
- TORRENT_DEPRECATED_EXPORT boost::optional<fingerprint>
- client_fingerprint(peer_id const& p) TORRENT_DEPRECATED;
+ TORRENT_DEPRECATED_EXPORT TORRENT_DEPRECATED
+ boost::optional<fingerprint>
+ client_fingerprint(peer_id const& p);
}
Modified: trunk/include/libtorrent/kademlia/node.hpp
===================================================================
--- trunk/include/libtorrent/kademlia/node.hpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/include/libtorrent/kademlia/node.hpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -176,12 +176,12 @@
struct count_peers
{
- int& count;
- count_peers(int& c): count(c) {}
+ int* count;
+ count_peers(int* c): count(c) {}
void operator()(std::pair<libtorrent::dht::node_id
, libtorrent::dht::torrent_entry> const& t)
{
- count += t.second.peers.size();
+ *count += t.second.peers.size();
}
};
@@ -218,7 +218,7 @@
int num_peers() const
{
int ret = 0;
- std::for_each(m_map.begin(), m_map.end(), count_peers(ret));
+ std::for_each(m_map.begin(), m_map.end(), count_peers(&ret));
return ret;
}
Modified: trunk/test/main.cpp
===================================================================
--- trunk/test/main.cpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/test/main.cpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -49,6 +49,11 @@
#ifdef WIN32
#include <windows.h> // fot SetErrorMode
+#include <io.h> // for _dup and _dup2
+
+#define dup _dup
+#define dup2 _dup2
+
#endif
using namespace libtorrent;
Modified: trunk/test/test_auto_unchoke.cpp
===================================================================
--- trunk/test/test_auto_unchoke.cpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/test/test_auto_unchoke.cpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -149,7 +149,5 @@
remove_all("./tmp1_unchoke", ec);
remove_all("./tmp2_unchoke", ec);
remove_all("./tmp3_unchoke", ec);
-
- return 0;
}
Modified: trunk/test/test_checking.cpp
===================================================================
--- trunk/test/test_checking.cpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/test/test_checking.cpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -282,7 +282,5 @@
test_checking(read_only_files);
test_checking(incomplete_files);
test_checking(corrupt_files);
-
- return 0;
}
Modified: trunk/test/test_fast_extension.cpp
===================================================================
--- trunk/test/test_fast_extension.cpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/test/test_fast_extension.cpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -795,7 +795,5 @@
test_multiple_have_all();
test_dont_have();
test_invalid_metadata_requests();
-
- return 0;
}
Modified: trunk/test/test_http_connection.cpp
===================================================================
--- trunk/test/test_http_connection.cpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/test/test_http_connection.cpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -244,6 +244,5 @@
stop_web_server();
std::remove("test_file");
- return 0;
}
Modified: trunk/test/test_lsd.cpp
===================================================================
--- trunk/test/test_lsd.cpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/test/test_lsd.cpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -109,8 +109,6 @@
remove_all("./tmp1_lsd", ec);
remove_all("./tmp2_lsd", ec);
remove_all("./tmp3_lsd", ec);
-
- return 0;
}
Modified: trunk/test/test_metadata_extension.cpp
===================================================================
--- trunk/test/test_metadata_extension.cpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/test/test_metadata_extension.cpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -232,7 +232,5 @@
remove_all("tmp2", ec);
#endif // TORRENT_NO_DEPRECATE
-
- return 0;
}
Modified: trunk/test/test_pe_crypto.cpp
===================================================================
--- trunk/test/test_pe_crypto.cpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/test/test_pe_crypto.cpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -252,7 +252,5 @@
#else
fprintf(stderr, "PE test not run because it's disabled\n");
#endif
-
- return 0;
}
Modified: trunk/test/test_peer_classes.cpp
===================================================================
--- trunk/test/test_peer_classes.cpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/test/test_peer_classes.cpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -112,6 +112,5 @@
pool.decref(id1);
TEST_CHECK(pool.at(id2) == NULL);
TEST_CHECK(pool.at(id1) == NULL);
- return 0;
}
Modified: trunk/test/test_pex.cpp
===================================================================
--- trunk/test/test_pex.cpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/test/test_pex.cpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -160,11 +160,9 @@
remove_all("tmp1_pex", ec);
remove_all("tmp2_pex", ec);
remove_all("tmp3_pex", ec);
-
- return 0;
}
#else
-TORRENT_TEST(pex) { return 0; }
+TORRENT_TEST(pex) {}
#endif // TORRENT_DISABLE_EXTENSIONS
Modified: trunk/test/test_primitives.cpp
===================================================================
--- trunk/test/test_primitives.cpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/test/test_primitives.cpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -270,6 +270,5 @@
// test endpoint_to_bytes
TEST_EQUAL(endpoint_to_bytes(udp::endpoint(address_v4::from_string("10.11.12.13"), 8080)), "\x0a\x0b\x0c\x0d\x1f\x90");
TEST_EQUAL(endpoint_to_bytes(udp::endpoint(address_v4::from_string("16.5.127.1"), 12345)), "\x10\x05\x7f\x01\x30\x39");
- return 0;
}
Modified: trunk/test/test_priority.cpp
===================================================================
--- trunk/test/test_priority.cpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/test/test_priority.cpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -424,8 +424,6 @@
// we have to clear them, session doesn't really support being destructed
// as a global destructor (for silly reasons)
sp.clear();
-
- return 0;
}
Modified: trunk/test/test_privacy.cpp
===================================================================
--- trunk/test/test_privacy.cpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/test/test_privacy.cpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -268,6 +268,5 @@
pr[11] = test_proxy(settings_pack::http, force_proxy_mode | expect_udp_reject);
pr[12] = test_proxy(settings_pack::http_pw, force_proxy_mode | expect_udp_reject);
pr[13] = test_proxy(settings_pack::i2p_proxy, force_proxy_mode);
- return 0;
}
Modified: trunk/test/test_read_piece.cpp
===================================================================
--- trunk/test/test_read_piece.cpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/test/test_read_piece.cpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -138,6 +138,5 @@
test_read_piece(0);
test_read_piece(seed_mode);
test_read_piece(time_critical);
- return 0;
}
Modified: trunk/test/test_recheck.cpp
===================================================================
--- trunk/test/test_recheck.cpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/test/test_recheck.cpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -63,7 +63,7 @@
if (st.progress_ppm == 1000000) return;
test_sleep(500);
}
- TEST_CHECK(false);
+ TEST_ERROR("torrent did not finish");
}
TORRENT_TEST(recheck)
@@ -98,6 +98,4 @@
st1 = tor1.status();
TEST_CHECK(st1.progress_ppm <= 1000000);
wait_for_complete(ses1, tor1);
-
- return 0;
}
Modified: trunk/test/test_remap_files.cpp
===================================================================
--- trunk/test/test_remap_files.cpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/test/test_remap_files.cpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -520,7 +520,5 @@
remove_all("tmp2_remap2", ec);
remove_all("tmp1_remap3", ec);
remove_all("tmp2_remap3", ec);
-
- return 0;
}
Modified: trunk/test/test_resume.cpp
===================================================================
--- trunk/test/test_resume.cpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/test/test_resume.cpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -340,7 +340,6 @@
// TODO: test all other resume flags here too. This would require returning
// more than just the torrent_status from test_resume_flags. Also http seeds
// and trackers for instance
- return 0;
}
Modified: trunk/test/test_session.cpp
===================================================================
--- trunk/test/test_session.cpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/test/test_session.cpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -86,6 +86,5 @@
// for the asynchronous call to set the alert
// mask completes, before it goes on to destruct
// the session object
- return 0;
}
Modified: trunk/test/test_ssl.cpp
===================================================================
--- trunk/test/test_ssl.cpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/test/test_ssl.cpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -596,7 +596,6 @@
remove_all("tmp2_ssl", ec);
#endif // TORRENT_USE_OPENSSL
- return 0;
}
Modified: trunk/test/test_stat_cache.cpp
===================================================================
--- trunk/test/test_stat_cache.cpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/test/test_stat_cache.cpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -76,6 +76,5 @@
TEST_CHECK(sc.get_filesize(14) == stat_cache::not_in_cache);
TEST_CHECK(sc.get_filesize(15) == 1000);
TEST_CHECK(sc.get_filetime(15) == 3000);
- return 0;
}
Modified: trunk/test/test_storage.cpp
===================================================================
--- trunk/test/test_storage.cpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/test/test_storage.cpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -838,7 +838,7 @@
}
}
-void test_iovec_copy_bufs()
+TORRENT_TEST(iovec_copy_bufs)
{
file::iovec_t iov1[10];
file::iovec_t iov2[10];
@@ -869,7 +869,7 @@
free_iov(iov1, 10);
}
-void test_iovec_clear_bufs()
+TORRENT_TEST(iovec_clear_bufs)
{
file::iovec_t iov[10];
alloc_iov(iov, 10);
@@ -887,7 +887,7 @@
free_iov(iov, 10);
}
-void test_iovec_bufs_size()
+TORRENT_TEST(iovec_bufs_size)
{
file::iovec_t iov[10];
@@ -903,7 +903,7 @@
}
}
-void test_iovec_advance_bufs()
+TORRENT_TEST(iovec_advance_bufs)
{
file::iovec_t iov1[10];
file::iovec_t iov2[10];
@@ -936,13 +936,6 @@
TORRENT_TEST(storage)
{
- test_iovec_copy_bufs();
- test_iovec_clear_bufs();
- test_iovec_advance_bufs();
- test_iovec_bufs_size();
-
- return 0;
-
// initialize test pieces
for (char* p = piece0, *end(piece0 + piece_size); p < end; ++p)
*p = random_byte();
@@ -974,7 +967,5 @@
std::for_each(test_paths.begin(), test_paths.end(), boost::bind(&run_test, _1, true));
std::for_each(test_paths.begin(), test_paths.end(), boost::bind(&run_test, _1, false));
-
- return 0;
}
Modified: trunk/test/test_super_seeding.cpp
===================================================================
--- trunk/test/test_super_seeding.cpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/test/test_super_seeding.cpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -39,8 +39,6 @@
// with strict super seeding
test_swarm(super_seeding | strict_super_seeding);
-
- return 0;
}
Modified: trunk/test/test_swarm.cpp
===================================================================
--- trunk/test/test_swarm.cpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/test/test_swarm.cpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -44,7 +44,5 @@
// test explicit cache
test_swarm(suggest | explicit_cache);
-
- return 0;
}
Modified: trunk/test/test_time_critical.cpp
===================================================================
--- trunk/test/test_time_critical.cpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/test/test_time_critical.cpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -36,8 +36,6 @@
{
// with time critical pieces
test_swarm(time_critical);
-
- return 0;
}
Modified: trunk/test/test_torrent.cpp
===================================================================
--- trunk/test/test_torrent.cpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/test/test_torrent.cpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -264,8 +264,6 @@
TEST_EQUAL(int(sum), fs.piece_size(idx));
}
}
-
- return 0;
}
Modified: trunk/test/test_tracker.cpp
===================================================================
--- trunk/test/test_tracker.cpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/test/test_tracker.cpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -394,7 +394,5 @@
fprintf(stderr, "stop_web_server\n");
stop_web_server();
fprintf(stderr, "done\n");
-
- return 0;
}
Modified: trunk/test/test_trackers_extension.cpp
===================================================================
--- trunk/test/test_trackers_extension.cpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/test/test_trackers_extension.cpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -129,11 +129,9 @@
// this allows shutting down the sessions in parallel
p1 = ses1.abort();
p2 = ses2.abort();
-
- return 0;
}
#else
-TORRENT_TEST(trackers_extension) { return 0; }
+TORRENT_TEST(trackers_extension) { }
#endif // TORRENT_DISABLE_EXTENSIONS
Modified: trunk/test/test_url_seed.cpp
===================================================================
--- trunk/test/test_url_seed.cpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/test/test_url_seed.cpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -48,7 +48,6 @@
run_http_suite(proxy, "http", 1, 0, 0, keepalive);
}
run_http_suite(proxy, "http", 1, 0, 0, 1, 1);
- return 0;
}
Modified: trunk/test/test_utf8.cpp
===================================================================
--- trunk/test/test_utf8.cpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/test/test_utf8.cpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -251,6 +251,5 @@
TEST_EQUAL(ret, conversion_ok);
TEST_EQUAL(utf8, identity);
- return 0;
}
Modified: trunk/test/test_utp.cpp
===================================================================
--- trunk/test/test_utp.cpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/test/test_utp.cpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -137,7 +137,5 @@
error_code ec;
remove_all("./tmp1_utp", ec);
remove_all("./tmp2_utp", ec);
-
- return 0;
}
Modified: trunk/test/test_web_seed.cpp
===================================================================
--- trunk/test/test_web_seed.cpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/test/test_web_seed.cpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -44,6 +44,5 @@
run_http_suite(proxy, "https", false);
#endif
run_http_suite(proxy, "http", false);
- return 0;
}
Modified: trunk/test/test_web_seed_ban.cpp
===================================================================
--- trunk/test/test_web_seed_ban.cpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/test/test_web_seed_ban.cpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -40,7 +40,6 @@
TORRENT_TEST(web_seed_ban)
{
- int ret = 0;
for (int url_seed = 0; url_seed < 2; ++url_seed)
{
#ifdef TORRENT_USE_OPENSSL
@@ -48,6 +47,5 @@
#endif
run_http_suite(proxy, "http", url_seed, 0, 1);
}
- return ret;
}
Modified: trunk/test/test_web_seed_chunked.cpp
===================================================================
--- trunk/test/test_web_seed_chunked.cpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/test/test_web_seed_chunked.cpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -40,7 +40,6 @@
TORRENT_TEST(web_seed_chunked)
{
- int ret = 0;
for (int url_seed = 0; url_seed < 2; ++url_seed)
{
#ifdef TORRENT_USE_OPENSSL
@@ -48,6 +47,5 @@
#endif
run_http_suite(proxy, "http", url_seed, 1, 0);
}
- return ret;
}
Modified: trunk/test/test_web_seed_http.cpp
===================================================================
--- trunk/test/test_web_seed_http.cpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/test/test_web_seed_http.cpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -40,7 +40,6 @@
TORRENT_TEST(web_seed_http)
{
- int ret = 0;
for (int url_seed = 0; url_seed < 2; ++url_seed)
{
#ifdef TORRENT_USE_OPENSSL
@@ -48,6 +47,5 @@
#endif
run_http_suite(proxy, "http", url_seed);
}
- return ret;
}
Modified: trunk/test/test_web_seed_http_pw.cpp
===================================================================
--- trunk/test/test_web_seed_http_pw.cpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/test/test_web_seed_http_pw.cpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -40,7 +40,6 @@
TORRENT_TEST(web_seed_http_pw)
{
- int ret = 0;
for (int url_seed = 0; url_seed < 2; ++url_seed)
{
#ifdef TORRENT_USE_OPENSSL
@@ -48,6 +47,5 @@
#endif
run_http_suite(proxy, "http", url_seed);
}
- return ret;
}
Modified: trunk/test/test_web_seed_redirect.cpp
===================================================================
--- trunk/test/test_web_seed_redirect.cpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/test/test_web_seed_redirect.cpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -53,7 +53,8 @@
{
fprintf(stderr, "failed to create file \"test_file\": (%d) %s\n"
, ec.value(), ec.message().c_str());
- return 1;
+ TEST_ERROR("failed to create file");
+ return;
}
file::iovec_t b = { random_data, size_t(16000)};
f.writev(0, &b, 1, ec);
@@ -76,8 +77,8 @@
{
fprintf(stderr, "error creating hashes for test torrent: %s\n"
, ec.message().c_str());
- TEST_CHECK(false);
- return 0;
+ TEST_ERROR("failed to create hashes");
+ return;
}
std::vector<char> buf;
@@ -91,14 +92,13 @@
settings.set_int(settings_pack::max_queued_disk_bytes, 256 * 1024);
settings.set_int(settings_pack::alert_mask, ~(alert::progress_notification | alert::stats_notification));
ses.apply_settings(settings);
-
+
// disable keep-alive because otherwise the test will choke on seeing
// the disconnect (from the redirect)
test_transfer(ses, torrent_file, 0, 0, "http", true, false, false, false);
}
stop_web_server();
- return 0;
}
Modified: trunk/test/test_web_seed_socks4.cpp
===================================================================
--- trunk/test/test_web_seed_socks4.cpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/test/test_web_seed_socks4.cpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -40,7 +40,6 @@
TORRENT_TEST(web_seed_socks4)
{
- int ret = 0;
for (int url_seed = 0; url_seed < 2; ++url_seed)
{
#ifdef TORRENT_USE_OPENSSL
@@ -48,6 +47,5 @@
#endif
run_http_suite(proxy, "http", url_seed);
}
- return ret;
}
Modified: trunk/test/test_web_seed_socks5.cpp
===================================================================
--- trunk/test/test_web_seed_socks5.cpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/test/test_web_seed_socks5.cpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -40,7 +40,6 @@
TORRENT_TEST(web_seed_socks5)
{
- int ret = 0;
for (int url_seed = 0; url_seed < 2; ++url_seed)
{
#ifdef TORRENT_USE_OPENSSL
@@ -48,6 +47,5 @@
#endif
run_http_suite(proxy, "http", url_seed);
}
- return ret;
}
Modified: trunk/test/test_web_seed_socks5_pw.cpp
===================================================================
--- trunk/test/test_web_seed_socks5_pw.cpp 2015-05-30 21:10:34 UTC (rev 11131)
+++ trunk/test/test_web_seed_socks5_pw.cpp 2015-05-30 21:46:59 UTC (rev 11132)
@@ -40,7 +40,6 @@
TORRENT_TEST(web_seed_socks5_pw)
{
- int ret = 0;
for (int url_seed = 0; url_seed < 2; ++url_seed)
{
#ifdef TORRENT_USE_OPENSSL
@@ -48,6 +47,5 @@
#endif
run_http_suite(proxy, "http", url_seed);
}
- return ret;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ar...@us...> - 2015-05-30 21:10:37
|
Revision: 11131
http://sourceforge.net/p/libtorrent/code/11131
Author: arvidn
Date: 2015-05-30 21:10:34 +0000 (Sat, 30 May 2015)
Log Message:
-----------
split up file unit tests into smaller pieces
Modified Paths:
--------------
trunk/test/dht_server.cpp
trunk/test/main.cpp
trunk/test/peer_server.cpp
trunk/test/test_file.cpp
trunk/test/udp_tracker.cpp
Modified: trunk/test/dht_server.cpp
===================================================================
--- trunk/test/dht_server.cpp 2015-05-30 18:42:04 UTC (rev 11130)
+++ trunk/test/dht_server.cpp 2015-05-30 21:10:34 UTC (rev 11131)
@@ -172,8 +172,6 @@
void stop_dht()
{
- fprintf(stderr, "%s: stop_dht()\n", time_now_string());
g_dht.reset();
- fprintf(stderr, "%s: stop_dht() done\n", time_now_string());
}
Modified: trunk/test/main.cpp
===================================================================
--- trunk/test/main.cpp 2015-05-30 18:42:04 UTC (rev 11130)
+++ trunk/test/main.cpp 2015-05-30 21:10:34 UTC (rev 11131)
@@ -263,11 +263,11 @@
if (!tests_to_run.empty())
{
- fprintf(stderr, "UNKONWN tests:\n");
+ fprintf(stderr, "\x1b[1mUNKONWN tests:\x1b[0m\n");
for (std::set<std::string>::iterator i = tests_to_run.begin()
, end(tests_to_run.end()); i != end; ++i)
{
- fprintf(stderr, "%s\n", i->c_str());
+ fprintf(stderr, " %s\n", i->c_str());
}
}
Modified: trunk/test/peer_server.cpp
===================================================================
--- trunk/test/peer_server.cpp 2015-05-30 18:42:04 UTC (rev 11130)
+++ trunk/test/peer_server.cpp 2015-05-30 21:10:34 UTC (rev 11131)
@@ -160,8 +160,6 @@
void stop_peer()
{
- fprintf(stderr, "%s: PEER stop_peer()\n", time_now_string());
g_peer.reset();
- fprintf(stderr, "%s: PEER stop_peer() done\n", time_now_string());
}
Modified: trunk/test/test_file.cpp
===================================================================
--- trunk/test/test_file.cpp 2015-05-30 18:42:04 UTC (rev 11130)
+++ trunk/test/test_file.cpp 2015-05-30 21:10:34 UTC (rev 11131)
@@ -59,7 +59,7 @@
return 0;
}
-void test_create_directory()
+TORRENT_TEST(create_directory)
{
error_code ec;
create_directory("__foobar__", ec);
@@ -75,7 +75,7 @@
TEST_CHECK(!ec);
}
-void test_stat()
+TORRENT_TEST(file_status)
{
error_code ec;
@@ -103,11 +103,8 @@
TEST_CHECK(diff >= 2 && diff <= 4);
}
-TORRENT_TEST(file)
+TORRENT_TEST(directory)
{
- test_create_directory();
- test_stat();
-
error_code ec;
create_directory("file_test_dir", ec);
@@ -150,8 +147,11 @@
if (ec) fprintf(stderr, "remove_all: %s\n", ec.message().c_str());
remove_all("file_test_dir2", ec);
if (ec) fprintf(stderr, "remove_all: %s\n", ec.message().c_str());
+}
- // test path functions
+// test path functions
+TORRENT_TEST(paths)
+{
TEST_EQUAL(combine_path("test1/", "test2"), "test1/test2");
TEST_EQUAL(combine_path("test1", "."), "test1");
TEST_EQUAL(combine_path(".", "test1"), "test1");
@@ -242,9 +242,11 @@
#endif
TEST_EQUAL(complete("."), current_working_directory());
+}
- // test split_string
-
+// test split_string
+TORRENT_TEST(split_string)
+{
char const* tags[10];
char tags_str[] = " this is\ta test\t string\x01to be split and it cannot "
"extend over the limit of elements \t";
@@ -274,11 +276,13 @@
test = "1.2.3/_";
replace_extension(test, "txt");
TEST_EQUAL(test, "1.2.3/_.txt");
+}
-
- // file class
+// file class
+TORRENT_TEST(file)
+{
+ error_code ec;
file f;
- ec.clear();
#if TORRENT_USE_UNC_PATHS || !defined WIN32
TEST_CHECK(f.open("con", file::read_write, ec));
#else
@@ -302,7 +306,5 @@
TEST_CHECK(!ec);
TEST_CHECK(strcmp(test_buf, "test") == 0);
f.close();
-
- return 0;
}
Modified: trunk/test/udp_tracker.cpp
===================================================================
--- trunk/test/udp_tracker.cpp 2015-05-30 18:42:04 UTC (rev 11130)
+++ trunk/test/udp_tracker.cpp 2015-05-30 21:10:34 UTC (rev 11131)
@@ -224,8 +224,6 @@
void stop_udp_tracker()
{
- fprintf(stderr, "%s: UDP stop_udp_tracker()\n", time_now_string());
g_udp_tracker.reset();
- fprintf(stderr, "%s: UDP stop_udp_tracker() done\n", time_now_string());
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ar...@us...> - 2015-05-30 18:42:07
|
Revision: 11130
http://sourceforge.net/p/libtorrent/code/11130
Author: arvidn
Date: 2015-05-30 18:42:04 +0000 (Sat, 30 May 2015)
Log Message:
-----------
fix ip_voter test and try to narrow down flapping in test heterogeneous test
Modified Paths:
--------------
trunk/test/test_heterogeneous_queue.cpp
trunk/test/test_ip_voter.cpp
Modified: trunk/test/test_heterogeneous_queue.cpp
===================================================================
--- trunk/test/test_heterogeneous_queue.cpp 2015-05-30 18:28:09 UTC (rev 11129)
+++ trunk/test/test_heterogeneous_queue.cpp 2015-05-30 18:42:04 UTC (rev 11130)
@@ -137,154 +137,163 @@
F& operator=(F const& f);
};
-TORRENT_TEST(heterogeneuous_queue)
+// test push_back of heterogeneous types
+// and retrieval of their pointers
+TORRENT_TEST(heterogeneuous_queue_push_back)
{
using namespace libtorrent;
- // test push_back of heterogeneous types
- // and retrieval of their pointers
- {
- heterogeneous_queue<A> q;
- q.push_back(B(0, 1));
- TEST_EQUAL(q.size(), 1);
- q.push_back(B(2, 3));
- TEST_EQUAL(q.size(), 2);
- q.push_back(B(4, 5));
- TEST_EQUAL(q.size(), 3);
- q.push_back(C(6, 7));
- TEST_EQUAL(q.size(), 4);
- q.push_back(C(8, 9));
- TEST_EQUAL(q.size(), 5);
- q.push_back(C(10, 11));
- TEST_EQUAL(q.size(), 6);
+ heterogeneous_queue<A> q;
+ q.push_back(B(0, 1));
+ TEST_EQUAL(q.size(), 1);
+ q.push_back(B(2, 3));
+ TEST_EQUAL(q.size(), 2);
+ q.push_back(B(4, 5));
+ TEST_EQUAL(q.size(), 3);
+ q.push_back(C(6, 7));
+ TEST_EQUAL(q.size(), 4);
+ q.push_back(C(8, 9));
+ TEST_EQUAL(q.size(), 5);
+ q.push_back(C(10, 11));
+ TEST_EQUAL(q.size(), 6);
- std::vector<A*> ptrs;
- q.get_pointers(ptrs);
+ std::vector<A*> ptrs;
+ q.get_pointers(ptrs);
- TEST_EQUAL(ptrs.size(), q.size());
- TEST_EQUAL(ptrs[0]->type(), 1);
- TEST_EQUAL(ptrs[1]->type(), 1);
- TEST_EQUAL(ptrs[2]->type(), 1);
- TEST_EQUAL(ptrs[3]->type(), 2);
- TEST_EQUAL(ptrs[4]->type(), 2);
- TEST_EQUAL(ptrs[5]->type(), 2);
+ TEST_EQUAL(ptrs.size(), q.size());
+ TEST_EQUAL(ptrs[0]->type(), 1);
+ TEST_EQUAL(ptrs[1]->type(), 1);
+ TEST_EQUAL(ptrs[2]->type(), 1);
+ TEST_EQUAL(ptrs[3]->type(), 2);
+ TEST_EQUAL(ptrs[4]->type(), 2);
+ TEST_EQUAL(ptrs[5]->type(), 2);
- TEST_EQUAL(static_cast<B*>(ptrs[0])->a, 0);
- TEST_EQUAL(static_cast<B*>(ptrs[0])->b, 1);
+ TEST_EQUAL(static_cast<B*>(ptrs[0])->a, 0);
+ TEST_EQUAL(static_cast<B*>(ptrs[0])->b, 1);
- TEST_EQUAL(static_cast<B*>(ptrs[1])->a, 2);
- TEST_EQUAL(static_cast<B*>(ptrs[1])->b, 3);
+ TEST_EQUAL(static_cast<B*>(ptrs[1])->a, 2);
+ TEST_EQUAL(static_cast<B*>(ptrs[1])->b, 3);
- TEST_EQUAL(static_cast<B*>(ptrs[2])->a, 4);
- TEST_EQUAL(static_cast<B*>(ptrs[2])->b, 5);
+ TEST_EQUAL(static_cast<B*>(ptrs[2])->a, 4);
+ TEST_EQUAL(static_cast<B*>(ptrs[2])->b, 5);
- TEST_EQUAL(static_cast<C*>(ptrs[3])->a, 6);
- TEST_EQUAL(static_cast<C*>(ptrs[3])->c[0], 7);
+ TEST_EQUAL(static_cast<C*>(ptrs[3])->a, 6);
+ TEST_EQUAL(static_cast<C*>(ptrs[3])->c[0], 7);
- TEST_EQUAL(static_cast<C*>(ptrs[4])->a, 8);
- TEST_EQUAL(static_cast<C*>(ptrs[4])->c[0], 9);
+ TEST_EQUAL(static_cast<C*>(ptrs[4])->a, 8);
+ TEST_EQUAL(static_cast<C*>(ptrs[4])->c[0], 9);
- TEST_EQUAL(static_cast<C*>(ptrs[5])->a, 10);
- TEST_EQUAL(static_cast<C*>(ptrs[5])->c[0], 11);
- }
+ TEST_EQUAL(static_cast<C*>(ptrs[5])->a, 10);
+ TEST_EQUAL(static_cast<C*>(ptrs[5])->c[0], 11);
+}
- // test swap
- {
- heterogeneous_queue<A> q1;
- heterogeneous_queue<A> q2;
+// test swap
+TORRENT_TEST(heterogeneuous_queue_swap)
+{
+ using namespace libtorrent;
- q1.push_back(B(0, 1));
- q1.push_back(B(2, 3));
- q1.push_back(B(4, 5));
- TEST_EQUAL(q1.size(), 3);
+ heterogeneous_queue<A> q1;
+ heterogeneous_queue<A> q2;
- q2.push_back(C(6, 7));
- q2.push_back(C(8, 9));
- TEST_EQUAL(q2.size(), 2);
-
- std::vector<A*> ptrs;
- q1.get_pointers(ptrs);
- TEST_EQUAL(ptrs.size(), q1.size());
+ q1.push_back(B(0, 1));
+ q1.push_back(B(2, 3));
+ q1.push_back(B(4, 5));
+ TEST_EQUAL(q1.size(), 3);
- TEST_EQUAL(ptrs[0]->type(), 1);
- TEST_EQUAL(ptrs[1]->type(), 1);
- TEST_EQUAL(ptrs[2]->type(), 1);
+ q2.push_back(C(6, 7));
+ q2.push_back(C(8, 9));
+ TEST_EQUAL(q2.size(), 2);
- q2.get_pointers(ptrs);
- TEST_EQUAL(ptrs.size(), q2.size());
+ std::vector<A*> ptrs;
+ q1.get_pointers(ptrs);
+ TEST_EQUAL(ptrs.size(), q1.size());
- TEST_EQUAL(ptrs[0]->type(), 2);
- TEST_EQUAL(ptrs[1]->type(), 2);
+ TEST_EQUAL(ptrs[0]->type(), 1);
+ TEST_EQUAL(ptrs[1]->type(), 1);
+ TEST_EQUAL(ptrs[2]->type(), 1);
- q1.swap(q2);
+ q2.get_pointers(ptrs);
+ TEST_EQUAL(ptrs.size(), q2.size());
- q1.get_pointers(ptrs);
- TEST_EQUAL(q1.size(), 2);
- TEST_EQUAL(ptrs.size(), q1.size());
+ TEST_EQUAL(ptrs[0]->type(), 2);
+ TEST_EQUAL(ptrs[1]->type(), 2);
- TEST_EQUAL(ptrs[0]->type(), 2);
- TEST_EQUAL(ptrs[1]->type(), 2);
+ q1.swap(q2);
- q2.get_pointers(ptrs);
- TEST_EQUAL(q2.size(), 3);
- TEST_EQUAL(ptrs.size(), q2.size());
+ q1.get_pointers(ptrs);
+ TEST_EQUAL(q1.size(), 2);
+ TEST_EQUAL(ptrs.size(), q1.size());
- TEST_EQUAL(ptrs[0]->type(), 1);
- TEST_EQUAL(ptrs[1]->type(), 1);
- TEST_EQUAL(ptrs[2]->type(), 1);
- }
+ TEST_EQUAL(ptrs[0]->type(), 2);
+ TEST_EQUAL(ptrs[1]->type(), 2);
- // test destruction
- {
- heterogeneous_queue<D> q;
- TEST_EQUAL(D::instances, 0);
+ q2.get_pointers(ptrs);
+ TEST_EQUAL(q2.size(), 3);
+ TEST_EQUAL(ptrs.size(), q2.size());
- q.push_back(D());
- TEST_EQUAL(D::instances, 1);
- q.push_back(D());
- TEST_EQUAL(D::instances, 2);
- q.push_back(D());
- TEST_EQUAL(D::instances, 3);
- q.push_back(D());
- TEST_EQUAL(D::instances, 4);
+ TEST_EQUAL(ptrs[0]->type(), 1);
+ TEST_EQUAL(ptrs[1]->type(), 1);
+ TEST_EQUAL(ptrs[2]->type(), 1);
+}
- q.clear();
+// test destruction
+TORRENT_TEST(heterogeneuous_queue_destruction)
+{
+ using namespace libtorrent;
- TEST_EQUAL(D::instances, 0);
- }
+ heterogeneous_queue<D> q;
+ TEST_EQUAL(D::instances, 0);
- // test copy/move
- {
- heterogeneous_queue<F> q;
+ q.push_back(D());
+ TEST_EQUAL(D::instances, 1);
+ q.push_back(D());
+ TEST_EQUAL(D::instances, 2);
+ q.push_back(D());
+ TEST_EQUAL(D::instances, 3);
+ q.push_back(D());
+ TEST_EQUAL(D::instances, 4);
- // make sure the queue has to grow at some point, to exercise its
- // copy/move of elements
- for (int i = 0; i < 1000; ++i)
- q.push_back(F(i));
+ q.clear();
- std::vector<F*> ptrs;
- q.get_pointers(ptrs);
+ TEST_EQUAL(D::instances, 0);
+}
- TEST_EQUAL(ptrs.size(), 1000);
+// test copy/move
+TORRENT_TEST(heterogeneuous_queue_copy_move)
+{
+ using namespace libtorrent;
- for (int i = 0; i < ptrs.size(); ++i)
- {
- ptrs[i]->check_invariant();
- TEST_EQUAL(ptrs[i]->f, i);
- }
+ heterogeneous_queue<F> q;
- // destroy all objects, asserting that their invariant still holds
- q.clear();
- }
+ // make sure the queue has to grow at some point, to exercise its
+ // copy/move of elements
+ for (int i = 0; i < 1000; ++i)
+ q.push_back(F(i));
+ std::vector<F*> ptrs;
+ q.get_pointers(ptrs);
+
+ TEST_EQUAL(ptrs.size(), 1000);
+
+ for (int i = 0; i < ptrs.size(); ++i)
{
- heterogeneous_queue<E> q;
- for (int i = 0; i < 10000; ++i)
- {
- q.push_back(E("testing to allocate non-trivial objects"));
- }
+ ptrs[i]->check_invariant();
+ TEST_EQUAL(ptrs[i]->f, i);
}
- return 0;
+ // destroy all objects, asserting that their invariant still holds
+ q.clear();
}
+TORRENT_TEST(heterogeneuous_queue_nontrivial)
+{
+ using namespace libtorrent;
+
+ heterogeneous_queue<E> q;
+ for (int i = 0; i < 10000; ++i)
+ {
+ q.push_back(E("testing to allocate non-trivial objects"));
+ }
+}
+
+
Modified: trunk/test/test_ip_voter.cpp
===================================================================
--- trunk/test/test_ip_voter.cpp 2015-05-30 18:28:09 UTC (rev 11129)
+++ trunk/test/test_ip_voter.cpp 2015-05-30 18:42:04 UTC (rev 11130)
@@ -60,13 +60,17 @@
{
ip_voter ipv;
- bool new_ip = cast_vote(ipv, rand_v4(), rand_v4());
+ address_v4 addr1(address_v4::from_string("51.41.61.132"));
+
+ bool new_ip = cast_vote(ipv, addr1, rand_v4());
TEST_CHECK(new_ip);
+ TEST_CHECK(ipv.external_address() == addr1);
for (int i = 0; i < 1000; ++i)
{
new_ip = cast_vote(ipv, rand_v4(), rand_v4());
TEST_CHECK(!new_ip);
}
+ TEST_CHECK(ipv.external_address() == addr1);
}
TORRENT_TEST(ip_voter_two_ips)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ar...@us...> - 2015-05-30 18:28:11
|
Revision: 11129
http://sourceforge.net/p/libtorrent/code/11129
Author: arvidn
Date: 2015-05-30 18:28:09 +0000 (Sat, 30 May 2015)
Log Message:
-----------
fix ip_voter unit test
Modified Paths:
--------------
trunk/test/test_ip_voter.cpp
Modified: trunk/test/test_ip_voter.cpp
===================================================================
--- trunk/test/test_ip_voter.cpp 2015-05-30 17:41:38 UTC (rev 11128)
+++ trunk/test/test_ip_voter.cpp 2015-05-30 18:28:09 UTC (rev 11129)
@@ -35,26 +35,41 @@
#include "libtorrent/address.hpp"
#include "libtorrent/socket.hpp"
#include "libtorrent/random.hpp"
+#include "libtorrent/socket_io.hpp"
#include "setup_transfer.hpp" // for rand_v4
using namespace libtorrent;
+bool cast_vote(ip_voter& ipv, address ext_ip, address voter)
+{
+ bool new_ip = ipv.cast_vote(ext_ip, 1, voter);
+ fprintf(stderr, "%15s -> %-15s\n"
+ , print_address(voter).c_str()
+ , print_address(ext_ip).c_str());
+ if (new_ip)
+ {
+ fprintf(stderr, " \x1b[1mnew external IP: %s\x1b[0m\n"
+ , print_address(ipv.external_address()).c_str());
+ }
+ return new_ip;
+}
+
// test the case where every time we get a new IP. Make sure
// we don't flap
-void test_random()
+TORRENT_TEST(ip_voter_test_random)
{
ip_voter ipv;
- bool new_ip = ipv.cast_vote(rand_v4(), 1, rand_v4());
+ bool new_ip = cast_vote(ipv, rand_v4(), rand_v4());
TEST_CHECK(new_ip);
for (int i = 0; i < 1000; ++i)
{
- new_ip = ipv.cast_vote(rand_v4(), 1, rand_v4());
+ new_ip = cast_vote(ipv, rand_v4(), rand_v4());
TEST_CHECK(!new_ip);
}
}
-void test_two_ips()
+TORRENT_TEST(ip_voter_two_ips)
{
ip_voter ipv;
@@ -64,58 +79,58 @@
// addr1 is the first address we see, which is the one we pick. Even though
// we'll have as many votes for addr2, we shouldn't flap, since addr2 never
// gets an overwhelming majority.
- bool new_ip = ipv.cast_vote(addr1, 1, rand_v4());
+ bool new_ip = cast_vote(ipv, addr1, rand_v4());
TEST_CHECK(new_ip);
for (int i = 0; i < 1000; ++i)
{
- new_ip = ipv.cast_vote(addr2, 1, rand_v4());
+ new_ip = cast_vote(ipv, addr2, rand_v4());
TEST_CHECK(!new_ip);
- new_ip = ipv.cast_vote(rand_v4(), 1, rand_v4());
+ new_ip = cast_vote(ipv, rand_v4(), rand_v4());
TEST_CHECK(!new_ip);
- new_ip = ipv.cast_vote(addr1, 1, rand_v4());
+ new_ip = cast_vote(ipv, addr1, rand_v4());
TEST_CHECK(!new_ip);
TEST_CHECK(ipv.external_address() == addr1);
}
}
-void test_one_ip()
+TORRENT_TEST(ip_voter_one_ip)
{
ip_voter ipv;
address_v4 addr1(address_v4::from_string("51.1.1.1"));
address_v4 addr2(address_v4::from_string("53.3.3.3"));
- bool new_ip = ipv.cast_vote(rand_v4(), 1, rand_v4());
+ bool new_ip = cast_vote(ipv, rand_v4(), rand_v4());
TEST_CHECK(new_ip);
- bool switched_ip = false;
- for (int i = 0; i < 1000; ++i)
+ TEST_CHECK(ipv.external_address() != addr1);
+ for (int i = 0; i < 30; ++i)
{
- new_ip = ipv.cast_vote(addr2, 1, rand_v4());
- if (new_ip)
- fprintf(stderr, "unexpected new IP at iteration: %d\n", i);
+ new_ip = cast_vote(ipv, addr2, rand_v4());
+ if (new_ip) break;
+ new_ip = cast_vote(ipv, rand_v4(), rand_v4());
+ if (new_ip) break;
+ new_ip = cast_vote(ipv, addr1, rand_v4());
+ if (new_ip) break;
+ new_ip = cast_vote(ipv, addr1, rand_v4());
+ if (new_ip) break;
+
+ }
+
+ TEST_CHECK(ipv.external_address() == addr1);
+
+ for (int i = 0; i < 500; ++i)
+ {
+ new_ip = cast_vote(ipv, addr2, rand_v4());
TEST_CHECK(!new_ip);
- new_ip = ipv.cast_vote(rand_v4(), 1, rand_v4());
+ new_ip = cast_vote(ipv, rand_v4(), rand_v4());
TEST_CHECK(!new_ip);
- new_ip = ipv.cast_vote(addr1, 1, rand_v4());
- if (new_ip) switched_ip = true;
- new_ip = ipv.cast_vote(addr1, 1, rand_v4());
- if (new_ip) switched_ip = true;
+ new_ip = cast_vote(ipv, addr1, rand_v4());
+ TEST_CHECK(!new_ip);
+ new_ip = cast_vote(ipv, addr1, rand_v4());
+ TEST_CHECK(!new_ip);
+ }
- if (switched_ip)
- {
- TEST_CHECK(ipv.external_address() == addr1);
- }
- }
- TEST_CHECK(switched_ip);
TEST_CHECK(ipv.external_address() == addr1);
}
-TORRENT_TEST(ip_voter)
-{
- test_random();
- test_two_ips();
- test_one_ip();
- return 0;
-}
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ar...@us...> - 2015-05-30 17:41:40
|
Revision: 11128
http://sourceforge.net/p/libtorrent/code/11128
Author: arvidn
Date: 2015-05-30 17:41:38 +0000 (Sat, 30 May 2015)
Log Message:
-----------
merged RC_1_0 into trunk
Modified Paths:
--------------
trunk/ChangeLog
trunk/bindings/python/src/session.cpp
trunk/bindings/python/src/session_settings.cpp
trunk/include/libtorrent/session.hpp
trunk/include/libtorrent/session_settings.hpp
trunk/src/session.cpp
Property Changed:
----------------
trunk/
Index: trunk
===================================================================
--- trunk 2015-05-30 06:31:03 UTC (rev 11127)
+++ trunk 2015-05-30 17:41:38 UTC (rev 11128)
Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
## -1,5 +1,5 ##
/branches/RC_0_16:6640,6657,6662,6665,6669,6673-6675,6678,6684,6686,6688,6690,6692,6694-6695,6698,6700,6715,6936,6938,6946,6951,6956,6971,6974,6976,6979,7166,7200,7206,7258,7311,7314,7323,7333,7339,7348,7358,7371,7373,7375,7379,7395,7422,7433,7458,7461,7464,7466,7469,7471,7473,7480,7482,7487,7489,7492-7493,7497,7500,7507,7511,7514,7529,7536,7542,7546,7548-7549,7551,7553,7555,7560-7561,7564,7572,7577,7579,7587,7593-7594,7598-7599,7609,7611,7623-7624,7627,7633,7642,7644,7651,7667,7671,7675,7677,7681,7683,7685,7694,7699,7701,7704-7706,7711,7719,7729,7739,7752,7758,7760,7762,7765,7767,7771,7773,7784,7786,7788,7809,7814,7826,7828,7834,7838,7840,7847,7851,7853,7863-7864,7868,7870,7875,7884,7886,7890,7902,7905-7906,7909,7912,7914-7915,7925,7928,7930,7932,7934,7941,7947,7951,7955,7962,7964,7966,7971,7973,7984,7986,7988,7999,8002-8003,8005,8010,8012,8015,8017,8019,8021,8025,8041,8050,8066,8080,8082,8087,8091,8111,8130,8144,8171,8216,8221,8229,8235,8251,8288,8303,8331,8333,8340,8342,8345,8348,8357,8359-8361,8363,8371,8375,8382,8391,8393,8397,8399-8401,8416,8423,8426,8429,8431,8433,8436,8439,8445,8448,8452,8460,8462,8464,8466,8536,8564,8577,8580,8584,8587,8591,8605-8606,8612,8615,8619,8682,8693-8694,8696,8698,8700,8702,8704,8730,8732-8734,8760,8776-8777,8786,8797,8800,8815,8824,8826,8869,8884,8887,8917,8921-8922,8934,8936,8938,8943,8966,8971,8981-8982,8992,8994,8997,9000,9032-9033,9037,9046,9122,9127,9132,9154,9197,9204,9224,9232,9235,9237,9240,9253-9254,9260,9266-9267,9273,9285,9291,9294-9295,9297,9300,9333,9341,9343,9345,9347,9377,9408,9410,9414,9453,9480,9482,9487,9514,9520,9526,9530,9540,9543,9584,9616,9620,9627,9635,9652,9654,9661,9664,9684,9686,9691,9710,9716,9722,9729,9731,9738,9744,9752,9762,9766-9767,9772,9776,9779,9799,9805,9822,9826,9870,9872,9882,9889,9892,9894,9897,9947,9955,9994,10012,10017,10025,10134,10186,10189,10192,10195,10210,10214,10220,10223,10261,10289,10325,10338,10341,10344,10348,10391,10467,10576,10625,10629,10641
-/branches/RC_1_0:10069-11113
+/branches/RC_1_0:10069-11127
/branches/alert_queue:10881-10930
/branches/bdecoder:10825-10866
/branches/libtorrent_aio:4468-10083
\ No newline at end of property
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2015-05-30 06:31:03 UTC (rev 11127)
+++ trunk/ChangeLog 2015-05-30 17:41:38 UTC (rev 11128)
@@ -70,6 +70,8 @@
* almost completely changed the storage interface (for custom storage)
* added support for hashing pieces in multiple threads
+ * expose missing dht_settings fields to python
+ * add function to query the DHT settings
* fix bug in 'dont_count_slow_torrents' feature, which would start too many
torrents
Modified: trunk/bindings/python/src/session.cpp
===================================================================
--- trunk/bindings/python/src/session.cpp 2015-05-30 06:31:03 UTC (rev 11127)
+++ trunk/bindings/python/src/session.cpp 2015-05-30 17:41:38 UTC (rev 11128)
@@ -664,6 +664,7 @@
)
.def("is_dht_running", allow_threads(<::session::is_dht_running))
.def("set_dht_settings", allow_threads(<::session::set_dht_settings))
+ .def("get_dht_settings", allow_threads(<::session::get_dht_settings))
#endif
.def("add_torrent", &add_torrent)
.def("async_add_torrent", &async_add_torrent)
Modified: trunk/bindings/python/src/session_settings.cpp
===================================================================
--- trunk/bindings/python/src/session_settings.cpp 2015-05-30 06:31:03 UTC (rev 11127)
+++ trunk/bindings/python/src/session_settings.cpp 2015-05-30 17:41:38 UTC (rev 11128)
@@ -284,6 +284,12 @@
.def_readwrite("max_dht_items", &dht_settings::max_dht_items)
.def_readwrite("restrict_routing_ips", &dht_settings::restrict_routing_ips)
.def_readwrite("restrict_search_ips", &dht_settings::restrict_search_ips)
+ .def_readwrite("max_torrent_search_reply", &dht_settings::max_torrent_search_reply)
+ .def_readwrite("extended_routing_table", &dht_settings::extended_routing_table)
+ .def_readwrite("aggressive_lookups", &dht_settings::aggressive_lookups)
+ .def_readwrite("privacy_lookups", &dht_settings::privacy_lookups)
+ .def_readwrite("enforce_node_id", &dht_settings::enforce_node_id)
+ .def_readwrite("ignore_dark_internet", &dht_settings::ignore_dark_internet)
;
#endif
Modified: trunk/include/libtorrent/session.hpp
===================================================================
--- trunk/include/libtorrent/session.hpp 2015-05-30 06:31:03 UTC (rev 11127)
+++ trunk/include/libtorrent/session.hpp 2015-05-30 17:41:38 UTC (rev 11128)
@@ -234,7 +234,7 @@
}
start(flags, pack);
}
-
+
// The destructor of session will notify all trackers that our torrents
// have been shut down. If some trackers are down, they will time out.
// All this before the destructor of session returns. So, it's advised
@@ -534,8 +534,11 @@
// ``is_dht_running()`` returns true if the DHT support has been started
// and false
// otherwise.
+ //
+ // ``get_dht_settings()`` returns the current settings
void set_dht_settings(dht_settings const& settings);
bool is_dht_running() const;
+ dht_settings get_dht_settings() const;
// ``add_dht_node`` takes a host name and port pair. That endpoint will be
// pinged, and if a valid DHT reply is received, the node will be added to
Modified: trunk/include/libtorrent/session_settings.hpp
===================================================================
--- trunk/include/libtorrent/session_settings.hpp 2015-05-30 06:31:03 UTC (rev 11127)
+++ trunk/include/libtorrent/session_settings.hpp 2015-05-30 17:41:38 UTC (rev 11128)
@@ -1498,7 +1498,7 @@
, block_timeout(5 * 60)
, block_ratelimit(5)
{}
-
+
// the maximum number of peers to send in a reply to ``get_peers``
int max_peers_reply;
@@ -1506,13 +1506,13 @@
// announcing and refreshing the routing table. This parameter is called
// alpha in the kademlia paper
int search_branching;
-
+
#ifndef TORRENT_NO_DEPRECATE
// the listen port for the dht. This is a UDP port. zero means use the
// same as the tcp interface
int service_port;
#endif
-
+
// the maximum number of failed tries to contact a node before it is
// removed from the routing table. If there are known working nodes that
// are ready to replace a failing node, it will be replaced immediately,
Modified: trunk/src/session.cpp
===================================================================
--- trunk/src/session.cpp 2015-05-30 06:31:03 UTC (rev 11127)
+++ trunk/src/session.cpp 2015-05-30 17:41:38 UTC (rev 11128)
@@ -816,6 +816,16 @@
#endif
}
+ dht_settings session::get_dht_settings() const
+ {
+#ifndef TORRENT_DISABLE_DHT
+ return TORRENT_SYNC_CALL_RET(dht_settings, get_dht_settings);
+#else
+ return dht_settings();
+#endif
+ }
+
+
#ifndef TORRENT_NO_DEPRECATE
void session::start_dht(entry const& startup_state)
{
@@ -833,7 +843,7 @@
#endif
}
#endif // TORRENT_NO_DEPRECATE
-
+
void session::add_dht_node(std::pair<std::string, int> const& node)
{
#ifndef TORRENT_DISABLE_DHT
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|