diff options
Diffstat (limited to 'src/backend/replication/walsender.c')
-rw-r--r-- | src/backend/replication/walsender.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c index 451e6bc6666..1f8a52c6dd5 100644 --- a/src/backend/replication/walsender.c +++ b/src/backend/replication/walsender.c @@ -164,8 +164,16 @@ WalSndHandshake(void) int firstchar; /* Wait for a command to arrive */ + pq_startmsgread(); firstchar = pq_getbyte(); + /* Read the message contents */ + if (firstchar != EOF) + { + if (pq_getmessage(&input_message, 0)) + firstchar = EOF; /* suitable message already logged */ + } + /* * Emergency bailout if postmaster has died. This is to avoid the * necessity for manual cleanup of all postmaster children. @@ -183,16 +191,6 @@ WalSndHandshake(void) ProcessConfigFile(PGC_SIGHUP); } - if (firstchar != EOF) - { - /* - * Read the message contents. This is expected to be done without - * blocking because we've been able to get message type code. - */ - if (pq_getmessage(&input_message, 0)) - firstchar = EOF; /* suitable message already logged */ - } - /* Handle the very limited subset of commands expected in this phase */ switch (firstchar) { @@ -331,6 +329,7 @@ CheckClosedConnection(void) unsigned char firstchar; int r; + pq_startmsgread(); r = pq_getbyte_if_available(&firstchar); if (r < 0) { @@ -343,6 +342,7 @@ CheckClosedConnection(void) if (r == 0) { /* no data available without blocking */ + pq_endmsgread(); return; } |