From 362f7009060a41237015d698f85d546f76edcc80 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Mon, 25 Sep 2006 22:37:48 +0000 Subject: [PATCH] fixed integer overflow bug occuring when building with gcc 4.1.x. updated the projects page, removed dead code from allocate_resources. --- ChangeLog | 1 + docs/building.html | 8 +++++++ docs/building.rst | 9 ++++++++ docs/gtorrent_thumb.jpg | Bin 0 -> 4191 bytes docs/index.html | 7 +++++- docs/index.rst | 12 +++++++++-- docs/manual.html | 8 +++---- docs/manual.rst | 4 ++-- docs/projects.html | 8 +++++++ docs/projects.rst | 7 ++++++ include/libtorrent/allocate_resources.hpp | 7 +----- src/allocate_resources.cpp | 25 ++++------------------ 12 files changed, 60 insertions(+), 36 deletions(-) create mode 100644 docs/gtorrent_thumb.jpg diff --git a/ChangeLog b/ChangeLog index 7513f29da..95a853cec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ + * fixed an integer overflow bug occuring when built with gcc 4.1.x * fixed crasing bug when closing while checking a torrent * fixed bug causing a crash with a torrent with piece length 0 * added an extension to the DHT network protocol to support the diff --git a/docs/building.html b/docs/building.html index cd5e346fd..cc320d843 100644 --- a/docs/building.html +++ b/docs/building.html @@ -293,6 +293,14 @@ LDFLAGS, as Boost::Thread detection will fail without it, even if Boost::Thread is installed.

If you need to set these variables, it may be a good idea to add those lines to your ~/.profile or ~/.tcshrc depending on your shell.

+

If the boost libraries are named with a suffix on your platform, you may use +the --with-boost-thread= option to specify the suffix used for the thread +library in this case. For more information about these options, run:

+
+./configure --help
+
+

On gentoo the boost libraries that are built with multi-threading support have +the suffix mt.

You know that the boost libraries were found if you see the following output from the configure script:

diff --git a/docs/building.rst b/docs/building.rst
index 271d34114..7315bf08c 100644
--- a/docs/building.rst
+++ b/docs/building.rst
@@ -291,6 +291,15 @@ Boost::Thread is installed.
 If you need to set these variables, it may be a good idea to add those lines
 to your ``~/.profile`` or ``~/.tcshrc`` depending on your shell.
 
+If the boost libraries are named with a suffix on your platform, you may use
+the ``--with-boost-thread=`` option to specify the suffix used for the thread
+library in this case. For more information about these options, run::
+
+	./configure --help
+
+On gentoo the boost libraries that are built with multi-threading support have
+the suffix ``mt``.
+
 You know that the boost libraries were found if you see the following output
 from the configure script::
 
diff --git a/docs/gtorrent_thumb.jpg b/docs/gtorrent_thumb.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..ba389611028f2ef0b63aa1fd40dcd0a4857ca974
GIT binary patch
literal 4191
zcmb7Gc{J4R-~J9WjNOb0V;##BvKPjZEZK$zV<}6aY(tEFOJXAXlrhK}vVLy
z1M0eXJ#9-Zgn^M2%6JM678WK}7zZ2<dX7}=pvb|C}|A@u*oNh<(@0wF*;JxCOwgMsK_
zpp$k$002N>dJynmpa(NB(m|kqM{PI(5FMDFo`Hdx70U5<4v3B(07GC5a1kyAZN@XA
z=J*sSLd?n6k6ZD=MP;3+>KYo4_*p&wfIwcRuViUU5&fW~prgk&8rR4<<1&p((m$Oeb=I&oUEf1RLhfBiQkdV6
zNpmd6>U6}L9KO6H2&HyWs0pO?5?7nA#ULjUAdPSf@}p7rU1s`Xo>S=*)M8!Y4mJA>
z=q^{A@sG8KE=awb__s4QIJt()HPu^v#5N8QO><+UNAz89p~ZTigWDarc}hhVR8XLB
zL`T!XZ~92|OV={t(x9_{UEWF_*?zhZF;{1PUjIC1yoBXuhj?z&p|>SAt?H>8(*L){
zz!r|r2{clmCs{55UcCB3BQNsDC1-Y+^TOZdimDT)0fGYWTCS+-odEFW^bXANjSji7
zoScr1nkGwp`(tHRnx9agKeu@v~aNEP=P
zKR&&*Y&HF!Sp#2{NtPqAMTT|(#i4qUYZd4167LrdCLadsWuy$y?&kk9gnLFNUq*^u
zb^L+0o7>)b=_TW%Vk>O_>bC7iC3}NM=Z2)&;pyoXT%e6UE6bdT2N~aX_}Hc*>T7EL
zR*n?-ey#znZ`{tGXzl*o^V3{U^V!1Dr|-
zWyq++Oa}dWIUtFfV`ReTsC0#Ayf*C+km1fVP&e9qA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+R(0IB(zoH)r{@EGBxsZRD#s`%HGwDev&iz3ejUGR+vF~ac^Nziu!)wKhmv(L!u%}~)5MBklXS-MOyM0ssi
etwLSKj9X68J$vuL3h;;WKI>pky=B&u@&5r-*nPbK

literal 0
HcmV?d00001

diff --git a/docs/index.html b/docs/index.html
index e21db8deb..53fbbc7fd 100755
--- a/docs/index.html
+++ b/docs/index.html
@@ -21,6 +21,11 @@
 
  • report bugs
  • sourceforge page
  • +
    +

    libtorrent

    @@ -54,7 +59,7 @@ library and not a full featured client, although it comes with a working

    Acknowledgements

    -

    Written by Arvid Norberg. Copyright (c) 2003

    +

    Written by Arvid Norberg. Copyright (c) 2003-2006

    Contributions by Magnus Jonsson, Daniel Wallin and Cory Nelson

    Thanks to Reimond Retz for bugfixes, suggestions and testing

    Project is hosted by sourceforge.

    diff --git a/docs/index.rst b/docs/index.rst index 97ecf3737..779f1f3bb 100755 --- a/docs/index.rst +++ b/docs/index.rst @@ -11,7 +11,12 @@ * `mailing list`_ (archive_) * `who's using libtorrent?`_ * `report bugs`_ -* `sourceforge page`_ +* `sourceforge page`_ + +-------- + +* `ruby bindings`_ +* `python bindings`_ .. raw:: html @@ -34,6 +39,9 @@ libtorrent .. _`report bugs`: http://sourceforge.net/tracker/?group_id=79942&atid=558250 .. _sourceforge page: http://www.sourceforge.net/projects/libtorrent +.. _`ruby bindings`: http://libtorrent-ruby.rubyforge.org/ +.. _`python bindings`: http://code.google.com/p/python-libtorrent/ + libtorrent is a C++ library that aims to be a good alternative to all the other bittorrent implementations around. It is a library and not a full featured client, although it comes with a working @@ -81,7 +89,7 @@ You can usually find me as hydri in ``#libtorrent`` on ``irc.freenode.net``. Acknowledgements ================ -Written by Arvid Norberg. Copyright (c) 2003 +Written by Arvid Norberg. Copyright (c) 2003-2006 Contributions by Magnus Jonsson, Daniel Wallin and Cory Nelson diff --git a/docs/manual.html b/docs/manual.html index 1ccda3298..d0ad9794e 100755 --- a/docs/manual.html +++ b/docs/manual.html @@ -426,7 +426,7 @@ void set_max_half_open_connections(int limit);

    Sets the maximum number of half-open connections libtorrent will have when connecting to peers. A half-open connection is one where connect() has been -called, but the connection still hasn't been established (nor filed). Windows +called, but the connection still hasn't been established (nor failed). Windows XP Service Pack 2 sets a default, system wide, limit of the number of half-open connections to 10. So, this limit can be used to work nicer together with other network applications on that system. The default is to have no limit, @@ -2458,7 +2458,7 @@ struct peer_error_alert: alert

    invalid_request_alert

    This is a debug alert that is generated by an incoming invalid piece request. The handle -is a handle to the torrent the peer is a member of. Ïp is the address of the peer and the +is a handle to the torrent the peer is a member of. ìp is the address of the peer and the request is the actual incoming request from the peer. The alert is generated as severity level debug.

    @@ -3045,13 +3045,13 @@ boost::filesystem::path::default_name_check(boost::filesystem::native);
     

    acknowledgments

    -

    Written by Arvid Norberg. Copyright © 2003-2005

    +

    Written by Arvid Norberg. Copyright © 2003-2006

    Contributions by Magnus Jonsson, Daniel Wallin and Cory Nelson

    Lots of testing, suggestions and contributions by Massaroddel and Tianhao Qiu.

    Big thanks to Michael Wojciechowski and Peter Koeleman for making the autotools scripts.

    Thanks to Reimond Retz for bugfixes, suggestions and testing

    -

    Thanks to University of Ume for providing development and test hardware.

    +

    Thanks to University of Umeå for providing development and test hardware.

    Project is hosted by sourceforge.

    sf_logo

    diff --git a/docs/manual.rst b/docs/manual.rst index fe555bbfe..971053a31 100755 --- a/docs/manual.rst +++ b/docs/manual.rst @@ -285,7 +285,7 @@ set_max_half_open_connections() Sets the maximum number of half-open connections libtorrent will have when connecting to peers. A half-open connection is one where connect() has been -called, but the connection still hasn't been established (nor filed). Windows +called, but the connection still hasn't been established (nor failed). Windows XP Service Pack 2 sets a default, system wide, limit of the number of half-open connections to 10. So, this limit can be used to work nicer together with other network applications on that system. The default is to have no limit, @@ -3086,7 +3086,7 @@ __ http://www.boost.org/libs/filesystem/doc/index.htm acknowledgments =============== -Written by Arvid Norberg. Copyright |copy| 2003-2005 +Written by Arvid Norberg. Copyright |copy| 2003-2006 Contributions by Magnus Jonsson, Daniel Wallin and Cory Nelson diff --git a/docs/projects.html b/docs/projects.html index f6d2e8c81..19c003f1c 100644 --- a/docs/projects.html +++ b/docs/projects.html @@ -100,6 +100,14 @@ Written by Cory Nelson.

    arctic_thumb.png
    +

    deluge torrent

    +

    deluge Torrent is a more full-featured yet still lightweight bittorrent +client. It has the ability to automatically resume partial downloads and +background to the system tray.

    + +
    gtorrent_thumb.jpg
    + +

    ZipTorrent

    ZipTorrent is another windows bittorrent client with diff --git a/docs/projects.rst b/docs/projects.rst index f07f75351..5a9f188ba 100644 --- a/docs/projects.rst +++ b/docs/projects.rst @@ -69,6 +69,12 @@ project listed here, let me_ know. | bittorrent client for windows. | | | Written by Cory Nelson. | | +-------------------------------------------------------------------------------+-------------------------------------+ +| **deluge torrent** | .. image:: gtorrent_thumb.jpg | +| | | +| `deluge Torrent`_ is a more full-featured yet still lightweight bittorrent | | +| client. It has the ability to automatically resume partial downloads and | | +| background to the system tray. | | ++-------------------------------------------------------------------------------+-------------------------------------+ | **ZipTorrent** | .. image:: ziptorrent_thumb.gif | | | | | ZipTorrent_ is another windows | | @@ -108,6 +114,7 @@ project listed here, let me_ know. .. _BitSlug: http://bitslug.sourceforge.net/ .. _BitBuddy: http://www.btvampire.com .. _`Arctic Torrent`: http://www.int64.org/arctic.html +.. _`deluge Torrent`: http://code.google.com/p/deluge-torrent/ .. _ZipTorrent: http://www.ziptorrent.com/ .. _FireANT: http://antisnottv.net/ .. _eDonkey2000: http://www.edonkey2000.com/ diff --git a/include/libtorrent/allocate_resources.hpp b/include/libtorrent/allocate_resources.hpp index 318f8939d..b859b6b47 100644 --- a/include/libtorrent/allocate_resources.hpp +++ b/include/libtorrent/allocate_resources.hpp @@ -55,12 +55,7 @@ namespace libtorrent // sure "used" is updated between calls!). // If resources = std::numeric_limits::max() it means there is an infinite // supply of resources (so everyone can get what they want). -/* - void allocate_resources( - int resources - , std::map, boost::intrusive_ptr >& connections - , resource_request peer_connection::* res); -*/ + void allocate_resources( int resources , std::map >& torrents diff --git a/src/allocate_resources.cpp b/src/allocate_resources.cpp index eee6feb0f..e06b2417d 100644 --- a/src/allocate_resources.cpp +++ b/src/allocate_resources.cpp @@ -73,12 +73,12 @@ namespace libtorrent assert(b <= resource_request::inf); assert(resource_request::inf + resource_request::inf < 0); - int sum = a + b; - if (sum < 0) + unsigned int sum = unsigned(a) + unsigned(b); + if (sum > unsigned(resource_request::inf)) sum = resource_request::inf; - assert(sum >= a && sum >= b); - return sum; + assert(sum >= unsigned(a) && sum >= unsigned(b)); + return int(sum); } namespace @@ -278,23 +278,6 @@ namespace libtorrent } // namespace anonymous -/* - void allocate_resources( - int resources - , std::map, boost::intrusive_ptr >& c - , resource_request peer_connection::* res) - { - typedef std::map, boost::intrusive_ptr >::iterator orig_iter; - typedef std::pair, boost::intrusive_ptr > in_param; - typedef boost::transform_iterator new_iter; - - allocate_resources_impl( - resources - , new_iter(c.begin(), &pick_peer) - , new_iter(c.end(), &pick_peer) - , res); - } -*/ #if defined(_MSC_VER) && _MSC_VER < 1310 namespace detail