Re: libpq compression
| От | Alvaro Herrera |
|---|---|
| Тема | Re: libpq compression |
| Дата | |
| Msg-id | 20201028195810.GA6732@alvherre.pgsql обсуждение исходный текст |
| Ответ на | Re: libpq compression (Konstantin Knizhnik <k.knizhnik@postgrespro.ru>) |
| Ответы |
Re: libpq compression
|
| Список | pgsql-hackers |
On 2020-Oct-26, Konstantin Knizhnik wrote:
> + while (bufptr < bufend || zpq_buffered(PqStream) != 0) /* has more data to flush or unsent data in internal
compressionbuffer */
> {
> - int r;
> -
> - r = secure_write(MyProcPort, bufptr, bufend - bufptr);
> -
> - if (r <= 0)
> + int r;
> + size_t processed = 0;
> + size_t available = bufend - bufptr;
> + r = PqStream
> + ? zpq_write(PqStream, bufptr, available, &processed)
> + : secure_write(MyProcPort, bufptr, available);
> + bufptr += processed;
> + PqSendStart += processed;
This bit is surprising to me. I thought the whole zpq_write() thing
should be hidden inside secure_write, so internal_flush would continue
to call just secure_write; and it is that routine's responsibility to
call zpq_write or be_tls_write or secure_raw_write etc according to
compile-time options and socket state.
В списке pgsql-hackers по дате отправления: