I did not try that and here is why:
I think the transport, socket, and accelerated module have a degree of separation in which each handle specific task associated with themselves. For example TFramedTransport->flush(), does a write followed by flush and it formats its stream according to framed specification of size+buffer not knowing what was in its buffer. You are proposing to have a check in the flush() function which eliminates writing of empty sized buffers. I am not 100% sure if there is no use case in which writing of empty buffer is required, so I did not do it. But since the non accelerated module worked perfectly fine, it clearly says there is something not right with the other execution path. And there will be an extra if check for every flush which does not make sense when flush() after flush() is the problem. Thus, I stick with this patch unless it is causing some issue or I missed something I did not understand.
Feel free to take a lead on this if you have a better solution.