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

Commit6d0d838

Browse files
committed
Remove WIN32_NON_BLOCKING_CONNECTIONS tests, since we don't need 'em
anymore.
1 parentc4c194f commit6d0d838

File tree

2 files changed

+12
-33
lines changed

2 files changed

+12
-33
lines changed

‎doc/src/sgml/libpq.sgml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.63 2001/05/12 22:51:35 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.64 2001/07/31 02:14:49 tgl Exp $
33
-->
44

55
<chapter id="libpq">
@@ -386,12 +386,6 @@ PostgresPollingStatusType PQconnectPoll(PGconn *conn)
386386
PQconnectPoll will currently block if libpq is compiled with USE_SSL
387387
defined. This restriction may be removed in the future.
388388
</para>
389-
<para>
390-
PQconnectPoll will currently block under Windows, unless libpq is compiled
391-
with WIN32_NON_BLOCKING_CONNECTIONS defined. This code has not yet been
392-
tested under Windows, and so it is currently off by default. This may be
393-
changed in the future.
394-
</para>
395389
<para>
396390
These functions leave the socket in a non-blocking state as if
397391
<function>PQsetnonblocking</function> had been called.

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

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.170 2001/07/21 04:32:41 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.171 2001/07/31 02:14:49 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -70,7 +70,7 @@ static SSL_CTX *SSL_context = NULL;
7070

7171
#defineNOTIFYLIST_INITIAL_SIZE 10
7272
#defineNOTIFYLIST_GROWBY 10
73-
#defineWIN32_NON_BLOCKING_CONNECTIONS
73+
7474

7575
/* ----------
7676
* Definition of the conninfo parameters and their fallback resources.
@@ -906,17 +906,7 @@ connectDBStart(PGconn *conn)
906906
gotoconnect_errReturn;
907907
}
908908

909-
/*
910-
* Since I have no idea whether this is a valid thing to do under
911-
* Windows before a connection is made, and since I have no way of
912-
* testing it, I leave the code looking as below. When someone
913-
* decides that they want non-blocking connections under Windows, they
914-
* can define WIN32_NON_BLOCKING_CONNECTIONS before compilation. If
915-
* it works, then this code can be cleaned up.
916-
*
917-
* Ewan Mellor <eem21@cam.ac.uk>.
918-
*/
919-
#if ((!defined(WIN32)&& !defined(__CYGWIN__))|| defined(WIN32_NON_BLOCKING_CONNECTIONS))&& !defined(USE_SSL)
909+
#if !defined(USE_SSL)
920910
if (connectMakeNonblocking(conn)==0)
921911
gotoconnect_errReturn;
922912
#endif
@@ -926,23 +916,14 @@ connectDBStart(PGconn *conn)
926916
* now, but it is possible that:
927917
* 1. Older systems will still block on connect, despite the
928918
*non-blocking flag. (Anyone know if this is true?)
929-
* 2. We are running under Windows, and aren't even trying
930-
*to be non-blocking (see above).
931-
* 3. We are using SSL.
932-
* Thus, we have make arrangements for all eventualities.
919+
* 2. We are using SSL.
920+
* Thus, we have to make arrangements for all eventualities.
933921
* ----------
934922
*/
935-
#ifndefWIN32
936923
if (connect(conn->sock,&conn->raddr.sa,conn->raddr_len)<0)
937924
{
938-
if (errno==EINPROGRESS||errno==0)
939-
#else
940-
if (connect(conn->sock,&conn->raddr.sa,conn->raddr_len)!=0)
941-
{
942-
if (errno==EINPROGRESS||errno==EWOULDBLOCK)
943-
#endif
925+
if (errno==EINPROGRESS||errno==EWOULDBLOCK||errno==0)
944926
{
945-
946927
/*
947928
* This is fine - we're in non-blocking mode, and the
948929
* connection is in progress.
@@ -1040,7 +1021,7 @@ connectDBStart(PGconn *conn)
10401021
* This makes the connection non-blocking, for all those cases which
10411022
* forced us not to do it above.
10421023
*/
1043-
#if((defined(WIN32)|| defined(__CYGWIN__))&& !defined(WIN32_NON_BLOCKING_CONNECTIONS))||defined(USE_SSL)
1024+
#if defined(USE_SSL)
10441025
if (connectMakeNonblocking(conn)==0)
10451026
gotoconnect_errReturn;
10461027
#endif
@@ -1949,11 +1930,13 @@ freePGconn(PGconn *conn)
19491930
SSL_free(conn->ssl);
19501931
#endif
19511932
if (conn->sock >=0)
1933+
{
19521934
#ifdefWIN32
19531935
closesocket(conn->sock);
19541936
#else
19551937
close(conn->sock);
19561938
#endif
1939+
}
19571940
if (conn->pghost)
19581941
free(conn->pghost);
19591942
if (conn->pghostaddr)
@@ -2019,11 +2002,13 @@ closePGconn(PGconn *conn)
20192002
* Close the connection, reset all transient state, flush I/O buffers.
20202003
*/
20212004
if (conn->sock >=0)
2005+
{
20222006
#ifdefWIN32
20232007
closesocket(conn->sock);
20242008
#else
20252009
close(conn->sock);
20262010
#endif
2011+
}
20272012
conn->sock=-1;
20282013
conn->status=CONNECTION_BAD;/* Well, not really _bad_ - just
20292014
* absent */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp