[Libtorrent-devel] libTorrent 0.9.0 and rTorrent 0.5.0 released

Jari Petter Sundell jaris at student.matnat.uio.no
Mon Apr 10 14:06:17 UTC 2006


On Sun, 9 Apr 2006, Jim Westfall wrote:

> Hi
>
> I have been getting the following exception from time to time since
> upgrading to this version.
>
> rtorrent: Connection read fd(56,0,5) "ChunkStatistics::received_connect(...) pc->using_counter() == true."

Looks like i forgot to re-add disconnecting peers that send their bitfield 
after other messages in some earlier rewrite. Then the latest chunk 
statistics code assumed it was checked.

The above patch should fix this.

Rakshasa

Wheat on black, lightly sprinkled with subdued colors; the color of code.
-------------- next part --------------
Index: libtorrent/src/protocol/peer_connection_seed.cc
===================================================================
--- libtorrent/src/protocol/peer_connection_seed.cc	(revision 666)
+++ libtorrent/src/protocol/peer_connection_seed.cc	(working copy)
@@ -159,6 +159,11 @@
     return true;
 
   case ProtocolBase::BITFIELD:
+    // Bad peer, sending their bitfield after other messages have been
+    // sent.
+    if (m_peerChunks.using_counter() || !m_peerChunks.bitfield()->is_all_unset())
+      throw close_connection();
+
     if (read_bitfield_from_buffer(length - 1)) {
       finish_bitfield();
       return true;
Index: libtorrent/src/protocol/peer_connection_leech.cc
===================================================================
--- libtorrent/src/protocol/peer_connection_leech.cc	(revision 666)
+++ libtorrent/src/protocol/peer_connection_leech.cc	(working copy)
@@ -200,6 +200,11 @@
     return true;
 
   case ProtocolBase::BITFIELD:
+    // Bad peer, sending their bitfield after other messages have been
+    // sent.
+    if (m_peerChunks.using_counter() || !m_peerChunks.bitfield()->is_all_unset())
+      throw close_connection();
+
     if (read_bitfield_from_buffer(length - 1)) {
       finish_bitfield();
       return true;


More information about the Libtorrent-devel mailing list