Re: TCP keepalive support for libpq - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: TCP keepalive support for libpq
Date
Msg-id AANLkTimK2cNU2lJVTFTKZulRGsmzXBXS7QOtFZ-qEFRb@mail.gmail.com
Whole thread Raw
In response to Re: TCP keepalive support for libpq  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: TCP keepalive support for libpq
List pgsql-hackers
On Wed, Jun 23, 2010 at 5:32 AM, Robert Haas <robertmhaas@gmail.com> wrote:
> On Tue, Jun 22, 2010 at 3:45 PM, Robert Haas <robertmhaas@gmail.com> wrote:
>> On Tue, Jun 22, 2010 at 3:28 PM, Robert Haas <robertmhaas@gmail.com> wrote:
>>> Either I'm doing something wrong,
>>
>> I think it's this one.  Stand by.
>
> OK, here's a new version with several fewer bugs.

Since valid values for keepalives parameter are 0 and 1, its field size should
be 1 rather than 10.

diff --git a/src/interfaces/libpq/fe-connect.c
b/src/interfaces/libpq/fe-connect.c
index 8240404..f0085ab 100644
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -184,7 +184,7 @@ static const PQconninfoOption PQconninfoOptions[] = {       "Fallback-Application-Name", "", 64},
       {"keepalives", NULL, NULL, NULL,
-       "TCP-Keepalives", "", 10}, /* strlen(INT32_MAX) == 10 */
+       "TCP-Keepalives", "", 1},
       {"keepalives_idle", NULL, NULL, NULL,       "TCP-Keepalives-Idle", "", 10}, /* strlen(INT32_MAX) == 10 */

In this case, you can check the value of keepalives parameter by seeing
conn->keepalives[0] instead of using strtol() in useKeepalives().

Regards,

--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center


pgsql-hackers by date:

Previous
From: Dann Corbit
Date:
Subject: Re: Implementation of Date/Time Input Interpretation
Next
From: Magnus Hagander
Date:
Subject: Re: Parallel pg_restore versus old dump files