📄 seedtorrent.mht
字号:
<TD width=3D1 bgColor=3D#000000><IMG height=3D20=20
src=3D"http://www.getright.com/images/shim.gif" width=3D1 =
border=3D0></TD>
<TD vAlign=3Dcenter align=3Dleft=20
background=3Dhttp://www.getright.com/images/topborder.gif=20
bgColor=3D#0e58d1><FONT face=3DVerdana color=3D#ffffff=20
size=3D1><B> <A name=3D(none)>Proposed =
Addition to=20
.torrent Files</A> </B></FONT></TD>
<TD background=3Dhttp://www.getright.com/images/topborder.gif =
bgColor=3D#0e58d1=20
colSpan=3D2><IMG height=3D1 =
src=3D"http://www.getright.com/images/shim.gif"=20
width=3D10 border=3D0></TD>
<TD bgColor=3D#0e58d1><IMG height=3D1=20
src=3D"http://www.getright.com/images/shim.gif" width=3D10 =
border=3D0></TD>
<TD width=3D1 bgColor=3D#000000><IMG height=3D1=20
src=3D"http://www.getright.com/images/shim.gif" width=3D1 =
border=3D0></TD></TR>
<TR>
<TD width=3D1 bgColor=3D#000000 colSpan=3D4><IMG height=3D1=20
src=3D"http://www.getright.com/images/shim.gif" width=3D1 =
border=3D0></TD>
<TD bgColor=3D#0e58d1><IMG height=3D1=20
src=3D"http://www.getright.com/images/shim.gif" width=3D10 =
border=3D0></TD>
<TD width=3D1 bgColor=3D#000000><IMG height=3D1=20
src=3D"http://www.getright.com/images/shim.gif" width=3D1=20
border=3D0></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=3D0 cellPadding=3D0 width=3D740 border=3D0 =
cellmargin=3D"0"><!-- NEW MAIN BODY -->
<TBODY>
<TR>
<TD width=3D1 bgColor=3D#000000><IMG height=3D1=20
src=3D"http://www.getright.com/images/shim.gif" width=3D1 =
border=3D0></TD>
<TD vAlign=3Dtop align=3Dleft bgColor=3D#ffffff><IMG height=3D1=20
src=3D"http://www.getright.com/images/shim.gif" width=3D20 =
border=3D0></TD>
<TD vAlign=3Dtop align=3Dleft bgColor=3D#ffffff><FONT =
face=3DVerdana,Arial=20
size=3D2> <BR>I propose a new key/value in the .torrent =
metadata file=20
but not part of the "info" section.=20
<P>'url-list' =3D either a single item or a list of normal URLs.=20
<P>For example (on multiple lines for readability): <BR>d=20
<BR>8:announce27:http://tracker.com/announce <BR>13:creation=20
datei1128487910e =
<BR><B>8:url-list26:http://mirror.com/file.exe</B>=20
<BR>4:info...=20
<P>If the "url-list" URL ends in a slash, "<B>/</B>" the client =
should add=20
the "name" from the torrent to make the full URL. This should make =
it=20
easier on Torrent generators and let them treat this field same =
for single=20
file and multi-file torrents.=20
<P>
<HR>
<P>For <B>Multi-File</B> torrents, this gets a bit more =
interesting.=20
Normally, BitTorrent clients use the "name" from the .torrent info =
section=20
to make a folder, then use the "path/file" items from the info =
section=20
within that folder. For the case of Multi-File torrents, the =
'url-list'=20
should be a root folder where a client could add the same "name" =
and=20
"path/file" to create the URL for the request. <BR>...=20
<BR><B>8:url-list22:<FONT =
color=3D#ff0000>http://mirror.com/pub/</FONT></B>=20
<BR>4:infod5:filesld6:lengthi949e4:pathl10:<B><FONT=20
color=3D#008000>Readme.txt</FONT></B>e <BR>e4:name7:<B><FONT=20
color=3D#0000ff>michael</FONT></B>=20
<P>So a client would use all that to build a url: <B><FONT=20
color=3D#ff0000>http://mirror.com/pub/</FONT><FONT=20
color=3D#0000ff>michael/</FONT><FONT =
color=3D#008000>Readme.txt</FONT></B>=20
<BR> </FONT></P></TD>
<TD width=3D10 bgColor=3D#ffffff><IMG height=3D1=20
src=3D"http://www.getright.com/images/shim.gif" width=3D10 =
border=3D0></TD>
<TD width=3D1 bgColor=3D#000000><IMG height=3D1=20
src=3D"http://www.getright.com/images/shim.gif" width=3D1 =
border=3D0></TD>
<TD width=3D10 bgColor=3D#0e58d1><IMG height=3D1=20
src=3D"http://www.getright.com/images/shim.gif" width=3D10 =
border=3D0></TD>
<TD width=3D1 bgColor=3D#000000><IMG height=3D1=20
src=3D"http://www.getright.com/images/shim.gif" width=3D1=20
border=3D0></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=3D0 cellPadding=3D0 width=3D740 border=3D0 =
cellmargin=3D"0">
<TBODY>
<TR>
<TD width=3D1 bgColor=3D#000000><IMG height=3D20=20
src=3D"http://www.getright.com/images/shim.gif" width=3D1 =
border=3D0></TD>
<TD vAlign=3Dcenter align=3Dleft=20
background=3Dhttp://www.getright.com/images/topborder.gif=20
bgColor=3D#0e58d1><FONT face=3DVerdana color=3D#ffffff=20
size=3D1><B> <A =
name=3D(none)>Implementation Notes for=20
Clients</A> </B></FONT></TD>
<TD background=3Dhttp://www.getright.com/images/topborder.gif =
bgColor=3D#0e58d1=20
colSpan=3D2><IMG height=3D1 =
src=3D"http://www.getright.com/images/shim.gif"=20
width=3D10 border=3D0></TD>
<TD bgColor=3D#0e58d1><IMG height=3D1=20
src=3D"http://www.getright.com/images/shim.gif" width=3D10 =
border=3D0></TD>
<TD width=3D1 bgColor=3D#000000><IMG height=3D1=20
src=3D"http://www.getright.com/images/shim.gif" width=3D1 =
border=3D0></TD></TR>
<TR>
<TD width=3D1 bgColor=3D#000000 colSpan=3D4><IMG height=3D1=20
src=3D"http://www.getright.com/images/shim.gif" width=3D1 =
border=3D0></TD>
<TD bgColor=3D#0e58d1><IMG height=3D1=20
src=3D"http://www.getright.com/images/shim.gif" width=3D10 =
border=3D0></TD>
<TD width=3D1 bgColor=3D#000000><IMG height=3D1=20
src=3D"http://www.getright.com/images/shim.gif" width=3D1=20
border=3D0></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=3D0 cellPadding=3D0 width=3D740 border=3D0 =
cellmargin=3D"0"><!-- NEW MAIN BODY -->
<TBODY>
<TR>
<TD width=3D1 bgColor=3D#000000><IMG height=3D1=20
src=3D"http://www.getright.com/images/shim.gif" width=3D1 =
border=3D0></TD>
<TD vAlign=3Dtop align=3Dleft bgColor=3D#ffffff><IMG height=3D1=20
src=3D"http://www.getright.com/images/shim.gif" width=3D20 =
border=3D0></TD>
<TD vAlign=3Dtop align=3Dleft bgColor=3D#ffffff><FONT =
face=3DVerdana,Arial=20
size=3D2> <BR>GetRight was already able to download the same =
file from=20
several HTTP/FTP mirrors at once, a feature common in many =
download=20
managers. When adding the BitTorrent protocols into GetRight, it =
made=20
sense to just consider BitTorrent another protocol and be able to =
do the=20
same.=20
<P>HTTP/FTP are streaming protocols, and don't have BitTorrent's =
concept=20
of blocks. For HTTP you can use byte-ranges to resume anywhere or =
download=20
specific ranges you specify, but with FTP you can only say where =
to start=20
the download. So I wanted to have big "gaps" in the data =
downloaded from=20
BitTorrent peers so a HTTP/FTP connection would have big spaces to =
fill=20
in. You could use the byte-ranges with HTTP to request individual=20
blocks--but each request will show in the server's logs, and =
somebody is=20
going to think your DoSing them if it shows 100's of connections =
in their=20
log. So I made a couple changes to the usual "rarest first"=20
piece-selection method to better allow "gaps" to develop between =
pieces.=20
That way there are longer spaces in the file for HTTP and FTP =
threads to=20
fill. They can start at the beginning of a gap and download until =
they get=20
to the end.=20
<P><I>This actually could be implemented differently. You could =
use the=20
HTTP byte-ranges to request specific pieces and not worry about =
any=20
server's logs. This method just fit in very well with all the code =
I'd=20
already done for GetRight's accelerating files. Plus does minimize =
some=20
connections and restarts.</I>=20
<DL>
<DT>How I'm defining Gaps in a file:=20
<DD>
<LI>Gaps are spaces of multiple pieces in a row that I don't =
have. </LI>
<DD>
<LI>Given a bitfield <B>"YYnnnnYnnY"</B> where Y is pieces it =
has and n=20
are ones it doesn't, there are two gaps <B>"YY<FONT=20
color=3D#008800>nnnn</FONT>Y<FONT =
color=3D#0000ff>nn</FONT>Y"</B>, one of=20
<FONT color=3D#008800><B>4</B></FONT> pieces, and another of =
<FONT=20
color=3D#0000ff><B>2</B></FONT>. </LI>
<DD>
<LI>If everything else is more-or-less equivalent, it's better =
to pick a=20
piece to do from the gap of <FONT =
color=3D#0000ff><B>2</B></FONT> when=20
requesting a piece from a BitTorrent peer. </LI>
<DD>
<LI>In any gap, it will fill in from the end (ie, the highest =
piece=20
number). That way a HTTP/FTP connection could be cruising along =
filling=20
in pieces from the beginning and I don't have to do any =
reconnects for=20
it until they meet in the middle.=20
<P></P></LI>
<DT>Change the "rarest first" piece selection to a "pretty rare =
with=20
biggest distance from another completed piece".=20
<DD>
<LI>When scanning for the rarest piece, if the distance from =
another=20
completed piece is less than that for the current rarest piece, =
it must=20
be "rare-X". Or if the distance is greater than the current =
piece's, it=20
can be rare+X to be picked as the next piece. (For no better =
reason than=20
it seemed to make sense and scale, X is the square root of the =
number of=20
peers minus 1.) </LI>
<DD>
<LI>So if 3 peers had the current rarest piece, the normal =
algorithm=20
would pick a piece where 2 peers had it...my changed algorithm =
would=20
require that only 1 peer has the piece if that piece's distance =
from a=20
complete piece was less than the gap for the current rarest =
piece. </LI>
<DD>
<LI>If the gap is bigger and the piece is the same "rareness" or =
the=20
usual "rare-1" that piece is selected. (So if the gap is bigger, =
a piece=20
with either 2 or 3 peers would be chosen.) </LI>
<DD>
<LI>So given <B>"YYnnn<FONT color=3D#008800>1</FONT>Yn<FONT=20
color=3D#0000ff>2</FONT>Y"</B>, unless <FONT =
color=3D#008800><B>1</B></FONT>=20
is a lot more rare than <FONT color=3D#0000ff><B>2</B></FONT>, =
it's better=20
to pick piece <FONT color=3D#0000ff><B>2</B></FONT>. </LI>
<DD>
<LI>I always do better explaining or understanding with some =
code logic=20
to look at...=20
<UL><PRE>X =3D sqrt(Peers) - 1;
for (i=3D0; i<maxpieces; i++) {
if (*IDon'tHavePiece*) {
Gap++;
if (*PeerHasPiece*) {
PieceRareness =3D *Number of peers with the piece*;
if (PieceRareness<(CurRareness-X) || =
(PieceRareness<=3D(CurRareness+X) && Gap>CurGap)) {
CurRareness =3D PieceRareness;
CurGap =3D Gap;
NextPiece =3D i;
}
}
} else {
Gap =3D 0;
}
}
</PRE></UL>
<P></P></LI>
<DT>Added an extra "fill-in-the-gaps" piece selection method.=20
<DD>
<LI>This check is only done If a file is more than 50% =
complete--so you=20
should have a large number of pieces that other peers will want =
to=20
download. </LI>
<DD>
<LI>Every few pieces (randomly, 1 in 10), it will pick the piece =
with=20
the smallest gap from a complete piece. For the bitfield=20
<B>"YYnnnnYnnY"</B> it would select the <FONT =
color=3D#880000>#</FONT> one=20
<B>"YYnnnnYn<FONT color=3D#880000>#</FONT>Y"</B>=20
<P></P></LI>
<DT>For the HTTP/FTP download part...=20
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -