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

如果客户端重启,是不是服务器也一定要重启才能正确使用呢 #35

Open
happyxgang opened this issue Apr 16, 2018 · 3 comments

Comments

@happyxgang
Copy link

我看代码kcp的connectid是客户端自增的,服务器根据两边ip地址做个map。如果一个客户端重启之后,服务器是不是要重启才能正确使用呢

@liudf0716
Copy link
Owner

好久没看代码了,应该不用,至多当作一个新的客户端来看待。

@happyxgang
Copy link
Author

多谢作者回复,我觉得应该也是不用的,不然用起来太麻烦。但是看代码里是用两个链接两端的ip作为key来记录相关信息的。这样子一个kcp对象也就只能存在一个key中,而且,kcp需要用connectionid来区分链接,代码中的client使用一个静态变量从0开始累加,当客户端重启后又从0开始,server里connectionid为0
的kcp对象里的una等信息和新的客户端对象对不上,是收不到数据的。感觉这时候server应该是没办法的。不知道是不是我看代码忽略了什么

@liudf0716
Copy link
Owner

如果真是有这个问题,哪应该就是bug,以测试结果为准
话说好久没看这部分的代码了,都快忘光了,惭愧!
如果有兴趣欢迎针对这个bug提pr修复,谢谢!

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