aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2016-04-14 13:49:37 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2016-04-14 13:49:37 -0400
commitc2dc194bdbf5f84ceb433ed416eb389c1234ebc9 (patch)
treef57a9efda68fc1872e536031d8be061570c91543 /src
parent994f11257328e272a6a43d3de59ffa916cbfbe96 (diff)
downloadpostgresql-c2dc194bdbf5f84ceb433ed416eb389c1234ebc9.tar.gz
postgresql-c2dc194bdbf5f84ceb433ed416eb389c1234ebc9.zip
Adjust signature of walrcv_receive hook.
Commit 314cbfc5da988eff redefined the signature of this hook as typedef int (*walrcv_receive_type) (char **buffer, int *wait_fd); But in fact the type of the "wait_fd" variable ought to be pgsocket, which is what WaitLatchOrSocket expects, and which is necessary if we want to be able to assign PGINVALID_SOCKET to it on Windows. So fix that.
Diffstat (limited to 'src')
-rw-r--r--src/backend/replication/README4
-rw-r--r--src/backend/replication/libpqwalreceiver/libpqwalreceiver.c6
-rw-r--r--src/backend/replication/walreceiver.c2
-rw-r--r--src/include/replication/walreceiver.h2
4 files changed, 7 insertions, 7 deletions
diff --git a/src/backend/replication/README b/src/backend/replication/README
index 419a2d74d73..ad4864dbbeb 100644
--- a/src/backend/replication/README
+++ b/src/backend/replication/README
@@ -16,12 +16,12 @@ bool walrcv_connect(char *conninfo, XLogRecPtr startpoint)
Establish connection to the primary, and starts streaming from 'startpoint'.
Returns true on success.
-int walrcv_receive(char **buffer, int *wait_fd)
+int walrcv_receive(char **buffer, pgsocket *wait_fd)
Retrieve any message available without blocking through the
connection. If a message was successfully read, returns its
length. If the connection is closed, returns -1. Otherwise returns 0
-to indicate that no data is available, and sets *wait_fd to a file
+to indicate that no data is available, and sets *wait_fd to a socket
descriptor which can be waited on before trying again. On success, a
pointer to the message payload is stored in *buffer. The returned
buffer is valid until the next call to walrcv_* functions, and the
diff --git a/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c b/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
index a3bec498fa0..b61e39d7d8a 100644
--- a/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
+++ b/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
@@ -52,7 +52,7 @@ static void libpqrcv_readtimelinehistoryfile(TimeLineID tli, char **filename, ch
static bool libpqrcv_startstreaming(TimeLineID tli, XLogRecPtr startpoint,
char *slotname);
static void libpqrcv_endstreaming(TimeLineID *next_tli);
-static int libpqrcv_receive(char **buffer, int *wait_fd);
+static int libpqrcv_receive(char **buffer, pgsocket *wait_fd);
static void libpqrcv_send(const char *buffer, int nbytes);
static void libpqrcv_disconnect(void);
@@ -472,14 +472,14 @@ libpqrcv_disconnect(void)
* until the next libpqrcv_* call.
*
* If no data was available immediately, returns 0, and *wait_fd is set to a
- * file descriptor which can be waited on before trying again.
+ * socket descriptor which can be waited on before trying again.
*
* -1 if the server ended the COPY.
*
* ereports on error.
*/
static int
-libpqrcv_receive(char **buffer, int *wait_fd)
+libpqrcv_receive(char **buffer, pgsocket *wait_fd)
{
int rawlen;
diff --git a/src/backend/replication/walreceiver.c b/src/backend/replication/walreceiver.c
index 057c250793d..6fd5952be71 100644
--- a/src/backend/replication/walreceiver.c
+++ b/src/backend/replication/walreceiver.c
@@ -379,7 +379,7 @@ WalReceiverMain(void)
char *buf;
int len;
bool endofwal = false;
- int wait_fd = PGINVALID_SOCKET;
+ pgsocket wait_fd = PGINVALID_SOCKET;
int rc;
/*
diff --git a/src/include/replication/walreceiver.h b/src/include/replication/walreceiver.h
index 36bcb471720..c87e7a80ad1 100644
--- a/src/include/replication/walreceiver.h
+++ b/src/include/replication/walreceiver.h
@@ -145,7 +145,7 @@ extern PGDLLIMPORT walrcv_startstreaming_type walrcv_startstreaming;
typedef void (*walrcv_endstreaming_type) (TimeLineID *next_tli);
extern PGDLLIMPORT walrcv_endstreaming_type walrcv_endstreaming;
-typedef int (*walrcv_receive_type) (char **buffer, int *wait_fd);
+typedef int (*walrcv_receive_type) (char **buffer, pgsocket *wait_fd);
extern PGDLLIMPORT walrcv_receive_type walrcv_receive;
typedef void (*walrcv_send_type) (const char *buffer, int nbytes);