Skip to content

Commit b5ed3ba

Browse files
committed
golang版 grpc源码浅析
1 parent ade136a commit b5ed3ba

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

protobuf/golang版 grpc源码浅析.md

+13-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,19 @@ func (p *parser) recvMsg(maxReceiveMessageSize int) (pf payloadFormat, msg []byt
145145
}
146146
```
147147

148-
注意,接收单个数据包最大长度为maxReceiveMessageSize (clientconn.go) ,默认是 4194304(4M)。
148+
注意,接收单个数据包最大长度为maxReceiveMessageSize,默认是 4194304(4M)。
149+
150+
clientconn.go
151+
152+
```go
153+
const (
154+
defaultClientMaxReceiveMessageSize = 1024 * 1024 * 4
155+
defaultClientMaxSendMessageSize = math.MaxInt32
156+
// http2IOBufSize specifies the buffer size for sending frames.
157+
defaultWriteBufSize = 32 * 1024
158+
defaultReadBufSize = 32 * 1024
159+
)
160+
```
149161

150162
首先读取消息头部(5字节)。然后解析出压缩标志和消息包长度(不含消息头部大小)。最后根据消息长度读取消息内容。
151163

0 commit comments

Comments
 (0)