soulbird commented on issue #114:
URL:
https://github.com/apache/apisix-go-plugin-runner/issues/114#issuecomment-1319690984
> ```
> func (r *Request) askExtraInfo(builder *flatbuffers.Builder,
> infoType ei.Info, info flatbuffers.UOffsetT) ([]byte, error) {
> ......
> ty := header[0]
> header[0] = 0
> length := binary.BigEndian.Uint32(header)
>
> log.Infof("receive rpc type: %d data length: %d", ty, length)
>
> buf := make([]byte, length)
> n, err = c.Read(buf)
> if util.ReadErr(n, err, int(length)) {
> return nil, common.ErrConnClosed
> }
> ....
> }
> ```
>
> 这里从conn读取数据的时候有可能没有读取完全,需要循环读取
>
> ```
> var tmp int
> for n < length {
> tmp, err = c.Read(buf[n:])
> if err != nil {
> break
> }
> n += tmp
> }
> ```
This is read in a loop.
```
for n < length
```
--
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]