diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/libpq/libpq-be.h | 20 | ||||
-rw-r--r-- | src/include/libpq/libpq.h | 7 |
2 files changed, 17 insertions, 10 deletions
diff --git a/src/include/libpq/libpq-be.h b/src/include/libpq/libpq-be.h index 59c2a1d874f..4dce7677510 100644 --- a/src/include/libpq/libpq-be.h +++ b/src/include/libpq/libpq-be.h @@ -110,12 +110,9 @@ typedef struct ClientConnectionInfo } ClientConnectionInfo; /* - * This is used by the postmaster in its communication with frontends. It - * contains all state information needed during this communication before the - * backend is run. The Port structure is kept in malloc'd memory and is - * still available when a backend is running (see MyProcPort). The data - * it points to must also be malloc'd, or else palloc'd in TopMemoryContext, - * so that it survives into PostgresMain execution! + * The Port structure holds state information about a client connection in a + * backend process. It is available in the global variable MyProcPort. The + * struct and all the data it points are kept in TopMemoryContext. * * remote_hostname is set if we did a successful reverse lookup of the * client's IP address during connection setup. @@ -217,6 +214,17 @@ typedef struct Port #endif } Port; +/* + * ClientSocket holds a socket for an accepted connection, along with the + * information about the remote endpoint. This is passed from postmaster to + * the backend process. + */ +typedef struct ClientSocket +{ + pgsocket sock; /* File descriptor */ + SockAddr raddr; /* remote addr (client) */ +} ClientSocket; + #ifdef USE_SSL /* * Hardcoded DH parameters, used in ephemeral DH keying. (See also diff --git a/src/include/libpq/libpq.h b/src/include/libpq/libpq.h index 6171a0d17a5..be054b59dd1 100644 --- a/src/include/libpq/libpq.h +++ b/src/include/libpq/libpq.h @@ -64,14 +64,13 @@ extern PGDLLIMPORT WaitEventSet *FeBeWaitSet; #define FeBeWaitSetLatchPos 1 #define FeBeWaitSetNEvents 3 -extern int StreamServerPort(int family, const char *hostName, +extern int ListenServerPort(int family, const char *hostName, unsigned short portNumber, const char *unixSocketDir, pgsocket ListenSocket[], int *NumListenSockets, int MaxListen); -extern int StreamConnection(pgsocket server_fd, Port *port); -extern void StreamClose(pgsocket sock); +extern int AcceptConnection(pgsocket server_fd, ClientSocket *client_sock); extern void TouchSocketFiles(void); extern void RemoveSocketFiles(void); -extern void pq_init(void); +extern Port *pq_init(ClientSocket *client_sock); extern int pq_getbytes(char *s, size_t len); extern void pq_startmsgread(void); extern void pq_endmsgread(void); |