Implement multi-parts read from Unix PIPE. (#370)
* Implement multi-parts read from Unix PIPE. A Unix PIPE is typically 64kB large and we might have JSON messages that won't fit in that. The size of the buffer filled by the read() call used to be fixed at 128MB, but that doesn't have an impact on how much data we can receive in a single read() call actually. Fix that properly and allocate the size of the PIPE buffer thanks to a call to fnctl(fd, FIONREAD) which seems to be well supported. Then use the libpq string buffer facility to build the messages in memory when receiving them a piece at a time from the Unix PIPE buffer, in multiple read() calls. * Ensure our read_from_stream buffer terminates properly. C-string must be terminated by '\0' and the read() call is not ensuring that.
parent
2949803e
Please register or sign in to comment