Hi, I believe I have found a bug in the code that selects a random chunk for download when using partial file sharing. It seems that the last chunk just before the offset is not copied into the cloned list of chunks because of an off-by-one error.
The problem surfaced when I had a file with a first chunk done, a large second chunk empty and a third large chunk done all the way to the end. In this case often the chosen offset is in the second chunk, so the cloned list starts with the third chunk. The first chunk is then also appended, but the second (and only empty) chunk is not appended. The download then stops indicating that it is waiting for a free chunk. Hans
Index: fileinfo.c =================================================================== RCS file: /cvsroot/gtk-gnutella/gtk-gnutella-current/src/fileinfo.c,v retrieving revision 1.105 diff -u -r1.105 fileinfo.c --- fileinfo.c 4 Dec 2003 17:36:56 -0000 1.105 +++ fileinfo.c 23 Dec 2003 15:41:09 -0000 @@ -3040,7 +3040,7 @@ for (l = fi->chunklist; l; l = g_slist_next(l)) { fc = l->data; - if (fc->to >= offset) + if (fc->to > offset) break; /* We've reached the cloning point */ g_assert(fc->from < offset); clone = gm_slist_insert_after(clone, tail, fc);