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

KCP.java中update方法第一行将Long强转为int类型,导致value变负数问题 #11

Open
shenfx opened this issue Dec 26, 2017 · 2 comments
Labels

Comments

@shenfx
Copy link

shenfx commented Dec 26, 2017

KCP.java中update方法第一行将Long强转为int类型
this.current = (int) current;
外部传入的是毫秒时间戳,这里强转为int类型,导致current变为负数,进而导致后续的rto计算全部失效。
看了c版本的kcp代码都是long类型的,这改为int是如何考虑的?上述问题应该如何解决?

@tidus5
Copy link
Contributor

tidus5 commented Apr 3, 2018

同样出现这个问题,
KcpOnUdp.java 202行,导致update 不执行了。

用maven 的1.2.6的版本会出现这个问题,就是 KcpOnUdp 197行, needUpdate ==true,但在flush方法里,updated == 0 直接return了。而时间转为int 变为负数,所以update 也执行不了

而最新源代码,去掉了 updated 的这个判断,所以 可以执行发送了。 但这个修改未发布到最新 maven里

@beykery
Copy link
Owner

beykery commented Sep 22, 2018

应该是同一个问题吧?@tidus5
这个应该是你pr里面提到的吧?

@beykery beykery added the bug label Apr 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants