Allenxuxu / gev

🚀Gev is a lightweight, fast non-blocking TCP network library / websocket server based on Reactor mode. Support custom protocols to quickly and easily build high-performance servers.
MIT License
1.72k stars 193 forks source link

default protocol bug #116

Closed ghost closed 2 years ago

ghost commented 2 years ago

https://github.com/Allenxuxu/gev/blob/9262fa12b35a46747cf40ee5cd43efa9187adf85/protocol.go#L21 当e切片长度不为0时,已经将数据拷贝进UserBuffer了,但是并没有将buffer *ringbuffer.RingBuffer清空?这是为什么?

Allenxuxu commented 2 years ago

这边确实有问题,遗漏了Retrieve(n) , 感谢指出🙏

woshihuo12 commented 2 years ago

https://github.com/Allenxuxu/gev/blob/9262fa12b35a46747cf40ee5cd43efa9187adf85/protocol.go#L32

还想问下,这个拷贝到userBuffer的数据,外面使用的时候,是如何知道其有效长度的呢?

Allenxuxu commented 2 years ago

https://github.com/Allenxuxu/gev/blob/9262fa12b35a46747cf40ee5cd43efa9187adf85/protocol.go#L32

还想问下,这个拷贝到userBuffer的数据,外面使用的时候,是如何知道其有效长度的呢?

这里也有问题,应该userBuffer[:size], 我一起修复了 https://github.com/Allenxuxu/gev/pull/123。 非常感谢两位🙏。