Re: Flushing large data immediately in pqcomm

  • Jump to comment-1
    ranier.vf@gmail.com2024-04-06T21:33:33+00:00
    Hi, On Fri, 5 Apr 2024 at 03:28, Melih Mutlu <m(dot)melihmutlu(at)gmail(dot)com> wrote: >Right. It was a mistake, forgot to remove that. Fixed it in v5. If you don't mind, I have some suggestions for patch v5. 1. Shouldn't PqSendBufferSize be of type size_t? There are several comparisons with other size_t variables. static size_t PqSendBufferSize; /* Size send buffer */ I think this would prevent possible overflows. 2. If PqSendBufferSize is changed to size_t, in the function socket_putmessage_noblock, the variable which name is *required*, should be changed to size_t as well. static void socket_putmessage_noblock(char msgtype, const char *s, size_t len) { int res PG_USED_FOR_ASSERTS_ONLY; size_t required; 3. In the internal_putbytes function, the *amout* variable could have the scope safely reduced. else { size_t amount; amount = PqSendBufferSize - PqSendPointer; 4. In the function internal_flush_buffer, the variables named *bufptr* and *bufend* could be const char * type, like: static int internal_flush_buffer(const char *s, size_t *start, size_t *end) { static int last_reported_send_errno = 0; const char *bufptr = s + *start; const char *bufend = s + *end; best regards, Ranier Vilela