mirror of
https://github.com/sogou/workflow.git
synced 2026-02-08 01:33:17 +08:00
ENCODE_IOV_MAX 8192 -> 2048 (#1430)
* ENCODE_IOV_MAX 8192 -> 2048 * Update tutorial-10-user_defined_protocol.md * Update tutorial-10-user_defined_protocol.md
This commit is contained in:
@@ -44,7 +44,7 @@ private:
|
||||
### Serialization function: encode
|
||||
|
||||
* The encode function is called before the message is sent, and it is called only once for each message.
|
||||
* In the encode function, you need to serialize the message into a vector array, and the number of array elements must not exceed max. Current the value of max is 8192.
|
||||
* In the encode function, you need to serialize the message into a vector array, and the number of array elements must not exceed max. Current the value of max is 2048.
|
||||
* For the definition of **struct iovec**, please see the system calls **readv** or **writev**.
|
||||
* Normally the return value of the encode function is between 0 and max, indicating how many vector are used in the message.
|
||||
* In case of UDP protocol, please note that the total length must not be more than 64k, and no more than 1024 vectors are used (in Linux, writev writes only 1024 vectors at one time).
|
||||
|
||||
@@ -41,7 +41,7 @@ private:
|
||||
~~~
|
||||
### 序列化函数encode
|
||||
* encode函数在消息被发送之前调用,每条消息只调用一次。
|
||||
* encode函数里,用户需要将消息序列化到一个vector数组,数组元素个数不超过max。目前max的值为8192。
|
||||
* encode函数里,用户需要将消息序列化到一个vector数组,数组元素个数不超过max。目前max的值为2048。
|
||||
* 结构体struct iovec定义在请参考系统调用readv和writev。
|
||||
* encode函数正确情况下的返回值在0到max之间,表示消息使用了多少个vector。
|
||||
* 如果是UDP协议,请注意总长度不超过64k,并且使用不超过1024个vector(Linux一次writev只能1024个vector)。
|
||||
|
||||
Reference in New Issue
Block a user