Commit 2af360ed authored by Tom Lane's avatar Tom Lane

Clean up some problems in new asynchronous-connection logic

in libpq --- mostly, poor response to error conditions.  You now actually
get to see the postmaster's 'The Data Base System is starting up' message,
which you didn't before.  I suspect the SSL code is still broken though.
parent 0e6d72db
...@@ -323,23 +323,12 @@ PostgresPollingStatusType *PQconnectPoll(PQconn *conn) ...@@ -323,23 +323,12 @@ PostgresPollingStatusType *PQconnectPoll(PQconn *conn)
</listitem> </listitem>
<listitem> <listitem>
<para> <para>
CONNECTION_AWAITING_RESPONSE: Waiting for a response from the backend. CONNECTION_AWAITING_RESPONSE: Waiting for a response from the postmaster.
</para> </para>
</listitem> </listitem>
<listitem> <listitem>
<para> <para>
CONNECTION_AUTH_RESPONSE: Got an authentication response; about to deal CONNECTION_AUTH_OK: Received authentication; waiting for backend startup.
with it.
</para>
</listitem>
<listitem>
<para>
CONNECTION_ERROR_RESPONSE: Got an error response; about to deal with it.
</para>
</listitem>
<listitem>
<para>
CONNECTION_AUTH_OK: Received authentication; waiting for ReadyForQuery etc.
</para> </para>
</listitem> </listitem>
<listitem> <listitem>
...@@ -373,7 +362,7 @@ PostgresPollingStatusType *PQconnectPoll(PQconn *conn) ...@@ -373,7 +362,7 @@ PostgresPollingStatusType *PQconnectPoll(PQconn *conn)
</para> </para>
<para> <para>
Note that if PQconnectStart returns a non-NULL pointer, you must call Note that if PQconnectStart returns a non-NULL pointer, you must call
PQfinish upon that, when you are finished with it, in order to dispose of PQfinish when you are finished with it, in order to dispose of
the structure and any associated memory blocks. This must be done even if a the structure and any associated memory blocks. This must be done even if a
call to PQconnectStart or PQconnectPoll failed. call to PQconnectStart or PQconnectPoll failed.
</para> </para>
......
This diff is collapsed.
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: libpq-fe.h,v 1.53 1999/11/30 03:08:19 momjian Exp $ * $Id: libpq-fe.h,v 1.54 2000/01/14 05:33:15 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -41,16 +41,9 @@ extern "C" ...@@ -41,16 +41,9 @@ extern "C"
CONNECTION_STARTED, /* Waiting for connection to be made. */ CONNECTION_STARTED, /* Waiting for connection to be made. */
CONNECTION_MADE, /* Connection OK; waiting to send. */ CONNECTION_MADE, /* Connection OK; waiting to send. */
CONNECTION_AWAITING_RESPONSE, /* Waiting for a response CONNECTION_AWAITING_RESPONSE, /* Waiting for a response
from the backend. */ from the postmaster. */
CONNECTION_AUTH_RESPONSE, /* Got an authentication
response; about to deal
with it. */
CONNECTION_ERROR_RESPONSE, /* Got an error
response; about to deal
with it. */
CONNECTION_AUTH_OK, /* Received authentication; CONNECTION_AUTH_OK, /* Received authentication;
waiting for ReadyForQuery waiting for backend startup. */
etc. */
CONNECTION_SETENV /* Negotiating environment. */ CONNECTION_SETENV /* Negotiating environment. */
} ConnStatusType; } ConnStatusType;
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: libpq-int.h,v 1.14 1999/11/30 03:08:19 momjian Exp $ * $Id: libpq-int.h,v 1.15 2000/01/14 05:33:15 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -27,10 +27,9 @@ ...@@ -27,10 +27,9 @@
/* include stuff found in fe only */ /* include stuff found in fe only */
#include "pqexpbuffer.h" #include "pqexpbuffer.h"
#ifdef USE_SSL #ifdef USE_SSL
#include "openssl/ssl.h" #include <openssl/ssl.h>
#include "openssl/err.h" #include <openssl/err.h>
#endif #endif
/* libpq supports this version of the frontend/backend protocol. /* libpq supports this version of the frontend/backend protocol.
...@@ -63,7 +62,7 @@ ...@@ -63,7 +62,7 @@
/* Subsidiary-storage management structure for PGresult. /* Subsidiary-storage management structure for PGresult.
* See space management routines in fe-exec.c for details. * See space management routines in fe-exec.c for details.
* Note that space[k] refers to the k'th byte starting from the physical * Note that space[k] refers to the k'th byte starting from the physical
* head of the block. * head of the block --- it's a union, not a struct!
*/ */
typedef union pgresult_data PGresult_data; typedef union pgresult_data PGresult_data;
...@@ -228,7 +227,8 @@ struct pg_conn ...@@ -228,7 +227,8 @@ struct pg_conn
PGsetenvHandle setenv_handle; PGsetenvHandle setenv_handle;
#ifdef USE_SSL #ifdef USE_SSL
SSL *ssl; bool allow_ssl_try; /* Allowed to try SSL negotiation */
SSL *ssl; /* SSL status, if have SSL connection */
#endif #endif
/* Buffer for current error message */ /* Buffer for current error message */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment