Skip to content

Commit c2dc194

Browse files
committed
Adjust signature of walrcv_receive hook.
Commit 314cbfc 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.
1 parent 994f112 commit c2dc194

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/backend/replication/README

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ bool walrcv_connect(char *conninfo, XLogRecPtr startpoint)
1616
Establish connection to the primary, and starts streaming from 'startpoint'.
1717
Returns true on success.
1818

19-
int walrcv_receive(char **buffer, int *wait_fd)
19+
int walrcv_receive(char **buffer, pgsocket *wait_fd)
2020

2121
Retrieve any message available without blocking through the
2222
connection. If a message was successfully read, returns its
2323
length. If the connection is closed, returns -1. Otherwise returns 0
24-
to indicate that no data is available, and sets *wait_fd to a file
24+
to indicate that no data is available, and sets *wait_fd to a socket
2525
descriptor which can be waited on before trying again. On success, a
2626
pointer to the message payload is stored in *buffer. The returned
2727
buffer is valid until the next call to walrcv_* functions, and the

src/backend/replication/libpqwalreceiver/libpqwalreceiver.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ static void libpqrcv_readtimelinehistoryfile(TimeLineID tli, char **filename, ch
5252
static bool libpqrcv_startstreaming(TimeLineID tli, XLogRecPtr startpoint,
5353
char *slotname);
5454
static void libpqrcv_endstreaming(TimeLineID *next_tli);
55-
static int libpqrcv_receive(char **buffer, int *wait_fd);
55+
static int libpqrcv_receive(char **buffer, pgsocket *wait_fd);
5656
static void libpqrcv_send(const char *buffer, int nbytes);
5757
static void libpqrcv_disconnect(void);
5858

@@ -472,14 +472,14 @@ libpqrcv_disconnect(void)
472472
* until the next libpqrcv_* call.
473473
*
474474
* If no data was available immediately, returns 0, and *wait_fd is set to a
475-
* file descriptor which can be waited on before trying again.
475+
* socket descriptor which can be waited on before trying again.
476476
*
477477
* -1 if the server ended the COPY.
478478
*
479479
* ereports on error.
480480
*/
481481
static int
482-
libpqrcv_receive(char **buffer, int *wait_fd)
482+
libpqrcv_receive(char **buffer, pgsocket *wait_fd)
483483
{
484484
int rawlen;
485485

src/backend/replication/walreceiver.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ WalReceiverMain(void)
379379
char *buf;
380380
int len;
381381
bool endofwal = false;
382-
int wait_fd = PGINVALID_SOCKET;
382+
pgsocket wait_fd = PGINVALID_SOCKET;
383383
int rc;
384384

385385
/*

src/include/replication/walreceiver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ extern PGDLLIMPORT walrcv_startstreaming_type walrcv_startstreaming;
145145
typedef void (*walrcv_endstreaming_type) (TimeLineID *next_tli);
146146
extern PGDLLIMPORT walrcv_endstreaming_type walrcv_endstreaming;
147147

148-
typedef int (*walrcv_receive_type) (char **buffer, int *wait_fd);
148+
typedef int (*walrcv_receive_type) (char **buffer, pgsocket *wait_fd);
149149
extern PGDLLIMPORT walrcv_receive_type walrcv_receive;
150150

151151
typedef void (*walrcv_send_type) (const char *buffer, int nbytes);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy