mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-10-01 02:11:15 +02:00
Make the Windows tcp keepalive support depend on the existance of the
SIO_KEEPALIVE_VALS define instead of just WIN32, since MingW doesn't support this API (yet?).
This commit is contained in:
parent
672efc0865
commit
a64bf0afb7
@ -30,7 +30,7 @@
|
|||||||
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/backend/libpq/pqcomm.c,v 1.211 2010/07/08 10:20:12 mha Exp $
|
* $PostgreSQL: pgsql/src/backend/libpq/pqcomm.c,v 1.212 2010/07/08 16:19:50 mha Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -83,7 +83,7 @@
|
|||||||
#ifdef HAVE_UTIME_H
|
#ifdef HAVE_UTIME_H
|
||||||
#include <utime.h>
|
#include <utime.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef WIN32
|
#ifdef WIN32_ONLY_COMPILER /* mstcpip.h is missing on mingw */
|
||||||
#include <mstcpip.h>
|
#include <mstcpip.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1323,7 +1323,7 @@ pq_endcopyout(bool errorAbort)
|
|||||||
* actually set them to zero, not default), therefor we fallback to
|
* actually set them to zero, not default), therefor we fallback to
|
||||||
* the out-of-the-box default instead.
|
* the out-of-the-box default instead.
|
||||||
*/
|
*/
|
||||||
#ifdef WIN32
|
#if defined(WIN32) && defined(SIO_KEEPALIVE_VALS)
|
||||||
static int
|
static int
|
||||||
pq_setkeepaliveswin32(Port *port, int idle, int interval)
|
pq_setkeepaliveswin32(Port *port, int idle, int interval)
|
||||||
{
|
{
|
||||||
@ -1412,7 +1412,7 @@ pq_setkeepalivesidle(int idle, Port *port)
|
|||||||
if (port == NULL || IS_AF_UNIX(port->laddr.addr.ss_family))
|
if (port == NULL || IS_AF_UNIX(port->laddr.addr.ss_family))
|
||||||
return STATUS_OK;
|
return STATUS_OK;
|
||||||
|
|
||||||
#if defined(TCP_KEEPIDLE) || defined(TCP_KEEPALIVE) || defined(WIN32)
|
#if defined(TCP_KEEPIDLE) || defined(TCP_KEEPALIVE) || defined(SIO_KEEPALIVE_VALS)
|
||||||
if (idle == port->keepalives_idle)
|
if (idle == port->keepalives_idle)
|
||||||
return STATUS_OK;
|
return STATUS_OK;
|
||||||
|
|
||||||
@ -1451,7 +1451,7 @@ pq_setkeepalivesidle(int idle, Port *port)
|
|||||||
#else /* WIN32 */
|
#else /* WIN32 */
|
||||||
return pq_setkeepaliveswin32(port, idle, port->keepalives_interval);
|
return pq_setkeepaliveswin32(port, idle, port->keepalives_interval);
|
||||||
#endif
|
#endif
|
||||||
#else /* TCP_KEEPIDLE || WIN32 */
|
#else /* TCP_KEEPIDLE || SIO_KEEPALIVE_VALS */
|
||||||
if (idle != 0)
|
if (idle != 0)
|
||||||
{
|
{
|
||||||
elog(LOG, "setting the keepalive idle time is not supported");
|
elog(LOG, "setting the keepalive idle time is not supported");
|
||||||
@ -1464,7 +1464,7 @@ pq_setkeepalivesidle(int idle, Port *port)
|
|||||||
int
|
int
|
||||||
pq_getkeepalivesinterval(Port *port)
|
pq_getkeepalivesinterval(Port *port)
|
||||||
{
|
{
|
||||||
#if defined(TCP_KEEPINTVL) || defined(WIN32)
|
#if defined(TCP_KEEPINTVL) || defined(SIO_KEEPALIVE_VALS)
|
||||||
if (port == NULL || IS_AF_UNIX(port->laddr.addr.ss_family))
|
if (port == NULL || IS_AF_UNIX(port->laddr.addr.ss_family))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -1501,7 +1501,7 @@ pq_setkeepalivesinterval(int interval, Port *port)
|
|||||||
if (port == NULL || IS_AF_UNIX(port->laddr.addr.ss_family))
|
if (port == NULL || IS_AF_UNIX(port->laddr.addr.ss_family))
|
||||||
return STATUS_OK;
|
return STATUS_OK;
|
||||||
|
|
||||||
#if defined(TCP_KEEPINTVL) || defined (WIN32)
|
#if defined(TCP_KEEPINTVL) || defined (SIO_KEEPALIVE_VALS)
|
||||||
if (interval == port->keepalives_interval)
|
if (interval == port->keepalives_interval)
|
||||||
return STATUS_OK;
|
return STATUS_OK;
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.397 2010/07/08 10:20:12 mha Exp $
|
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.398 2010/07/08 16:19:50 mha Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -38,7 +38,9 @@
|
|||||||
#endif
|
#endif
|
||||||
#define near
|
#define near
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
|
#ifdef WIN32_ONLY_COMPILER /* mstcpip.h is missing on mingw */
|
||||||
#include <mstcpip.h>
|
#include <mstcpip.h>
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
@ -1093,6 +1095,7 @@ setKeepalivesCount(PGconn *conn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#else /* Win32 */
|
#else /* Win32 */
|
||||||
|
#ifdef SIO_KEEPALIVE_VALS
|
||||||
/*
|
/*
|
||||||
* Enable keepalives and set the keepalive values on Win32,
|
* Enable keepalives and set the keepalive values on Win32,
|
||||||
* where they are always set in one batch.
|
* where they are always set in one batch.
|
||||||
@ -1137,6 +1140,7 @@ setKeepalivesWin32(PGconn *conn)
|
|||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
#endif /* SIO_KEEPALIVE_VALS */
|
||||||
#endif /* WIN32 */
|
#endif /* WIN32 */
|
||||||
|
|
||||||
/* ----------
|
/* ----------
|
||||||
@ -1555,8 +1559,10 @@ keep_going: /* We will come back to here until there is
|
|||||||
|| !setKeepalivesCount(conn))
|
|| !setKeepalivesCount(conn))
|
||||||
err = 1;
|
err = 1;
|
||||||
#else /* WIN32 */
|
#else /* WIN32 */
|
||||||
|
#ifdef SIO_KEEPALIVE_VALS
|
||||||
else if (!setKeepalivesWin32(conn))
|
else if (!setKeepalivesWin32(conn))
|
||||||
err = 1;
|
err = 1;
|
||||||
|
#endif /* SIO_KEEPALIVE_VALS */
|
||||||
#endif /* WIN32 */
|
#endif /* WIN32 */
|
||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
|
Loading…
Reference in New Issue
Block a user