Continue on with your break
August 2, 2007 Leave a comment
A really nifty feature in DC++ is the ability to change the priority of files in the download queue, with the keyboard. It’s quite simple, you just press ‘+’ or ‘-‘ on the numeric keyboard. When you select multiple files, all of them change priority.
At one point, however, selecting multiple files and changing the priority on them, didn’t really change the priority for some files. This appeared (at first) to happen randomly, but after a couple of minutes, the reason became more clear.
When you selected several files, that had different priorities, and pressed ‘+’ or ‘-‘ until one of the files reached “Highest” or “Paused”, the other files completely seized to update. You could try pressing 4, or 400, times more, but nothing would happen.
The buggy code was similar to what I’ve written below.
1. loop until the entire list of files have been looked at
2. if the selected file is in “highest” or “paused” mode, break to 4 and continue on
3. otherwise, change the priority and jump back to 1 and continue on
4. “do some other stuff that isn’t related to this…”
If you notice, the above “code” show exactly what the bug report said. The solution was quite simple, too; “change the 4 to a 1”.
Now you know what you’ve always (secretly) wanted to know about that priority bug.
(The reason “break” and “continue” is used here, is because the actual fix was to literally replace the code “break” with “continue”.)