On Thu, Jul 7, 2022 at 7:18 PM Peter Xu <[email protected]> wrote: > > On Thu, Jul 07, 2022 at 06:14:17PM -0300, Leonardo Brás wrote: > > Having 'if(queued == sent)' will cause us to falsely return '1' in two buggy > > cases, while 'if queued == 0) will either skip early or go into 'infinite' > > loop. > > I'm not sure I strictly follow here.. >
Sorry, I was thinking of a different scenario. > Imagine the case we do flush() twice without sending anything, then in the > 1st flush we'll see queued>sent, we'll finish flush() until queued==sent. > Then in the 2nd (continuous) flush() we'll see queued==sent immediately. > > IIUC with the current patch we'll return 1 which I think is wrong because > fallback didn't happen, and if with the change to "if (queued==sent) return > 0" it'll fix it? Yes, you are correct. It's a possible scenario to have a flush happen just after another without any sending in between. I will fix it as suggested. Best regards, Leo > > -- > Peter Xu >
