Pass through buffer

Hi, I'm wondering if someone can help me with the pass through buffer (basic_passthrubuf) that is part of more_io.
In the code I'm working on (gzostreambuf which writes to an ostream) I need to know is overflow() is being called because there is no more room in the buffer I'm using or because of an explicit flush. In the later case I need to also flush the compression (Z_SYNC_FLUSH), but doing so all the time will degrade the compression performance plus increase the number of flushes to the underlying stream. This is particularly bad as the underlying stream in my case is a socket stream an the increased flushes breaks up the data into many small packets. Because of the software at the other end of the socket, data must be sent as one message unless it's over 8096 bytes. So basically I only want to flush the underlying stream if the gzostreambuf has been flushed (either by endl or flush). is this possible? My current workaround is to make sure the buffersize of my gzostreambuf is greater than or equal to the buffersize of the underlying stream, but I was hoping there was a neater solution and thats why I was looking at the pass through buffer.
Cheers, Tom Howard
participants (1)
-
Tom Howard