Hi fellow developpers.
I open this thread because I want to make sure I didn’t missed something about StreamBuffers (and message buffers), I will refer to them as SBs.
Lets say I create a SB with a buffer size of 100, and timeout is infinite
Scenario 1 : The SB is empty, I want to write let’s say 90 bytes. Then everything works fine
Scenario 2 : The SB is filled with 50 bytes, I want to write 55 bytes. The sending task blocks, eventually someone receive bytes, and the sender then unblocks, I write my 55 bytes, and they get received later. Everything okay.
Scenario 3 : The SB is empty, I want to write 110 bytes. I want to write 10 bytes more than the whole capacity of the buffer. Then, the task waits indefinitively… Thats because the sending tasks, in SBSend, checks for the space available in the buffer and notifyWaits if ‘xSpace < xRequiredSpace’. There is a bug here… The sending task can query the space available in the SB, yes, but can’t really know the total capacity of the buffer. So if I send more bytes than the total capacity, I brick the thing.
In my opinion, the case where someone wants to send more bytes than feasible has not been taken into account. It should write the chunk of data that it can at the moment and return the number of bytes actually writen, like in the scenario where a finite timeout occurs becore enough space is free.