chenBright commented on code in PR #3169: URL: https://github.com/apache/brpc/pull/3169#discussion_r2631277279
########## src/brpc/policy/baidu_rpc_protocol.cpp: ########## @@ -62,36 +66,101 @@ DEFINE_bool(baidu_std_protocol_deliver_timeout_ms, false, DECLARE_bool(pb_enum_as_number); // Notes: -// 1. 12-byte header [PRPC][body_size][meta_size] +// 1. Header format: +// - Normal format (12 bytes): [PRPC][body_size(32bit)][meta_size(32bit)] +// - Extended format (20 bytes): [PRPC][UINT32_MAX][meta_size(32bit)][body_size(64bit)] +// Extended format is used when body_size > UINT32_MAX Review Comment: - Normal format (12 bytes): [PRPC][body_size(32bit)][meta_size(32bit)] - Extended format (16 bytes): [LRPC][body_size(64bit)][meta_size(32bit)] , L represents long The two formats have the same structure, only the magic number and body size differ. This makes them simpler to process. @wwbmmm What do you think of the approach? ########## src/brpc/policy/baidu_rpc_protocol.cpp: ########## @@ -62,36 +66,101 @@ DEFINE_bool(baidu_std_protocol_deliver_timeout_ms, false, DECLARE_bool(pb_enum_as_number); // Notes: -// 1. 12-byte header [PRPC][body_size][meta_size] +// 1. Header format: +// - Normal format (12 bytes): [PRPC][body_size(32bit)][meta_size(32bit)] +// - Extended format (20 bytes): [PRPC][UINT32_MAX][meta_size(32bit)][body_size(64bit)] +// Extended format is used when body_size > UINT32_MAX Review Comment: If body_size equals UINT32_MAX, the client uses the normal format, while the server uses the xtended format. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
