Tim is working on a new flow control, where it is done at Connection level, which seems a nice idea to have it in a generic place.
I know this is still under work, but I realized one thing...
ATM the credit is returned based on batchSize, but the Semaphore uses bytes.
This will be a problem with sending big Messages, as each packet could have 100K in some cases. I will run out of credits in 10 messages but the credit will only come back in 1000.
So, we need to change the confirmation of packets to be based on the sizes instead of batchSize (numberOfMessages sent).
Yes, that's what I meant when I said yesterday that it wasn't finished. :)