This forum has been archived. All content is frozen. Please use KDE Discuss instead.

chunkselector.cpp -> Rarest first

Tags: None
(comma "," separated)
imported4-Anonymous
Registered Member
Posts
329
Karma
0

chunkselector.cpp -> Rarest first

Mon Nov 14, 2005 3:36 pm
Last night when I had sleeping problem I made some changes in chunkselector.cpp to get KTorrent to select chunks in a better way, selecting rarest chunks first .

Today I have KTorrent running, with better selection, and some better speed - more peers are connecting to me.

I will send my changes when I found why the KTorrent now start with allocating the whole file when starting up - freezing the application for 30-40 sec. (And clean upp code + add some comments).

Pär H
imported4-Anonymous
Registered Member
Posts
329
Karma
0

Tue Nov 15, 2005 12:00 pm
KT at the start creates an empty file and only expands it when needed, so that shouldn't happen.
George
Moderator
Posts
5421
Karma
1

Tue Nov 15, 2005 12:03 pm
That was my post.
George
Moderator
Posts
5421
Karma
1

Tue Nov 15, 2005 12:05 pm
If your rarest chunk first algorithm selects a chunk at the end of the file, you will have huge writes to disk, which could cause this behavior. To counter this we have a slowly increasing limit, that way the disk writes stay small.
imported4-Anonymous
Registered Member
Posts
329
Karma
0

Tue Nov 15, 2005 6:32 pm
I have located the reason.

The torrent i tested had 2 files
1 ISO-file of 3GB, and 1 AVI-file of 20KB. The AVI-file got priority (ChunkSelector::findPriorityChunk), and when the AVI-file was located at the end of the torrent the large file got allocated.

Another torrent i tested started allocating at the end because one peer had only a few (0,02%) chunks, and those where near the end.
---------------
Regarding chunkselector .cpp / .h, Can I mail the files?
George
Moderator
Posts
5421
Karma
1

Tue Nov 15, 2005 7:40 pm
Sure send them.

Maybe we need to switch to a temp file, basicly if the chunk is within the limit, write to the final file, if not write to tmpfile. And if the limit moves up see if we can write some chunks from tmpfile to final. But that could cause problems with the preview of multimedia files ...


Bookmarks



Who is online

Registered users: bancha, Bing [Bot], Google [Bot], Sogou [Bot]