TCP keepalive support for libpq

Tollef Fog Heen <tollef.fog.heen@collabora.co.uk>

From: Tollef Fog Heen <tollef.fog.heen@collabora.co.uk>
To: pgsql-hackers@postgresql.org
Date: 2010-02-09T13:03:28Z
Lists: pgsql-hackers

Attachments

(please Cc me on replies, I am not subscribed)

Hi,

libpq currently does not use TCP keepalives.  This is a problem in our
case where we have some clients waiting for notifies and then the
connection is dropped on the server side.  The client never gets the FIN
and thinks the connection is up.  The attached patch unconditionally
adds keepalives.  I chose unconditionally as this is what the server
does.  We didn't need the ability to tune the timeouts, but that could
be added with reasonable ease.

-- 
Tollef Fog Heen 
UNIX is user friendly, it's just picky about who its friends are