mirror of
https://github.com/postgres/postgres.git
synced 2025-04-29 13:56:47 +03:00
Remove WIN32_NON_BLOCKING_CONNECTIONS tests, since we don't need 'em
anymore.
This commit is contained in:
parent
c4c194f100
commit
6d0d838ceb
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
$Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.63 2001/05/12 22:51:35 petere Exp $
|
$Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.64 2001/07/31 02:14:49 tgl Exp $
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<chapter id="libpq">
|
<chapter id="libpq">
|
||||||
@ -386,12 +386,6 @@ PostgresPollingStatusType PQconnectPoll(PGconn *conn)
|
|||||||
PQconnectPoll will currently block if libpq is compiled with USE_SSL
|
PQconnectPoll will currently block if libpq is compiled with USE_SSL
|
||||||
defined. This restriction may be removed in the future.
|
defined. This restriction may be removed in the future.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
|
||||||
PQconnectPoll will currently block under Windows, unless libpq is compiled
|
|
||||||
with WIN32_NON_BLOCKING_CONNECTIONS defined. This code has not yet been
|
|
||||||
tested under Windows, and so it is currently off by default. This may be
|
|
||||||
changed in the future.
|
|
||||||
</para>
|
|
||||||
<para>
|
<para>
|
||||||
These functions leave the socket in a non-blocking state as if
|
These functions leave the socket in a non-blocking state as if
|
||||||
<function>PQsetnonblocking</function> had been called.
|
<function>PQsetnonblocking</function> had been called.
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.170 2001/07/21 04:32:41 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.171 2001/07/31 02:14:49 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -70,7 +70,7 @@ static SSL_CTX *SSL_context = NULL;
|
|||||||
|
|
||||||
#define NOTIFYLIST_INITIAL_SIZE 10
|
#define NOTIFYLIST_INITIAL_SIZE 10
|
||||||
#define NOTIFYLIST_GROWBY 10
|
#define NOTIFYLIST_GROWBY 10
|
||||||
#define WIN32_NON_BLOCKING_CONNECTIONS
|
|
||||||
|
|
||||||
/* ----------
|
/* ----------
|
||||||
* Definition of the conninfo parameters and their fallback resources.
|
* Definition of the conninfo parameters and their fallback resources.
|
||||||
@ -906,17 +906,7 @@ connectDBStart(PGconn *conn)
|
|||||||
goto connect_errReturn;
|
goto connect_errReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
#if !defined(USE_SSL)
|
||||||
* Since I have no idea whether this is a valid thing to do under
|
|
||||||
* Windows before a connection is made, and since I have no way of
|
|
||||||
* testing it, I leave the code looking as below. When someone
|
|
||||||
* decides that they want non-blocking connections under Windows, they
|
|
||||||
* can define WIN32_NON_BLOCKING_CONNECTIONS before compilation. If
|
|
||||||
* it works, then this code can be cleaned up.
|
|
||||||
*
|
|
||||||
* Ewan Mellor <eem21@cam.ac.uk>.
|
|
||||||
*/
|
|
||||||
#if ((!defined(WIN32) && !defined(__CYGWIN__)) || defined(WIN32_NON_BLOCKING_CONNECTIONS)) && !defined(USE_SSL)
|
|
||||||
if (connectMakeNonblocking(conn) == 0)
|
if (connectMakeNonblocking(conn) == 0)
|
||||||
goto connect_errReturn;
|
goto connect_errReturn;
|
||||||
#endif
|
#endif
|
||||||
@ -926,23 +916,14 @@ connectDBStart(PGconn *conn)
|
|||||||
* now, but it is possible that:
|
* now, but it is possible that:
|
||||||
* 1. Older systems will still block on connect, despite the
|
* 1. Older systems will still block on connect, despite the
|
||||||
* non-blocking flag. (Anyone know if this is true?)
|
* non-blocking flag. (Anyone know if this is true?)
|
||||||
* 2. We are running under Windows, and aren't even trying
|
* 2. We are using SSL.
|
||||||
* to be non-blocking (see above).
|
* Thus, we have to make arrangements for all eventualities.
|
||||||
* 3. We are using SSL.
|
|
||||||
* Thus, we have make arrangements for all eventualities.
|
|
||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
#ifndef WIN32
|
|
||||||
if (connect(conn->sock, &conn->raddr.sa, conn->raddr_len) < 0)
|
if (connect(conn->sock, &conn->raddr.sa, conn->raddr_len) < 0)
|
||||||
{
|
{
|
||||||
if (errno == EINPROGRESS || errno == 0)
|
if (errno == EINPROGRESS || errno == EWOULDBLOCK || errno == 0)
|
||||||
#else
|
|
||||||
if (connect(conn->sock, &conn->raddr.sa, conn->raddr_len) != 0)
|
|
||||||
{
|
|
||||||
if (errno == EINPROGRESS || errno == EWOULDBLOCK)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is fine - we're in non-blocking mode, and the
|
* This is fine - we're in non-blocking mode, and the
|
||||||
* connection is in progress.
|
* connection is in progress.
|
||||||
@ -1040,7 +1021,7 @@ connectDBStart(PGconn *conn)
|
|||||||
* This makes the connection non-blocking, for all those cases which
|
* This makes the connection non-blocking, for all those cases which
|
||||||
* forced us not to do it above.
|
* forced us not to do it above.
|
||||||
*/
|
*/
|
||||||
#if ((defined(WIN32) || defined(__CYGWIN__)) && !defined(WIN32_NON_BLOCKING_CONNECTIONS)) || defined(USE_SSL)
|
#if defined(USE_SSL)
|
||||||
if (connectMakeNonblocking(conn) == 0)
|
if (connectMakeNonblocking(conn) == 0)
|
||||||
goto connect_errReturn;
|
goto connect_errReturn;
|
||||||
#endif
|
#endif
|
||||||
@ -1949,11 +1930,13 @@ freePGconn(PGconn *conn)
|
|||||||
SSL_free(conn->ssl);
|
SSL_free(conn->ssl);
|
||||||
#endif
|
#endif
|
||||||
if (conn->sock >= 0)
|
if (conn->sock >= 0)
|
||||||
|
{
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
closesocket(conn->sock);
|
closesocket(conn->sock);
|
||||||
#else
|
#else
|
||||||
close(conn->sock);
|
close(conn->sock);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
if (conn->pghost)
|
if (conn->pghost)
|
||||||
free(conn->pghost);
|
free(conn->pghost);
|
||||||
if (conn->pghostaddr)
|
if (conn->pghostaddr)
|
||||||
@ -2019,11 +2002,13 @@ closePGconn(PGconn *conn)
|
|||||||
* Close the connection, reset all transient state, flush I/O buffers.
|
* Close the connection, reset all transient state, flush I/O buffers.
|
||||||
*/
|
*/
|
||||||
if (conn->sock >= 0)
|
if (conn->sock >= 0)
|
||||||
|
{
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
closesocket(conn->sock);
|
closesocket(conn->sock);
|
||||||
#else
|
#else
|
||||||
close(conn->sock);
|
close(conn->sock);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
conn->sock = -1;
|
conn->sock = -1;
|
||||||
conn->status = CONNECTION_BAD; /* Well, not really _bad_ - just
|
conn->status = CONNECTION_BAD; /* Well, not really _bad_ - just
|
||||||
* absent */
|
* absent */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user