Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita64bf0a

Browse files
committed
Make the Windows tcp keepalive support depend on the existance of the
SIO_KEEPALIVE_VALS define instead of just WIN32, since MingW doesn'tsupport this API (yet?).
1 parent672efc0 commita64bf0a

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

‎src/backend/libpq/pqcomm.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
3131
* Portions Copyright (c) 1994, Regents of the University of California
3232
*
33-
*$PostgreSQL: pgsql/src/backend/libpq/pqcomm.c,v 1.211 2010/07/0810:20:12 mha Exp $
33+
*$PostgreSQL: pgsql/src/backend/libpq/pqcomm.c,v 1.212 2010/07/0816:19:50 mha Exp $
3434
*
3535
*-------------------------------------------------------------------------
3636
*/
@@ -83,7 +83,7 @@
8383
#ifdefHAVE_UTIME_H
8484
#include<utime.h>
8585
#endif
86-
#ifdefWIN32
86+
#ifdefWIN32_ONLY_COMPILER/* mstcpip.h is missing on mingw */
8787
#include<mstcpip.h>
8888
#endif
8989

@@ -1323,7 +1323,7 @@ pq_endcopyout(bool errorAbort)
13231323
* actually set them to zero, not default), therefor we fallback to
13241324
* the out-of-the-box default instead.
13251325
*/
1326-
#ifdefWIN32
1326+
#if defined(WIN32)&& defined(SIO_KEEPALIVE_VALS)
13271327
staticint
13281328
pq_setkeepaliveswin32(Port*port,intidle,intinterval)
13291329
{
@@ -1412,7 +1412,7 @@ pq_setkeepalivesidle(int idle, Port *port)
14121412
if (port==NULL||IS_AF_UNIX(port->laddr.addr.ss_family))
14131413
returnSTATUS_OK;
14141414

1415-
#if defined(TCP_KEEPIDLE)|| defined(TCP_KEEPALIVE)|| defined(WIN32)
1415+
#if defined(TCP_KEEPIDLE)|| defined(TCP_KEEPALIVE)|| defined(SIO_KEEPALIVE_VALS)
14161416
if (idle==port->keepalives_idle)
14171417
returnSTATUS_OK;
14181418

@@ -1451,7 +1451,7 @@ pq_setkeepalivesidle(int idle, Port *port)
14511451
#else/* WIN32 */
14521452
returnpq_setkeepaliveswin32(port,idle,port->keepalives_interval);
14531453
#endif
1454-
#else/* TCP_KEEPIDLE ||WIN32 */
1454+
#else/* TCP_KEEPIDLE ||SIO_KEEPALIVE_VALS */
14551455
if (idle!=0)
14561456
{
14571457
elog(LOG,"setting the keepalive idle time is not supported");
@@ -1464,7 +1464,7 @@ pq_setkeepalivesidle(int idle, Port *port)
14641464
int
14651465
pq_getkeepalivesinterval(Port*port)
14661466
{
1467-
#if defined(TCP_KEEPINTVL)|| defined(WIN32)
1467+
#if defined(TCP_KEEPINTVL)|| defined(SIO_KEEPALIVE_VALS)
14681468
if (port==NULL||IS_AF_UNIX(port->laddr.addr.ss_family))
14691469
return0;
14701470

@@ -1501,7 +1501,7 @@ pq_setkeepalivesinterval(int interval, Port *port)
15011501
if (port==NULL||IS_AF_UNIX(port->laddr.addr.ss_family))
15021502
returnSTATUS_OK;
15031503

1504-
#if defined(TCP_KEEPINTVL)|| defined (WIN32)
1504+
#if defined(TCP_KEEPINTVL)|| defined (SIO_KEEPALIVE_VALS)
15051505
if (interval==port->keepalives_interval)
15061506
returnSTATUS_OK;
15071507

‎src/interfaces/libpq/fe-connect.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.397 2010/07/0810:20:12 mha Exp $
11+
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.398 2010/07/0816:19:50 mha Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -38,7 +38,9 @@
3838
#endif
3939
#definenear
4040
#include<shlobj.h>
41+
#ifdefWIN32_ONLY_COMPILER/* mstcpip.h is missing on mingw */
4142
#include<mstcpip.h>
43+
#endif
4244
#else
4345
#include<sys/socket.h>
4446
#include<netdb.h>
@@ -1093,6 +1095,7 @@ setKeepalivesCount(PGconn *conn)
10931095
}
10941096

10951097
#else/* Win32 */
1098+
#ifdefSIO_KEEPALIVE_VALS
10961099
/*
10971100
* Enable keepalives and set the keepalive values on Win32,
10981101
* where they are always set in one batch.
@@ -1137,6 +1140,7 @@ setKeepalivesWin32(PGconn *conn)
11371140
}
11381141
return1;
11391142
}
1143+
#endif/* SIO_KEEPALIVE_VALS */
11401144
#endif/* WIN32 */
11411145

11421146
/* ----------
@@ -1555,8 +1559,10 @@ PQconnectPoll(PGconn *conn)
15551559
|| !setKeepalivesCount(conn))
15561560
err=1;
15571561
#else/* WIN32 */
1562+
#ifdefSIO_KEEPALIVE_VALS
15581563
elseif (!setKeepalivesWin32(conn))
15591564
err=1;
1565+
#endif/* SIO_KEEPALIVE_VALS */
15601566
#endif/* WIN32 */
15611567

15621568
if (err)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp