mirror of
https://github.com/postgres/postgres.git
synced 2025-12-31 00:03:29 -05:00
Remove MsgType type
Presumably, the C type MsgType was meant to hold the protocol message type in the pre-version-3 era, but this was never fully developed even then, and the name is pretty confusing nowadays. It has only one vestigial use for cancel requests that we can get rid of. Since a cancel request is indicated by a special protocol version number, we can use the ProtocolVersion type, which MsgType was based on. Reviewed-by: Chao Li <li.evan.chao@gmail.com> Discussion: https://www.postgresql.org/message-id/flat/505e76cb-0ca2-4e22-ba0f-772b5dc3f230%40eisentraut.org
This commit is contained in:
parent
ec0da9b893
commit
b63443718a
@ -114,7 +114,6 @@ is_unixsock_path(const char *path)
|
||||
|
||||
|
||||
typedef uint32 ProtocolVersion; /* FE/BE protocol version number */
|
||||
typedef ProtocolVersion MsgType;
|
||||
|
||||
|
||||
/*
|
||||
@ -146,7 +145,7 @@ typedef uint32 AuthRequest; /* an AUTH_REQ_* code */
|
||||
typedef struct CancelRequestPacket
|
||||
{
|
||||
/* Note that each field is stored in network byte order! */
|
||||
MsgType cancelRequestCode; /* code to identify a cancel request */
|
||||
ProtocolVersion cancelRequestCode; /* code to identify a cancel request */
|
||||
uint32 backendPID; /* PID of client's backend */
|
||||
uint8 cancelAuthCode[FLEXIBLE_ARRAY_MEMBER]; /* secret key to
|
||||
* authorize cancel */
|
||||
|
||||
@ -448,7 +448,7 @@ PQgetCancel(PGconn *conn)
|
||||
}
|
||||
|
||||
req = (CancelRequestPacket *) &cancel->cancel_req;
|
||||
req->cancelRequestCode = (MsgType) pg_hton32(CANCEL_REQUEST_CODE);
|
||||
req->cancelRequestCode = pg_hton32(CANCEL_REQUEST_CODE);
|
||||
req->backendPID = pg_hton32(conn->be_pid);
|
||||
memcpy(req->cancelAuthCode, conn->be_cancel_key, conn->be_cancel_key_len);
|
||||
/* include the length field itself in the length */
|
||||
@ -479,7 +479,7 @@ PQsendCancelRequest(PGconn *cancelConn)
|
||||
|
||||
/* Send the message body. */
|
||||
memset(&req, 0, offsetof(CancelRequestPacket, cancelAuthCode));
|
||||
req.cancelRequestCode = (MsgType) pg_hton32(CANCEL_REQUEST_CODE);
|
||||
req.cancelRequestCode = pg_hton32(CANCEL_REQUEST_CODE);
|
||||
req.backendPID = pg_hton32(cancelConn->be_pid);
|
||||
if (pqPutnchar(&req, offsetof(CancelRequestPacket, cancelAuthCode), cancelConn))
|
||||
return STATUS_ERROR;
|
||||
|
||||
@ -1733,7 +1733,6 @@ ModifyTablePath
|
||||
ModifyTableState
|
||||
MonotonicFunction
|
||||
MorphOpaque
|
||||
MsgType
|
||||
MultiAssignRef
|
||||
MultiSortSupport
|
||||
MultiSortSupportData
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user