added build notes for vs.net 2005, removed old code from ip_filter.cpp, fixed problem where the stats could become incorrect in case of very high cpu load, added asserts in storage::read() to make sure one is not trying to read out of bounds.

This commit is contained in:
Arvid Norberg 2006-07-26 10:21:25 +00:00
parent 8234e9c12f
commit 00df2b5bc3
18 changed files with 267 additions and 183 deletions

View File

@ -1,3 +1,7 @@
* Added more clients to the identifiable list
* Fixed fingerprint parser to cope with latest Mainline versions
release 0.10 release 0.10
* fixed a bug where the requested number of peers in a tracker request could * fixed a bug where the requested number of peers in a tracker request could

View File

@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" /> <meta name="generator" content="Docutils 0.3.9: http://docutils.sourceforge.net/" />
<title>client_test example program</title> <title>client_test example program</title>
<link rel="stylesheet" href="style.css" type="text/css" /> <link rel="stylesheet" href="style.css" type="text/css" />
</head> </head>
@ -26,7 +26,7 @@ client and has the metadata (.torrent file). The metadata extension in
libtorrent will then download it from that peer (or from those peers if more libtorrent will then download it from that peer (or from those peers if more
than one).</p> than one).</p>
<p>While running, the <tt class="docutils literal"><span class="pre">client_test</span></tt> sample will look something like this:</p> <p>While running, the <tt class="docutils literal"><span class="pre">client_test</span></tt> sample will look something like this:</p>
<img alt="client_test.png" src="client_test.png" /> <div class="image"><img alt="client_test.png" src="client_test.png" /></div>
<p>The commands available in the client are:</p> <p>The commands available in the client are:</p>
<ul class="simple"> <ul class="simple">
<li><tt class="docutils literal"><span class="pre">q</span></tt> quits the client (there will be a delay while the client waits <li><tt class="docutils literal"><span class="pre">q</span></tt> quits the client (there will be a delay while the client waits
@ -47,7 +47,7 @@ been requested from which peer. The green background means that it has been
downloaded. It shows that fast peers will prefer to request whole pieces downloaded. It shows that fast peers will prefer to request whole pieces
instead of dowloading parts of pieces. It may make it easier to determine instead of dowloading parts of pieces. It may make it easier to determine
which peer that sent the corrupt data if a piece fails the hash test.</p> which peer that sent the corrupt data if a piece fails the hash test.</p>
<img alt="unicode_support.png" src="unicode_support.png" /> <div class="image"><img alt="unicode_support.png" src="unicode_support.png" /></div>
<p>There's unicode support on linux, MacOS X and Windows.</p> <p>There's unicode support on linux, MacOS X and Windows.</p>
</div> </div>
</body> </body>

View File

@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" /> <meta name="generator" content="Docutils 0.3.9: http://docutils.sourceforge.net/" />
<title></title> <title></title>
<meta name="author" content="Arvid Norberg, arvid&#64;rasterbar.com Ludvig Strigeus, ludde&#64;utorrent.com" /> <meta name="author" content="Arvid Norberg, arvid&#64;rasterbar.com Ludvig Strigeus, ludde&#64;utorrent.com" />
<link rel="stylesheet" href="style.css" type="text/css" /> <link rel="stylesheet" href="style.css" type="text/css" />
@ -19,8 +19,8 @@
Ludvig Strigeus, <a class="last reference" href="mailto:ludde&#64;utorrent.com">ludde&#64;utorrent.com</a></td></tr> Ludvig Strigeus, <a class="last reference" href="mailto:ludde&#64;utorrent.com">ludde&#64;utorrent.com</a></td></tr>
</tbody> </tbody>
</table> </table>
<div class="section"> <div class="section" id="extension-protocol-for-bittorrent">
<h1><a id="extension-protocol-for-bittorrent" name="extension-protocol-for-bittorrent">extension protocol for bittorrent</a></h1> <h1><a name="extension-protocol-for-bittorrent">extension protocol for bittorrent</a></h1>
<p>The intention of this protocol is to provide a simple and thin transport <p>The intention of this protocol is to provide a simple and thin transport
for extensions to the bittorrent protocol. Supporting this protocol makes for extensions to the bittorrent protocol. Supporting this protocol makes
it easy to add new extensions without interfering with the standard it easy to add new extensions without interfering with the standard
@ -87,8 +87,8 @@ message as specified by the handshake.</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<div class="section"> <div class="section" id="handshake-message">
<h2><a id="handshake-message" name="handshake-message">handshake message</a></h2> <h2><a name="handshake-message">handshake message</a></h2>
<p>The payload of the handshake message is a bencoded dictionary. All items <p>The payload of the handshake message is a bencoded dictionary. All items
in the dictionary are optional. Any unknown names should be ignored in the dictionary are optional. Any unknown names should be ignored
by the client. All parts of the dictionary are case sensitive. by the client. All parts of the dictionary are case sensitive.
@ -218,8 +218,8 @@ for the actual extensions to the bittorrent protocol and the extensions
named in the example above (such as <tt class="docutils literal"><span class="pre">p</span></tt>) are just examples of possible named in the example above (such as <tt class="docutils literal"><span class="pre">p</span></tt>) are just examples of possible
extensions.</p> extensions.</p>
</div> </div>
<div class="section"> <div class="section" id="rationale">
<h2><a id="rationale" name="rationale">rationale</a></h2> <h2><a name="rationale">rationale</a></h2>
<p>The reason why the extension messages' IDs would be defined in the handshake <p>The reason why the extension messages' IDs would be defined in the handshake
is to avoid having a global registry somewhere, where ID's are assigned is to avoid having a global registry somewhere, where ID's are assigned
global identifiers. Now the extensions have unique names.</p> global identifiers. Now the extensions have unique names.</p>

View File

@ -3,129 +3,9 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" /> <meta name="generator" content="Docutils 0.3.9: http://docutils.sourceforge.net/" />
<title>libtorrent</title> <title>libtorrent</title>
<style type="text/css"> <link rel="stylesheet" href="style.css" type="text/css" />
body
{
background-color: white;
color: black;
margin: 1em 2em 1em 2em;
}
h1 { font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold; text-align: left; font-size: 140%; }
h2 { font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold; text-align: left; font-size: 110%; }
h3 { font-family: "courier new", courier, monospace; font-weight: bold; text-align: left; font-size: 100%; }
pre
{
border: gray 1pt solid;
padding: 2pt;
display: block;
font-family: "courier new", courier, monospace;
background-color: #eeeeee;
color: black;
font-size: small
}
code
{
white-space: pre;
border: gray 1pt solid;
padding: 2pt;
display: block;
font-family: "courier new", courier, monospace;
color: black;
font-size: small
}
tt
{
display: inline;
font-family: "Courier New", Courier, monospace;
}
p
{
text-align: justify;
font-family: Georgia, "Times New Roman", Times, serif
}
ul
{
font-family: Georgia, "Times New Roman", Times, serif
}
ol
{
font-family: Georgia, "Times New Roman", Times, serif
}
a:link
{
font-weight: bold;
color: #003366;
text-decoration: none;
}
a:visited
{
font-weight: bold;
color: #003366;
text-decoration: none;
}
table
{
border: 1px solid black;
border-collapse: collapse;
}
table td
{
padding: 6px;
}
table th
{
border: 3px solid black;
padding: 6px;
}
table.menu
{
border-style: none;
}
table.menu td
{
padding-left: 15px;
padding-right: 15px;
padding-top: 7px;
padding-bottom: 7px;
}
td
{
border: 1px solid black
}
div.warning, div.note, div.important {
width: 80%;
margin: 1.5em auto;
background: #C1E5F6;
background: #F1FFF5;
border: solid 1px #D1DFD5;
padding: 5px 10px 5px 10px;
}
</style>
</head> </head>
<body> <body>
<div class="document" id="libtorrent"> <div class="document" id="libtorrent">
@ -159,8 +39,8 @@ library and not a full featured client, although it comes with a working
<li>to be very easy to use</li> <li>to be very easy to use</li>
</ul> </ul>
</blockquote> </blockquote>
<div class="section"> <div class="section" id="donate">
<h1><a id="donate" name="donate">Donate</a></h1> <h1><a name="donate">Donate</a></h1>
<p>Support the development of libtorrent</p> <p>Support the development of libtorrent</p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"> <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="cmd" value="_xclick">
@ -172,13 +52,13 @@ library and not a full featured client, although it comes with a working
<input type="image" src="https://www.paypal.com/images/x-click-but04.gif" <input type="image" src="https://www.paypal.com/images/x-click-but04.gif"
border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!"> border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form></div> </form></div>
<div class="section"> <div class="section" id="feedback">
<h1><a id="feedback" name="feedback">Feedback</a></h1> <h1><a name="feedback">Feedback</a></h1>
<p>There's a <a class="reference" href="http://lists.sourceforge.net/lists/listinfo/libtorrent-discuss">mailing list</a>, general libtorrent discussion.</p> <p>There's a <a class="reference" href="http://lists.sourceforge.net/lists/listinfo/libtorrent-discuss">mailing list</a>, general libtorrent discussion.</p>
<p>You can usually find me as hydri in <tt class="docutils literal"><span class="pre">#libtorrent</span></tt> on <tt class="docutils literal"><span class="pre">irc.freenode.net</span></tt>.</p> <p>You can usually find me as hydri in <tt class="docutils literal"><span class="pre">#libtorrent</span></tt> on <tt class="docutils literal"><span class="pre">irc.freenode.net</span></tt>.</p>
</div> </div>
<div class="section"> <div class="section" id="acknowledgements">
<h1><a id="acknowledgements" name="acknowledgements">Acknowledgements</a></h1> <h1><a name="acknowledgements">Acknowledgements</a></h1>
<p>Written by Arvid Norberg. Copyright (c) 2003</p> <p>Written by Arvid Norberg. Copyright (c) 2003</p>
<p>Contributions by Magnus Jonsson, Daniel Wallin and Cory Nelson</p> <p>Contributions by Magnus Jonsson, Daniel Wallin and Cory Nelson</p>
<p>Thanks to Reimond Retz for bugfixes, suggestions and testing</p> <p>Thanks to Reimond Retz for bugfixes, suggestions and testing</p>

View File

@ -504,7 +504,8 @@ filenames, so if your target is Windows 2000 and up, you may want to use
<tt class="docutils literal"><span class="pre">file_win.cpp</span></tt> which supports unicode filenames.</p> <tt class="docutils literal"><span class="pre">file_win.cpp</span></tt> which supports unicode filenames.</p>
<p>If you're building in MS Visual Studio, you may have to set the compiler <p>If you're building in MS Visual Studio, you may have to set the compiler
options &quot;force conformance in for loop scope&quot;, &quot;treat wchar_t as built-in options &quot;force conformance in for loop scope&quot;, &quot;treat wchar_t as built-in
type&quot; and &quot;Enable Run-Time Type Info&quot; to Yes.</p> type&quot; and &quot;Enable Run-Time Type Info&quot; to Yes. For a detailed description
on how to build libtorrent with VS 2005, see <a class="reference" href="vs2005_build_notes.html">this document</a>.</p>
</div> </div>
<div class="section" id="build-configurations"> <div class="section" id="build-configurations">
<h2><a name="build-configurations">build configurations</a></h2> <h2><a name="build-configurations">build configurations</a></h2>

View File

@ -410,7 +410,10 @@ filenames, so if your target is Windows 2000 and up, you may want to use
If you're building in MS Visual Studio, you may have to set the compiler If you're building in MS Visual Studio, you may have to set the compiler
options "force conformance in for loop scope", "treat wchar_t as built-in options "force conformance in for loop scope", "treat wchar_t as built-in
type" and "Enable Run-Time Type Info" to Yes. type" and "Enable Run-Time Type Info" to Yes. For a detailed description
on how to build libtorrent with VS 2005, see `this document`_.
.. _`this document`: vs2005_build_notes.html
build configurations build configurations

View File

@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" /> <meta name="generator" content="Docutils 0.3.9: http://docutils.sourceforge.net/" />
<title>Bittorrent udp-tracker protocol extension</title> <title>Bittorrent udp-tracker protocol extension</title>
<meta name="author" content="Arvid Norberg, arvid&#64;rasterbar.com" /> <meta name="author" content="Arvid Norberg, arvid&#64;rasterbar.com" />
<link rel="stylesheet" href="style.css" type="text/css" /> <link rel="stylesheet" href="style.css" type="text/css" />
@ -35,8 +35,8 @@
<li><a class="reference" href="#credits" id="id10" name="id10">credits</a></li> <li><a class="reference" href="#credits" id="id10" name="id10">credits</a></li>
</ul> </ul>
</div> </div>
<div class="section"> <div class="section" id="introduction">
<h1><a id="introduction" name="introduction">introduction</a></h1> <h1><a name="introduction">introduction</a></h1>
<p>A tracker with the protocol &quot;udp://&quot; in its URI <p>A tracker with the protocol &quot;udp://&quot; in its URI
is supposed to be contacted using this protocol.</p> is supposed to be contacted using this protocol.</p>
<p>This protocol is supported by <p>This protocol is supported by
@ -50,8 +50,8 @@ are specified with ANSI-C standard types.</p>
the request. If no reply has been received after 60 seconds, stop the request. If no reply has been received after 60 seconds, stop
retrying.</p> retrying.</p>
</div> </div>
<div class="section"> <div class="section" id="connecting">
<h1><a id="connecting" name="connecting">connecting</a></h1> <h1><a name="connecting">connecting</a></h1>
<p>Client sends packet:</p> <p>Client sends packet:</p>
<table border="1" class="docutils"> <table border="1" class="docutils">
<colgroup> <colgroup>
@ -120,8 +120,8 @@ anymore.</td>
</tbody> </tbody>
</table> </table>
</div> </div>
<div class="section"> <div class="section" id="announcing">
<h1><a id="announcing" name="announcing">announcing</a></h1> <h1><a name="announcing">announcing</a></h1>
<p>Client sends packet:</p> <p>Client sends packet:</p>
<table border="1" class="docutils"> <table border="1" class="docutils">
<colgroup> <colgroup>
@ -282,8 +282,8 @@ seeding.</td>
</tbody> </tbody>
</table> </table>
</div> </div>
<div class="section"> <div class="section" id="scraping">
<h1><a id="scraping" name="scraping">scraping</a></h1> <h1><a name="scraping">scraping</a></h1>
<p>Client sends packet:</p> <p>Client sends packet:</p>
<table border="1" class="docutils"> <table border="1" class="docutils">
<colgroup> <colgroup>
@ -401,8 +401,8 @@ leechers.</td>
</tbody> </tbody>
</table> </table>
</div> </div>
<div class="section"> <div class="section" id="errors">
<h1><a id="errors" name="errors">errors</a></h1> <h1><a name="errors">errors</a></h1>
<p>In case of a tracker error,</p> <p>In case of a tracker error,</p>
<p>server replies packet:</p> <p>server replies packet:</p>
<table border="1" class="docutils"> <table border="1" class="docutils">
@ -436,8 +436,8 @@ describing the error.</td>
</tbody> </tbody>
</table> </table>
</div> </div>
<div class="section"> <div class="section" id="actions">
<h1><a id="actions" name="actions">actions</a></h1> <h1><a name="actions">actions</a></h1>
<p>The action fields has the following encoding:</p> <p>The action fields has the following encoding:</p>
<blockquote> <blockquote>
<ul class="simple"> <ul class="simple">
@ -448,8 +448,8 @@ describing the error.</td>
</ul> </ul>
</blockquote> </blockquote>
</div> </div>
<div class="section"> <div class="section" id="extensions">
<h1><a id="extensions" name="extensions">extensions</a></h1> <h1><a name="extensions">extensions</a></h1>
<p>The extensions field is a bitmask. The following <p>The extensions field is a bitmask. The following
bits are assigned:</p> bits are assigned:</p>
<blockquote> <blockquote>
@ -457,8 +457,8 @@ bits are assigned:</p>
<li>1 = <a class="reference" href="#authentication">authentication</a>.</li> <li>1 = <a class="reference" href="#authentication">authentication</a>.</li>
</ul> </ul>
</blockquote> </blockquote>
<div class="section"> <div class="section" id="authentication">
<h2><a id="authentication" name="authentication">authentication</a></h2> <h2><a name="authentication">authentication</a></h2>
<p>The packet will have an authentication part <p>The packet will have an authentication part
appended to it. It has the following format:</p> appended to it. It has the following format:</p>
<table border="1" class="docutils"> <table border="1" class="docutils">
@ -497,8 +497,8 @@ from the 20 bytes hash calculated.</td>
</table> </table>
</div> </div>
</div> </div>
<div class="section"> <div class="section" id="credits">
<h1><a id="credits" name="credits">credits</a></h1> <h1><a name="credits">credits</a></h1>
<p>Protocol designed by Olaf van der Spek</p> <p>Protocol designed by Olaf van der Spek</p>
</div> </div>
</div> </div>

View File

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.3.9: http://docutils.sourceforge.net/" />
<title>libtorrent setup for VS.NET 2005 Development</title>
<meta name="author" content="THOMAS GODDARD" />
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
<div class="document" id="libtorrent-setup-for-vs-net-2005-development">
<h1 class="title">libtorrent setup for VS.NET 2005 Development</h1>
<table class="docinfo" frame="void" rules="none">
<col class="docinfo-name" />
<col class="docinfo-content" />
<tbody valign="top">
<tr><th class="docinfo-name">Author:</th>
<td>THOMAS GODDARD</td></tr>
<tr><th class="docinfo-name">Contact:</th>
<td>www.thomasgoddard.com</td></tr>
</tbody>
</table>
<div class="section" id="prerequisites">
<h1><a name="prerequisites">Prerequisites</a></h1>
<ol class="arabic simple">
<li>Download boost from boost.org</li>
<li>Download libtorrent</li>
<li>Extract both to a folder called libtorrent</li>
</ol>
</div>
<div class="section" id="compiling-boost-for-vs-net-2005">
<h1><a name="compiling-boost-for-vs-net-2005">Compiling boost for VS.NET 2005</a></h1>
<ol class="arabic simple">
<li>Copy bjam.exe to libtorrent\boost_[version]\tools\build</li>
<li>Add the path &quot;libtorrent\boost_[version]\tools\build&quot; to the windows path environment variable</li>
<li>Log off / log back on</li>
<li>Open the file &quot;libtorrent\boost_[version]\tools\build\user-config.jam&quot; in notepad</li>
<li>Uncomment the <tt class="docutils literal"><span class="pre">#</span> <span class="pre">using</span> <span class="pre">msvc;</span></tt> line by removing the #</li>
<li>Replace the line with: <tt class="docutils literal"><span class="pre">using</span> <span class="pre">vc-8_0</span> <span class="pre">;</span></tt></li>
<li>Save the file and close it</li>
<li>Open the visual studio .net command line in the VS.net 2005 folder in your start menu</li>
<li>CD to the &quot;libtorrent\boost_[version]&quot; folder</li>
<li>Type: <tt class="docutils literal"><span class="pre">bjam</span> <span class="pre">&quot;-sTOOLS=vc-8_0&quot;</span> <span class="pre">install</span></tt> and hit enter</li>
<li>Be patient and wait for it to finish</li>
</ol>
<div class="section" id="troubleshooting">
<h2><a name="troubleshooting">Troubleshooting</a></h2>
<ul class="simple">
<li>Make sure to CD to the root of the boost directory before running the install.</li>
<li>For additional details and information on using Visual Studio 2005 Express addition, see the Boost Getting Started Guide.</li>
</ul>
</div>
</div>
<div class="section" id="setting-up-and-compiling-libtorrent-with-vs-net-2005">
<h1><a name="setting-up-and-compiling-libtorrent-with-vs-net-2005">Setting up and compiling libtorrent with VS.NET 2005</a></h1>
<ol class="arabic">
<li><p class="first">Create a new vs.net 2005 MFC project and solution file in the root of the libtorrent folder where you extracted all of the libtorrent files.</p>
</li>
<li><p class="first">Include the files contained in the src folder, excluding the makefiles.
<strong>NOTE:</strong>
Only include either file.cpp or file_win.cpp. Read here to determine which file to include:
<a class="reference" href="http://www.rasterbar.com/products/libtorrent/docs.html#building-with-other-build-systems">http://www.rasterbar.com/products/libtorrent/docs.html#building-with-other-build-systems</a></p>
</li>
<li><p class="first">Include all .c files in the zlib folder.</p>
</li>
<li><p class="first">Add the following Additional Include Header Files:</p>
<pre class="literal-block">
&quot;libtorrent\include&quot;
&quot;C:\Boost\include\boost-1_33_1&quot;
&quot;libtorrent\zlib&quot;
&quot;libtorrent\include\libtorrent&quot;
</pre>
</li>
<li><p class="first">Add the following Preprocessor Definitions:</p>
<pre class="literal-block">
WIN32
WIN32_LEAN_AND_MEAN
_WIN32_WINNT=0x0500
BOOST_ALL_NO_LIB
_FILE_OFFSET_BITS=64
BOOST_THREAD_USE_LIB
TORRENT_BUILDING_SHARED
TORRENT_LINKING_SHARED
UNICODE
</pre>
</li>
<li><p class="first">Add <tt class="docutils literal"><span class="pre">C:\Boost\lib</span></tt> to Additional Library Directories</p>
</li>
<li><p class="first">Add the following Additional Dependencies:</p>
<pre class="literal-block">
wsock32.lib
libboost_thread-vc80-mt.lib
libboost_filesystem-vc80-mt.lib
libboost_date_time-vc80-mt.lib
</pre>
</li>
<li><p class="first">Set the Runtime Library to Multi-threaded Debug DLL (/MDd) under the code generation section.</p>
</li>
</ol>
<div class="section" id="id1">
<h2><a name="id1">Troubleshooting</a></h2>
<dl class="docutils">
<dt>Error: error LNK2005:already defined etc...</dt>
<dd>Make sure you use the Multi-threaded Debug DLL (/MDd)</dd>
<dt>Error: error linking zlib related files...</dt>
<dd>Make sure to include all .c files in the zlib folder.</dd>
<dt>Runtime error in client_test.exe</dt>
<dd>If you're using boost-1.33.1, there is a bug in the program options
library which will make VS.NET 2005 assert. For a patch, see:
<a class="reference" href="http://thread.gmane.org/gmane.comp.lib.boost.devel/140932/focus=140932">http://thread.gmane.org/gmane.comp.lib.boost.devel/140932/focus=140932</a></dd>
</dl>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,92 @@
============================================
libtorrent setup for VS.NET 2005 Development
============================================
:Author: THOMAS GODDARD
:Contact: www.thomasgoddard.com
Prerequisites
-------------
1. Download boost from boost.org
2. Download libtorrent
3. Extract both to a folder called libtorrent
Compiling boost for VS.NET 2005
-------------------------------
1. Copy bjam.exe to libtorrent\\boost_[version]\\tools\\build
2. Add the path "libtorrent\\boost_[version]\\tools\\build" to the windows path environment variable
3. Log off / log back on
4. Open the file "libtorrent\\boost_[version]\\tools\\build\\user-config.jam" in notepad
5. Uncomment the ``# using msvc;`` line by removing the #
6. Replace the line with: ``using vc-8_0 ;``
7. Save the file and close it
8. Open the visual studio .net command line in the VS.net 2005 folder in your start menu
9. CD to the "libtorrent\\boost_[version]" folder
10. Type: ``bjam "-sTOOLS=vc-8_0" install`` and hit enter
11. Be patient and wait for it to finish
Troubleshooting
...............
* Make sure to CD to the root of the boost directory before running the install.
* For additional details and information on using Visual Studio 2005 Express addition, see the Boost Getting Started Guide.
Setting up and compiling libtorrent with VS.NET 2005
-----------------------------------------------------
1. Create a new vs.net 2005 MFC project and solution file in the root of the libtorrent folder where you extracted all of the libtorrent files.
2. Include the files contained in the src folder, excluding the makefiles.
**NOTE:**
Only include either file.cpp or file_win.cpp. Read here to determine which file to include:
http://www.rasterbar.com/products/libtorrent/docs.html#building-with-other-build-systems
3. Include all .c files in the zlib folder.
4. Add the following Additional Include Header Files::
"libtorrent\include"
"C:\Boost\include\boost-1_33_1"
"libtorrent\zlib"
"libtorrent\include\libtorrent"
5. Add the following Preprocessor Definitions::
WIN32
WIN32_LEAN_AND_MEAN
_WIN32_WINNT=0x0500
BOOST_ALL_NO_LIB
_FILE_OFFSET_BITS=64
BOOST_THREAD_USE_LIB
TORRENT_BUILDING_SHARED
TORRENT_LINKING_SHARED
UNICODE
6. Add ``C:\Boost\lib`` to Additional Library Directories
7. Add the following Additional Dependencies::
wsock32.lib
libboost_thread-vc80-mt.lib
libboost_filesystem-vc80-mt.lib
libboost_date_time-vc80-mt.lib
8. Set the Runtime Library to Multi-threaded Debug DLL (/MDd) under the code generation section.
Troubleshooting
...............
Error: error LNK2005:already defined etc...
Make sure you use the Multi-threaded Debug DLL (/MDd)
Error: error linking zlib related files...
Make sure to include all .c files in the zlib folder.
Runtime error in client_test.exe
If you're using boost-1.33.1, there is a bug in the program options
library which will make VS.NET 2005 assert. For a patch, see:
http://thread.gmane.org/gmane.comp.lib.boost.devel/140932/focus=140932

View File

@ -512,6 +512,7 @@ int main(int ac, char* av[])
session_settings settings; session_settings settings;
settings.user_agent = "client_test " LIBTORRENT_VERSION; settings.user_agent = "client_test " LIBTORRENT_VERSION;
settings.sequenced_download_threshold = 15;
std::deque<std::string> events; std::deque<std::string> events;

View File

@ -71,6 +71,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/ip_filter.hpp" #include "libtorrent/ip_filter.hpp"
#include "libtorrent/config.hpp" #include "libtorrent/config.hpp"
#include "libtorrent/session_settings.hpp" #include "libtorrent/session_settings.hpp"
#include "libtorrent/version.hpp"
#if !defined(NDEBUG) && defined(_MSC_VER) #if !defined(NDEBUG) && defined(_MSC_VER)
# include <float.h> # include <float.h>
@ -343,7 +344,8 @@ namespace libtorrent
{ {
public: public:
session(fingerprint const& print = fingerprint("LT", 0, 10, 0, 0)); session(fingerprint const& print = fingerprint("LT"
, LIBTORRENT_VERSION_MAJOR, LIBTORRENT_VERSION_MINOR, 0, 0));
session( session(
fingerprint const& print fingerprint const& print
, std::pair<int, int> listen_port_range , std::pair<int, int> listen_port_range

View File

@ -60,14 +60,7 @@ namespace libtorrent
assert(j != i); assert(j != i);
int first_access = i->access; int first_access = i->access;
/*
std::cout << "flags: " << flags << "\n";
std::cout << "first_access: " << first_access << "\n";
std::cout << "i->start: " << i->start.as_string() << "\n";
std::cout << "first: " << first.as_string() << "\n";
*/
int last_access = prior(j)->access; int last_access = prior(j)->access;
// std::cout << "last_access: " << last_access << "\n";
if (i->start != first && first_access != flags) if (i->start != first && first_access != flags)
{ {
@ -78,20 +71,11 @@ namespace libtorrent
--i; --i;
first_access = i->access; first_access = i->access;
} }
/*
std::cout << "distance(i, j): " << std::distance(i, j) << "\n";
std::cout << "size(): " << m_access_list.size() << "\n";
*/
assert(!m_access_list.empty()); assert(!m_access_list.empty());
assert(i != m_access_list.end()); assert(i != m_access_list.end());
if (i != j) if (i != j)
m_access_list.erase(next(i), j); m_access_list.erase(next(i), j);
/*
std::cout << "size(): " << m_access_list.size() << "\n";
std::cout << "last: " << last.as_string() << "\n";
std::cout << "last.ip(): " << last.ip() << " " << 0xffffffff << "\n";
*/
if (i->start == first) if (i->start == first)
{ {
// we can do this const-cast because we know that the new // we can do this const-cast because we know that the new
@ -108,7 +92,6 @@ namespace libtorrent
|| (j == m_access_list.end() && last.to_ulong() != 0xffffffff)) || (j == m_access_list.end() && last.to_ulong() != 0xffffffff))
{ {
assert(j == m_access_list.end() || last.to_ulong() < j->start.to_ulong() - 1); assert(j == m_access_list.end() || last.to_ulong() < j->start.to_ulong() - 1);
// std::cout << " -- last_access: " << last_access << "\n";
if (last_access != flags) if (last_access != flags)
j = m_access_list.insert(j, range(address(last.to_ulong() + 1), last_access)); j = m_access_list.insert(j, range(address(last.to_ulong() + 1), last_access));
} }

View File

@ -1453,6 +1453,9 @@ namespace libtorrent
m_download_queue.clear(); m_download_queue.clear();
m_request_queue.clear(); m_request_queue.clear();
// TODO: If we have a limited number of upload
// slots, choke this peer
m_assume_fifo = true; m_assume_fifo = true;
// this will trigger new picking of pieces // this will trigger new picking of pieces

View File

@ -93,7 +93,6 @@ namespace
// the last argument is if we should prefer whole pieces // the last argument is if we should prefer whole pieces
// for this peer. If we're downloading one piece in 20 seconds // for this peer. If we're downloading one piece in 20 seconds
// then use this mode. // then use this mode.
// TODO: 20 seconds has to be customizable
bool prefer_whole_pieces = c.statistics().download_payload_rate() bool prefer_whole_pieces = c.statistics().download_payload_rate()
* t.settings().whole_pieces_threshold * t.settings().whole_pieces_threshold
> t.torrent_file().piece_length(); > t.torrent_file().piece_length();

View File

@ -866,7 +866,7 @@ namespace libtorrent { namespace detail
// don't pass in the tick_interval here, because // don't pass in the tick_interval here, because
// the stats have already been adjusted in // the stats have already been adjusted in
// the peer's second tick. // the peer's second tick.
m_stat.second_tick(1.f); m_stat.second_tick(tick_interval);
// distribute the maximum upload rate among the torrents // distribute the maximum upload rate among the torrents

View File

@ -627,6 +627,7 @@ namespace libtorrent
#endif #endif
size_type start = slot * (size_type)m_pimpl->info.piece_length() + offset; size_type start = slot * (size_type)m_pimpl->info.piece_length() + offset;
assert(start + size <= m_pimpl->info.total_size());
// find the file iterator and file offset // find the file iterator and file offset
size_type file_offset = start; size_type file_offset = start;

View File

@ -1566,10 +1566,7 @@ namespace libtorrent
m_dl_bandwidth_quota.max = resource_request::inf; m_dl_bandwidth_quota.max = resource_request::inf;
accumulator += m_stat; accumulator += m_stat;
// don't pass the tick interval in here, because m_stat.second_tick(tick_interval);
// the stats have already been adjusted in the
// peer's stats.
m_stat.second_tick(1.f);
} }
void torrent::distribute_resources() void torrent::distribute_resources()

View File

@ -638,6 +638,7 @@ namespace libtorrent
std::vector<file_slice> ret; std::vector<file_slice> ret;
size_type start = piece * (size_type)m_piece_length + offset; size_type start = piece * (size_type)m_piece_length + offset;
assert(start + size <= m_total_size);
// find the file iterator and file offset // find the file iterator and file offset
// TODO: make a vector that can map piece -> file index in O(1) // TODO: make a vector that can map piece -> file index in O(1)