Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

这里的循环是不是换成if也行 #121

Closed
ghost opened this issue Mar 27, 2022 · 2 comments
Closed

这里的循环是不是换成if也行 #121

ghost opened this issue Mar 27, 2022 · 2 comments

Comments

@ghost
Copy link

ghost commented Mar 27, 2022

for ctx != nil || len(receivedData) != 0 {

c.protocol.UnPacket(c, buffer)中的buffer要么是c.buffer,要么是c.inBuffer,只有handleRead调用了handleProtocol,handleRead的过程中,没有其他协程使用c.buffer和c.inBuffer,所以说只需要一次c.protocol.UnPacket(c, buffer),无须循环呀!我还是不太明白

@Allenxuxu
Copy link
Owner

Allenxuxu commented Mar 27, 2022

是的,但是我想将读到的数据尽快解析出来

@ghost
Copy link
Author

ghost commented Mar 29, 2022

恩恩,晓得了

@ghost ghost closed this as completed Mar 29, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant