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

请教一个reactor的问题 #352

Closed woshihuo12 closed 2 years ago

woshihuo12 commented 2 years ago

https://github.com/panjf2000/gnet/blob/4195bd1aece515d02f4fb0de65966f498294fc12/engine.go#L187

这里为什么在这种配置下就不用主从式的reactor,而用传统reactor呢?

panjf2000 commented 2 years ago

reuseport 是因为在默认的主从 reactors 的模式下不存在惊群问题,所以设置 reuseport 没意义,至于 udp 则是因为用 evio 的模式实现起来更简单一点。