NeverENG commented on code in PR #21:
URL: https://github.com/apache/dubbo-net/pull/21#discussion_r4463615989
##########
DubboService/Native/NativeDubboCodec.cs:
##########
@@ -101,11 +100,14 @@ internal static byte[] EncodeGenericRequest(
internal static byte[] EncodeHeartbeat(long requestId)
{
byte[] frame = new byte[HeaderLength + 1];
- frame[0] = 0xda;
- frame[1] = 0xbb;
- frame[2] = RequestFlag | TwoWayFlag | EventFlag |
Hessian2SerializationId;
- BinaryPrimitives.WriteInt64BigEndian(frame.AsSpan(4, 8),
requestId);
- BinaryPrimitives.WriteInt32BigEndian(frame.AsSpan(12, 4), 1);
+ frame[Frame.MagicHighByteOffset] = Frame.MagicHighByte;
+ frame[Frame.MagicLowByteOffset] = Frame.MagicLowByte;
+ frame[Frame.FlagsOffset] = Frame.RequestFlag | Frame.TwoWayFlag
Review Comment:
已在 `3c50207` 将 offset 3 改名 `StatusOrReservedOffset`
并注明请求保留/响应状态双重语义;三个编码器现在都显式写出该字节。`87dc64d` 先用独立字面量锁定请求保留位。新 head 的 CI 待批准。
##########
DubboService/Native/NativeDubboCodec.cs:
##########
@@ -35,21 +37,16 @@ namespace DubboNet.DubboService.Native
/// </summary>
internal static class NativeDubboCodec
{
- internal const int HeaderLength = 16;
+ internal const int HeaderLength = Frame.HeaderLength;
Review Comment:
采纳删除方案:`3c50207` 移除了无跨文件生产调用方的 `NativeDubboCodec.HeaderLength` 别名,调用方统一用
`Frame.HeaderLength`。同时 `87dc64d` 把测试响应帧中的序列化 ID/状态改成独立字节,避免生产常量和测试一同漂移。
--
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]