More todo items.
[quix0rs-apt-p2p.git] / TODO
1 Evaluate and fix some errors in the ktable khashmir module.
2
3 The KTable implementation has some possible errors in it. insertNode
4 does not remove the original and use the new node when updating a node
5 already in the table, as claimed by the comments. justSeenNode doesn't
6 verify that the found node is the node that was being looked for, nor
7 does it move the node to the end of the list of nodes (since they are
8 supposed to be sorted by their lastSeen time) or update the bucket's
9 last touched time.nodeFailed also doesn't verify the found node is the
10 right node.
11
12
13 Consider what happens when we are the closest node.
14
15 In some of the actions it is unclear what happens when we are one of the
16 closest nodes to the target key. Do we store values that we publish
17 ourself?
18
19
20 Add all cache files to the database.
21
22 All files in the cache should be added to the database, so that they can
23 be checked to make sure nothing has happened to them. The database would
24 then need a flag to indicate files that are hashed and available, but
25 that shouldn't be added to the DHT.
26
27
28 Packages.diff files need to be considered.
29
30 The Packages.diff/Index files contain hashes of Packages.diff/rred.gz 
31 files, which themselves contain diffs to the Packages files previously 
32 downloaded. Apt will request these files for the testing/unstable 
33 distributions. They need to either be ignored, or dealt with properly by 
34 adding them to the tracking done by the AptPackages module.
35
36
37 PeerManager needs to download large files from multiple peers.
38
39 The PeerManager currently chooses a peer at random from the list of 
40 possible peers, and downloads the entire file from there. This needs to 
41 change if both a) the file is large (more than 512 KB), and b) there are
42 multiple peers with the file. The PeerManager should then break up the 
43 large file into multiple pieces of size < 512 KB, and then send requests 
44 to multiple peers for these pieces.
45
46 This can cause a problem with hash checking the returned data, as hashes 
47 for the pieces are not known. Any file that fails a hash check should be 
48 downloaded again, with each piece being downloaded from different peers 
49 than it was previously. The peers are shifted by 1, so that if a peers 
50 previously downloaded piece i, it now downloads piece i+1, and the first 
51 piece is downloaded by the previous downloader of the last piece, or 
52 preferably a previously unused peer. As each piece is downloaded the 
53 running hash of the file should be checked to determine the place at 
54 which the file differs from the previous download.
55
56 If the hash check then passes, then the peer who originally provided the 
57 bad piece can be assessed blame for the error. Otherwise, the peer who 
58 originally provided the piece is probably at fault, since he is now 
59 providing a later piece. This doesn't work if the differing piece is the 
60 first piece, in which case it is downloaded from a 3rd peer, with 
61 consensus revealing the misbehaving peer.
62
63
64 Consider adding peer characteristics to the DHT.
65
66 Bad peers could be indicated in the DHT by adding a new value that is
67 the NOT of their ID (so they are guaranteed not to store it) indicating
68 information about the peer. This could be bad votes on the peer, as
69 otherwise a peer could add good info about itself.
70
71
72 Consider adding pieces to the DHT instead of files.
73
74 Instead of adding file hashes to the DHT, only piece hashes could be
75 added. This would allow a peer to upload to other peers while it is
76 still downloading the rest of the file. It is not clear that this is
77 needed, since peer's will not be uploading and downloading ery much of
78 the time.