Re: PQconsumeinput() may close the fd

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: PQconsumeinput() may close the fd
Дата
Msg-id 3198034.1666363228@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: PQconsumeinput() may close the fd  (Laurenz Albe <laurenz.albe@cybertec.at>)
Список pgsql-general
Laurenz Albe <laurenz.albe@cybertec.at> writes:
> On Fri, 2022-10-21 at 07:27 +0300, Vasily Kulikov wrote:
>> The problem is that sometimes PQconsumeInput() may close the connection

> The function does nothing of the kind.

No, he's right: if we detect EOF then we'll close the socket.
However, not doing so wouldn't be an improvement.  I believe the
socket would still be read-ready so you'd have an infinite loop.

What I'd suggest doing is checking for PQstatus(conn) == CONNECTION_BAD,
or else directly rechecking PQsocket() each time, rather than assuming
the socket is still there.

            regards, tom lane



В списке pgsql-general по дате отправления:

Предыдущее
От: Laurenz Albe
Дата:
Сообщение: Re: PQconsumeinput() may close the fd
Следующее
От: Dionisis Kontominas
Дата:
Сообщение: Asking for existence of a GUI frame work similar to Oracle APEX for PostgreSQL