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

如何避免缓存积累延迟的问题 #175

Closed
l42111996 opened this issue Sep 11, 2018 · 2 comments
Closed

如何避免缓存积累延迟的问题 #175

l42111996 opened this issue Sep 11, 2018 · 2 comments

Comments

@l42111996
Copy link
Contributor

因此,千万不要以为 ikcp_send 可以无节制的调用,为什么 KCP在发送窗口满的时候不返回错误呢?这个问题当年设计时权衡过,如果返回希望发送时返回错误的 EAGAIN/EWOULDBLOCK 你势必外层还需要建立一个缓存,等到下次再测试是否可以 send。那么还不如 kcp直接把这一层缓存做了,让上层更简单些,而且具体要如何处理 EAGAIN,可以让上层通过检测 ikcp_waitsnd 函数来判断还有多少包没有发出去,灵活抉择是否向 snd_queue 缓存追加数据包还是其他。

这里我看挺多版本在上层是增加一个缓冲队列,然后检测ikcp_waitsnd如果满了就下个消息再判断满不满再发送出去。这里最好的方式应该是什么样子呢? 是否可以直接写入 然后判断ikcp_waitsnd长度超过一定的值了直接断开连接?

@l42111996
Copy link
Contributor Author

或者判断上层增加的缓冲队列长度大于一定值了断开连接?哪种方式更好一点?

@caoli5288
Copy link

kcp只是一层ARQ

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

2 participants