the forums at degreez.net
http://forums.degreez.net/

Compact Mode
http://forums.degreez.net/viewtopic.php?f=1&t=7573
Page 1 of 1

Author:  Spitfire [ Sun May 10, 2009 1:58 am ]
Post subject:  Compact Mode

Hi.

I'd like to know if Tornado is complient with COMPACT MODE?
And if not, will it be?

Author:  TheSHAD0W [ Sun May 10, 2009 12:26 pm ]
Post subject: 

It'd help if I knew what "COMPACT MODE" was... Googling doesn't bring up any solid definition of it.

Author:  Spitfire [ Mon May 11, 2009 3:07 am ]
Post subject: 

Quote:
compact : Setting this to 1 indicates that the client accepts a compact response. The peers list is replaced by a peers string with 6 bytes per peer. The first four bytes are the host (in network byte order), the last two bytes are the port (again in network byte order). It should be noted that some trackers only support compact responses (for saving bandwidth) and either refuse requests without "compact=1" or simply send a compact response unless the request contains "compact=0" (in which case they will refuse the request.) "


Found here : http://wiki.theory.org/index.php/BitTor ... S_Protocol

It seems to be a communication protocole for trackers to designate peers to clients, using less bandwitch.

Author:  Meskalyn [ Mon May 11, 2009 3:28 am ]
Post subject: 

Compact mode is a way to return peer list as a compact binary string :
Client give :
Code:
&info_hash=info_hash_here&peer_id=peer_id_here&port=54360&uploaded=0&downloaded=0&left=0&corrupt=0&key=D662A77D&numwant=200&compact=1&no_peer_id=1&ipv6=an_ipv6_address


Some tracker response with compact (binary in BBCode xD but I try to show you):
Code:
d8:intervali3600e12:min intervali3600e8:completei15e10:incompletei0e5:peers102:RZ¿Rþí¢{§^Kä!lîU±«/Zh/)ÔLýs7Z6K gß\ñ²¼X©=Sz÷dWZß#zvÂX©=\ñ²ÿÿÿ7SÀÀ1VØ.g¸e

Code:
d8:intervali2400e12:min intervali2400e8:completei18e10:incompletei0e5:peers102:RCZ9¡ÿZ¿R@v·{§U±  H¿UÞh/)ÔLýs7Z6K gß\ñ²¼Sz÷dWZß#zvÂX©=\ñ²ÿÿÿ7SÀÀ1VØ.g¸VD2ÿÿÿp}e


Tracker must respond with a peer list in binary format :
peers<string lenght>:<binary (lenght = 6) for IP:PORT of peer1><binary (lenght = 6) for IP:PORT of peer2>etc...
Compare to "classic" method, just removed the "peersl<peer list>"


Here is my php function to create peer pack list :
Code:
$resp = 'd8:intervali' . $annintval . 'e12:min intervali' . $annintval . 'e8:completei' . $torrent['seeders'] . 'e10:incompletei' . $torrent['leechers'] . 'e5:peers';
while ($row = mysql_fetch_assoc($res)){
   $peer_ip = explode('.', long2ip($row["ipv4"]));
   $peer_ip = pack("C*", $peer_ip[0], $peer_ip[1], $peer_ip[2], $peer_ip[3]);
   $peer_port = pack("n*", (int)$row["port"]);
   if($left == 0) {
      $time += 128;
   }
   $time = pack("C", $time);
   $peer[] = $time . $peer_ip . $peer_port;
   $pnum++;
}
$o = '';
for($i=0;$i<$pnum;$i++) {
   $o .= substr($peer[$i], 1, 6);
}

$resp .= strlen($o) . ':' . $o . 'e';



Edit:

Personaly, I use also the KEY param given into the URL, I don't know witch parameter give BitTornado. An I hope some params could be added (like Azureus) for :
require/suport Crypto
ipv6= IPv6 adress : if tracker haven't got IPv6 support, he cans return a peer list with IPv6
no_peer_id : I'm not sure about this but : if compact is set to 1, no_peer_id is set to 1 too.


I put the notifs to on.

Author:  TheSHAD0W [ Mon May 11, 2009 7:44 pm ]
Post subject: 

Oh! Yes, it is, both client and tracker.

Author:  Spitfire [ Tue May 12, 2009 12:08 am ]
Post subject: 

Great.

2nd question now :

Is there some option to enable compact mode in Bittornado, or that's activated by default?

Author:  TheSHAD0W [ Tue May 12, 2009 9:06 am ]
Post subject: 

Default behavior.

Author:  DeHackEd [ Tue May 12, 2009 9:24 am ]
Post subject: 

There is absolutely no good reason to disable compact. It's backwards compatible when enabled and just plain better for everybody to use it.

Plus there's no setting to disable it.

Author:  Spitfire [ Tue May 12, 2009 11:50 am ]
Post subject: 

I don't want to disable it, i just wanted to be sure it was enabled by default ^^

Thx 4 answers.

Hop will be new versions of BitTornado in futur (almost 3 years i wait for that :p)

PS : why can't we donate for your project (not to Bram's one)?

Page 1 of 1 All times are UTC - 7 hours [ DST ]
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/