On Mar 19 2008, Matthew Toseland wrote: > Actually, I'm not sure we're finished here. What we really want to do, to > minimise the chance of a timeout, is to alternate between the active > transfers. With the code you implemented, if a block is in store, all of > its packet transmits will be queued at the same time and therefore all > other transfers to the same peer will wait until they have all been sent, > which given bandwidth limiting could be a long time. > >Suggestions?
I think you and I discussed this problem WRT the new transport layer. One possibility is to have an array of queues for each peer - the first queue is for small messages and each block transfer gets a separate queue. You keep a round-robin pointer into the array, and each time you build a packet you start with the queue pointed to by the round-robin, then consider the other queues. After building the packet you increment the round-robin. (If you want to give small messages priority over transfers then don't include their queue in the array and always check it before checking the array.) Cheers, Michael