prioritize some more todo mark-ups

This commit is contained in:
Arvid Norberg 2013-01-21 01:40:59 +00:00
parent 44b81359b8
commit 652bf8323b
15 changed files with 2345 additions and 2477 deletions

File diff suppressed because it is too large Load Diff

View File

@ -16,6 +16,8 @@ items = []
# todo-items
context = []
priority_count = [0, 0, 0, 0]
def html_sanitize(s):
ret = ''
for i in s:
@ -45,6 +47,8 @@ for f in files:
items[-1]['priority'] = int(line[0])
line = line[1:].strip()
items[-1]['todo'] = line
prio = items[-1]['priority']
if prio >= 0 and prio <= 3: priority_count[prio] += 1
continue
if state == '':
@ -102,13 +106,20 @@ out.write('''<html><head>
</head><body>
<h1>libtorrent todo-list</h1>
<table width="100%" border="1" style="border-collapse: collapse;">''')
<span style="color: #f77">%d important</span>
<span style="color: #3c3">%d relevant</span>
<span style="color: #77f">%d feasible</span>
<span style="color: #999">%d notes</span>
<table width="100%%" border="1" style="border-collapse: collapse;">''' % \
(priority_count[3], priority_count[2], priority_count[1], priority_count[0]))
prio_colors = [ '#ccc', '#ccf', '#cfc', '#fcc']
index = 0
for i in items:
if not 'context' in i: i['context'] = ''
out.write('<tr><td>relevance&nbsp;%d</td><td><a href="javascript:expand(%d)">%s</a></td><td>%s</td></tr>' \
% (i['priority'], index, i['location'], i['todo'].replace('\n', ' ')))
out.write('<tr style="background: %s"><td>relevance&nbsp;%d</td><td><a href="javascript:expand(%d)">%s</a></td><td>%s</td></tr>' \
% (prio_colors[i['priority']], i['priority'], index, i['location'], i['todo'].replace('\n', ' ')))
out.write('<tr id="%d" style="display: none;" colspan="3"><td colspan="3"><h2>%s</h2><h4>%s</h4><pre style="background: #f6f6f6; border: solid 1px #ddd;">%s</pre></td></tr>' \
% (index, i['todo'], i['location'], i['context']))

View File

@ -97,7 +97,7 @@ namespace libtorrent
// for now, assume one external IPv4 and one external IPv6 address
// 0 = IPv4 1 = IPv6
// TODO: instead, have one instance per possible subnet, global IPv4, global IPv6, loopback, 192.168.x.x, 10.x.x.x, etc.
// TODO: 1 instead, have one instance per possible subnet, global IPv4, global IPv6, loopback, 192.168.x.x, 10.x.x.x, etc.
ip_voter m_vote_group[2];
};

View File

@ -76,7 +76,7 @@ namespace libtorrent { namespace dht
friend void intrusive_ptr_add_ref(dht_tracker const*);
friend void intrusive_ptr_release(dht_tracker const*);
// TODO: take a udp_socket_interface here instead. Move udp_socket_interface down into libtorrent core
// TODO: 3 take a udp_socket_interface here instead. Move udp_socket_interface down into libtorrent core
dht_tracker(libtorrent::aux::session_impl& ses, rate_limited_udp_socket& sock
, dht_settings const& settings, entry const* state = 0);
virtual ~dht_tracker();

View File

@ -445,10 +445,9 @@ namespace libtorrent
// pointing to the first byte of the first sha-1 hash
char const* m_piece_hashes;
// TODO: these strings could be lazy_entry* to save memory
// if a comment is found in the torrent file
// this will be set to that comment
// TODO: 2 these strings (m_comment, m_created_by, m_ssl_root_cert) could be lazy_entry* to save memory
std::string m_comment;
// an optional string naming the software used

View File

@ -192,7 +192,6 @@ namespace libtorrent
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
// TODO: move this debug facility into a base class. It's used in a lot of places
#if defined BOOST_HAS_PTHREADS
mutable pthread_t m_thread;
#endif

View File

@ -347,7 +347,7 @@ public:
std::size_t write_some(Const_Buffers const& buffers, error_code& ec)
{
TORRENT_ASSERT(false && "not implemented!");
// TODO: implement
// TODO: 1 implement blocking write. Low priority since it's not used (yet)
return 0;
}

View File

@ -124,7 +124,7 @@ namespace libtorrent
// this is used for intermediate storage of pieces
// that are received in more than one HTTP response
// TODO: if we make this be a disk_buffer_holder instead
// TODO: 1 if we make this be a disk_buffer_holder instead
// we would save a copy sometimes
// use allocate_disk_receive_buffer and release_disk_receive_buffer
std::vector<char> m_piece;

View File

@ -638,7 +638,9 @@ namespace libtorrent { namespace dht
if (e["y"].string() == "r")
{
// TODO: fix this stats logging
// TODO: 2 fix this stats logging. For instance,
// the stats counters could be factored out into its own
// class, and dht_tracker could take an optional reference to it
// ++m_replies_sent[e["r"]];
// m_replies_bytes_sent[e["r"]] += int(m_send_buf.size());
}

View File

@ -60,7 +60,7 @@ void incoming_error(entry& e, char const* msg);
using detail::write_endpoint;
// TODO: configurable?
// TODO: 2 make this configurable in dht_settings
enum { announce_interval = 30 };
#ifdef TORRENT_DHT_VERBOSE_LOGGING
@ -687,7 +687,7 @@ void node_impl::incoming_request(msg const& m, entry& e)
sha1_hash target(msg_keys[0]->string_ptr());
// TODO: find_node should write directly to the response entry
// TODO: 1 find_node should write directly to the response entry
nodes_t n;
m_table.find_node(target, n, 0);
write_nodes_entry(reply, n);

View File

@ -434,10 +434,10 @@ time_duration rpc_manager::tick()
break;
}
// don't call short_timeout() again if we've
// already called it once
if (o->has_short_timeout()) continue;
// TODO: don't call short_timeout() again if we've
// already called it once
timeouts.push_back(o);
}

View File

@ -5110,7 +5110,7 @@ retry:
// is the torrent already active?
boost::shared_ptr<torrent> torrent_ptr = find_torrent(*ih).lock();
if (!torrent_ptr && !params.uuid.empty()) torrent_ptr = find_torrent(params.uuid).lock();
// TODO: find by url?
// TODO: 2 if we still can't find the torrent, we should probably look for it by url here
if (torrent_ptr)
{
@ -5466,9 +5466,12 @@ retry:
if (mapping == m_tcp_mapping[map_transport] && port != 0)
{
// TODO: report the proper address of the router
if (ip != address()) set_external_address(ip, source_router
, address());
if (ip != address())
{
// TODO: 1 report the proper address of the router as the source IP of
// this understanding of our external address, instead of the empty address
set_external_address(ip, source_router, address());
}
if (!m_listen_sockets.empty()) {
m_listen_sockets.front().external_address = ip;
@ -5670,7 +5673,7 @@ retry:
#if defined TORRENT_ASIO_DEBUGGING
complete_async("session_impl::on_dht_router_name_lookup");
#endif
// TODO: report errors as alerts
// TODO: 1 report errors as alerts
if (e) return;
while (host != tcp::resolver::iterator())
{

View File

@ -1109,7 +1109,7 @@ namespace libtorrent
{
// if we failed to write, stop downloading and just
// keep seeding.
// TODO: make this depend on the error and on the filesystem the
// TODO: 1 make this depend on the error and on the filesystem the
// files are being downloaded to. If the error is no_space_left_on_device
// and the filesystem doesn't support sparse files, only zero the priorities
// of the pieces that are at the tails of all files, leaving everything
@ -1502,7 +1502,7 @@ namespace libtorrent
peer_connection* torrent::find_lowest_ranking_peer() const
{
// TODO: filter out peers that are disconnecting
// TODO: 3 filter out peers that are disconnecting
const_peer_iterator lowest_rank = std::min_element(begin(), end()
, boost::bind(&peer_connection::peer_rank, _1)
< boost::bind(&peer_connection::peer_rank, _2));
@ -2286,9 +2286,6 @@ namespace libtorrent
// SSL torrents use their own listen socket
#ifdef TORRENT_USE_OPENSSL
// TODO: this pattern is repeated in a few places. Factor this into
// a function and generalize the concept of a torrent having a
// dedicated listen port
if (is_ssl_torrent()) req.listen_port = m_ses.ssl_listen_port();
else
#endif
@ -5161,11 +5158,12 @@ namespace libtorrent
}
else
{
// TODO: if this is a merkle torrent and we can't
// TODO: 0 if this is a merkle torrent and we can't
// restore the tree, we need to wipe all the
// bits in the have array, but not necessarily
// we might want to do a full check to see if we have
// all the pieces
// all the pieces. This is low priority since almost
// no one uses merkle torrents
TORRENT_ASSERT(false);
}
}
@ -5348,8 +5346,9 @@ namespace libtorrent
}
// write renamed files
// TODO: make this more generic to not just work if files have been
// renamed, but also if they have been merged into a single file for instance
// TODO: 0 make this more generic to not just work if files have been
// renamed, but also if they have been merged into a single file for instance.
// using file_base
if (&m_torrent_file->files() != &m_torrent_file->orig_files()
&& m_torrent_file->files().num_files() == m_torrent_file->orig_files().num_files())
{
@ -5925,11 +5924,11 @@ namespace libtorrent
if (m_num_connecting > m_max_connections / 10)
{
// find one of the connecting peers and disconnect it
// TODO: ideally, we would disconnect the oldest connection
// i.e. the one that has waited the longest to connect.
// find any peer that's connecting (i.e. a half-open TCP connection)
// that's also not disconnecting
// TODO: 1 ideally, we would disconnect the oldest connection
// i.e. the one that has waited the longest to connect.
std::set<peer_connection*>::iterator i = std::find_if(begin(), end()
, boost::bind(&peer_connection::is_connecting, _1)
&& !boost::bind(&peer_connection::is_disconnecting, _1));
@ -6002,7 +6001,7 @@ namespace libtorrent
// if it's lower rank than the incoming connection
peer_connection* peer = find_lowest_ranking_peer();
// TODO: if peer is a really good peer, maybe we shouldn't disconnect it
// TODO: 3 if peer is a really good peer, maybe we shouldn't disconnect it
if (peer && peer->peer_rank() < p->peer_rank())
{
peer->disconnect(errors::too_many_connections);
@ -6177,8 +6176,9 @@ namespace libtorrent
m_completed_time = time(0);
// disconnect all seeds
// TODO: should disconnect all peers that have the pieces we have
// not just seeds
// TODO: 1 should disconnect all peers that have the pieces we have
// not just seeds. It would be pretty expensive to check all pieces
// for all peers though
std::vector<peer_connection*> seeds;
for (peer_iterator i = m_connections.begin();
i != m_connections.end(); ++i)
@ -8715,7 +8715,7 @@ namespace libtorrent
return ret;
}
// TODO: with some response codes, we should just consider
// TODO: 3 with 110 as response codes, we should just consider
// the tracker as a failure and not retry
// it anymore
void torrent::tracker_request_error(tracker_request const& r

View File

@ -184,7 +184,7 @@ namespace libtorrent
return valid_encoding;
}
// TODO: should this take a char const*?
// TODO: 1 we might save constructing a std::String if this would take a char const* instead
bool valid_path_element(std::string const& element)
{
if (element.empty()
@ -363,7 +363,7 @@ namespace libtorrent
, &file_hash, &fee, &mtime))
return false;
// TODO: this logic should be a separate step
// TODO: 1 this logic should be a separate step
// done once the torrent is loaded, and the original
// filenames should be preserved!
int cnt = 0;
@ -384,7 +384,7 @@ namespace libtorrent
// each entry keep a string for its filename, make it
// simply point into the info-section buffer
internal_file_entry const& fe = *target.rbegin();
// TODO: once the filename renaming is removed from here
// TODO: 1 once the filename renaming is removed from here
// this check can be removed as well
if (fee && fe.filename() == fee->string_value())
{

View File

@ -1843,7 +1843,7 @@ bool utp_socket_impl::send_pkt(int flags)
m_mtu_ceiling = p->size - 1;
if (m_mtu_floor > m_mtu_ceiling) m_mtu_floor = m_mtu_ceiling;
update_mtu_limits();
// TODO: we might want to do something else here
// TODO: 2 we might want to do something else here
// as well, to resend the packet immediately without
// it being an MTU probe
}