diff --git a/TODO b/TODO index 958c3ddf..ca59cca8 100644 --- a/TODO +++ b/TODO @@ -42,5 +42,11 @@ and can also be sure to receive all mentions. - Implement hashtag "storage-less" torrents for post distribution. +- Define expiration policies to dht stored values. Currently all keys are refreshed every hour which, +according to previous bittorrent research, would be enough to keep data available forever (with high +probability). twister also persists keys to disk. As userbase increases, old post storage and +unreliable multivalued keys should better expire. Since those posts include the height and time, a +policy may me defined. +- diff --git a/libtorrent/include/libtorrent/bt_peer_connection.hpp b/libtorrent/include/libtorrent/bt_peer_connection.hpp index c53f93be..14e1e446 100644 --- a/libtorrent/include/libtorrent/bt_peer_connection.hpp +++ b/libtorrent/include/libtorrent/bt_peer_connection.hpp @@ -434,10 +434,10 @@ private: boost::scoped_ptr m_sync_hash; #endif // #ifndef TORRENT_DISABLE_ENCRYPTION -#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS // this is set to true when the client's // bitfield is sent to this peer bool m_sent_bitfield; +#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS bool m_in_constructor; diff --git a/libtorrent/src/bt_peer_connection.cpp b/libtorrent/src/bt_peer_connection.cpp index b0e08e02..083a3c23 100644 --- a/libtorrent/src/bt_peer_connection.cpp +++ b/libtorrent/src/bt_peer_connection.cpp @@ -118,8 +118,8 @@ namespace libtorrent , m_rc4_encrypted(false) , m_sync_bytes_read(0) #endif -#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS , m_sent_bitfield(false) +#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS , m_in_constructor(true) , m_sent_handshake(false) #endif @@ -227,8 +227,8 @@ namespace libtorrent if (m_state < read_packet_size) return; boost::shared_ptr t = associated_torrent().lock(); TORRENT_ASSERT(t); - if(!m_sent_bitfield) - write_bitfield(); + if(!m_sent_bitfield) + write_bitfield(); #ifndef TORRENT_DISABLE_DHT if (m_supports_dht_port && m_ses.m_dht) write_dht_port(m_ses.m_external_udp_port); @@ -254,9 +254,7 @@ namespace libtorrent { INVARIANT_CHECK; TORRENT_ASSERT(m_sent_handshake && !m_sent_bitfield); -#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS m_sent_bitfield = true; -#endif #ifdef TORRENT_VERBOSE_LOGGING peer_log("==> HAVE_ALL"); #endif @@ -268,9 +266,7 @@ namespace libtorrent { INVARIANT_CHECK; TORRENT_ASSERT(m_sent_handshake && !m_sent_bitfield); -#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS m_sent_bitfield = true; -#endif #ifdef TORRENT_VERBOSE_LOGGING peer_log("==> HAVE_NONE"); #endif @@ -1958,9 +1954,7 @@ namespace libtorrent // if we are super seeding, pretend to not have any piece // and don't send a bitfield -#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS m_sent_bitfield = true; -#endif // bootstrap superseeding by sending two have message superseed_piece(-1, t->get_piece_to_super_seed(get_bitfield())); @@ -1985,9 +1979,7 @@ namespace libtorrent #ifdef TORRENT_VERBOSE_LOGGING peer_log(" *** NOT SENDING BITFIELD"); #endif -#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS m_sent_bitfield = true; -#endif return; } @@ -2060,9 +2052,7 @@ namespace libtorrent } peer_log("==> BITFIELD [ %s ]", bitfield_string.c_str()); #endif -#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS m_sent_bitfield = true; -#endif send_buffer(msg, packet_size);