@@ -1731,23 +1731,13 @@ pq_getkeepalivesidle(Port *port)
1731
1731
#ifndef WIN32
1732
1732
ACCEPT_TYPE_ARG3 size = sizeof (port -> default_keepalives_idle );
1733
1733
1734
- #ifdef TCP_KEEPIDLE
1735
- if (pg_getsockopt (port -> sock ,IPPROTO_TCP ,TCP_KEEPIDLE ,
1736
- (char * )& port -> default_keepalives_idle ,
1737
- & size ,port -> isRsocket )< 0 )
1738
- {
1739
- elog (LOG ,"getsockopt(TCP_KEEPIDLE) failed: %m" );
1740
- port -> default_keepalives_idle = -1 ;/* don't know */
1741
- }
1742
- #else
1743
- if (pg_getsockopt (port -> sock ,IPPROTO_TCP ,TCP_KEEPALIVE ,
1734
+ if (pg_getsockopt (port -> sock ,IPPROTO_TCP ,PG_TCP_KEEPALIVE_IDLE ,
1744
1735
(char * )& port -> default_keepalives_idle ,
1745
1736
& size ,port -> isRsocket )< 0 )
1746
1737
{
1747
1738
elog (LOG ,"getsockopt(%s) failed: %m" ,PG_TCP_KEEPALIVE_IDLE_STR );
1748
1739
port -> default_keepalives_idle = -1 ;/* don't know */
1749
1740
}
1750
- #endif
1751
1741
#else /* WIN32 */
1752
1742
/* We can't get the defaults on Windows, so return "don't know" */
1753
1743
port -> default_keepalives_idle = -1 ;
@@ -1786,21 +1776,12 @@ pq_setkeepalivesidle(int idle, Port *port)
1786
1776
if (idle == 0 )
1787
1777
idle = port -> default_keepalives_idle ;
1788
1778
1789
- #ifdef TCP_KEEPIDLE
1790
- if (pg_setsockopt (port -> sock ,IPPROTO_TCP ,TCP_KEEPIDLE ,
1779
+ if (pg_setsockopt (port -> sock ,IPPROTO_TCP ,PG_TCP_KEEPALIVE_IDLE ,
1791
1780
(char * )& idle ,sizeof (idle ),port -> isRsocket )< 0 )
1792
1781
{
1793
1782
elog (LOG ,"setsockopt(%s) failed: %m" ,PG_TCP_KEEPALIVE_IDLE_STR );
1794
1783
return STATUS_ERROR ;
1795
1784
}
1796
- #else
1797
- if (pg_setsockopt (port -> sock ,IPPROTO_TCP ,TCP_KEEPALIVE ,
1798
- (char * )& idle ,sizeof (idle ),port -> isRsocket )< 0 )
1799
- {
1800
- elog (LOG ,"setsockopt(TCP_KEEPALIVE) failed: %m" );
1801
- return STATUS_ERROR ;
1802
- }
1803
- #endif
1804
1785
1805
1786
port -> keepalives_idle = idle ;
1806
1787
#else /* WIN32 */