diff options
author | Nathan Bossart <nathan@postgresql.org> | 2023-08-22 19:16:12 -0700 |
---|---|---|
committer | Nathan Bossart <nathan@postgresql.org> | 2023-08-22 19:16:12 -0700 |
commit | f4b54e1ed9853ab9aff524494866823f951b1e7f (patch) | |
tree | d828a0aceba5a1e74372170b58c97bae56eeefa3 /src/backend/replication | |
parent | 711479115836b2180f50c00bbf0773220848a7f5 (diff) |
Introduce macros for protocol characters.
This commit introduces descriptively-named macros for the
identifiers used in wire protocol messages. These new macros are
placed in a new header file so that they can be easily used by
third-party code.
Author: Dave Cramer
Reviewed-by: Alvaro Herrera, Tatsuo Ishii, Peter Smith, Robert Haas, Tom Lane, Peter Eisentraut, Michael Paquier
Discussion: https://postgr.es/m/CADK3HHKbBmK-PKf1bPNFoMC%2BoBt%2BpD9PH8h5nvmBQskEHm-Ehw%40mail.gmail.com
Diffstat (limited to 'src/backend/replication')
-rw-r--r-- | src/backend/replication/walsender.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c index d27ef2985d7..80374c55be5 100644 --- a/src/backend/replication/walsender.c +++ b/src/backend/replication/walsender.c @@ -603,7 +603,7 @@ SendTimeLineHistory(TimeLineHistoryCmd *cmd) dest->rStartup(dest, CMD_SELECT, tupdesc); /* Send a DataRow message */ - pq_beginmessage(&buf, 'D'); + pq_beginmessage(&buf, PqMsg_DataRow); pq_sendint16(&buf, 2); /* # of columns */ len = strlen(histfname); pq_sendint32(&buf, len); /* col1 len */ @@ -801,7 +801,7 @@ StartReplication(StartReplicationCmd *cmd) WalSndSetState(WALSNDSTATE_CATCHUP); /* Send a CopyBothResponse message, and start streaming */ - pq_beginmessage(&buf, 'W'); + pq_beginmessage(&buf, PqMsg_CopyBothResponse); pq_sendbyte(&buf, 0); pq_sendint16(&buf, 0); pq_endmessage(&buf); @@ -1294,7 +1294,7 @@ StartLogicalReplication(StartReplicationCmd *cmd) WalSndSetState(WALSNDSTATE_CATCHUP); /* Send a CopyBothResponse message, and start streaming */ - pq_beginmessage(&buf, 'W'); + pq_beginmessage(&buf, PqMsg_CopyBothResponse); pq_sendbyte(&buf, 0); pq_sendint16(&buf, 0); pq_endmessage(&buf); @@ -1923,11 +1923,11 @@ ProcessRepliesIfAny(void) /* Validate message type and set packet size limit */ switch (firstchar) { - case 'd': + case PqMsg_CopyData: maxmsglen = PQ_LARGE_MESSAGE_LIMIT; break; - case 'c': - case 'X': + case PqMsg_CopyDone: + case PqMsg_Terminate: maxmsglen = PQ_SMALL_MESSAGE_LIMIT; break; default: @@ -1955,7 +1955,7 @@ ProcessRepliesIfAny(void) /* * 'd' means a standby reply wrapped in a CopyData packet. */ - case 'd': + case PqMsg_CopyData: ProcessStandbyMessage(); received = true; break; @@ -1964,7 +1964,7 @@ ProcessRepliesIfAny(void) * CopyDone means the standby requested to finish streaming. * Reply with CopyDone, if we had not sent that already. */ - case 'c': + case PqMsg_CopyDone: if (!streamingDoneSending) { pq_putmessage_noblock('c', NULL, 0); @@ -1978,7 +1978,7 @@ ProcessRepliesIfAny(void) /* * 'X' means that the standby is closing down the socket. */ - case 'X': + case PqMsg_Terminate: proc_exit(0); default: |