It seems likely that any SSL implementation will need a similar call, not
just OpenSSL.
return -1;
}
-#ifdef USE_OPENSSL
+#ifdef USE_SSL
/* Check for SSL library buffering read bytes */
- if (forRead && conn->ssl && SSL_pending(conn->ssl) > 0)
+ if (forRead && conn->ssl_in_use && pgtls_read_pending(conn) > 0)
{
/* short-circuit the select */
return 1;
return open_client_SSL(conn);
}
+/*
+ * Is there unread data waiting in the SSL read buffer?
+ */
+bool
+pgtls_read_pending(PGconn *conn)
+{
+ return SSL_pending(conn->ssl);
+}
+
/*
* Read data from a secure connection.
*
extern PostgresPollingStatusType pgtls_open_client(PGconn *conn);
extern void pgtls_close(PGconn *conn);
extern ssize_t pgtls_read(PGconn *conn, void *ptr, size_t len);
+extern bool pgtls_read_pending(PGconn *conn);
extern ssize_t pgtls_write(PGconn *conn, const void *ptr, size_t len);
/*