panjf2000 / gnet

🚀 gnet is a high-performance, lightweight, non-blocking, event-driven networking framework written in pure Go.
https://gnet.host
Apache License 2.0
9.52k stars 1.03k forks source link

测试用例不通过 #272

Closed zhongweikang closed 2 years ago

zhongweikang commented 2 years ago

Describe the bug https://github.com/panjf2000/gnet/blob/dev/gnet_test.go#L48 我把 48 ~ 101 行的代码,多复制了 3 次,然后执行测试用例,出现了失败的情况,这种失败是必现的 错误详见截图

Screenshots image

System Info (please complete the following information):

Additional context 本意是想修改代码支持 reuseaddr 配置(可以在timewait的情况下复用端口号,且继续使用主从Reactor模型),因此增加了相应的测试用例,却触发了测试用例不通过。 上诉报错应该和新增的 reuseaddr 配置没关系,因为我多复制了几遍的其他测试用例,也是必现的,猜测与并发有关。

panjf2000 commented 2 years ago

现在支持 reuseaddr,设置 reuseport 就行。

zhongweikang commented 2 years ago

设置 reuseport,就退化成 evio 的网络模型了,gnet实现的主从网络模型还是更优的

panjf2000 commented 2 years ago

现在 reuseaddr 和 reuseport 在 gnet 里是一起设置的,可以修改一下。