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

关闭服务时,书写重复代码 #290

Open
trash-boy opened this issue Dec 14, 2023 · 1 comment
Open

关闭服务时,书写重复代码 #290

trash-boy opened this issue Dec 14, 2023 · 1 comment

Comments

@trash-boy
Copy link
Contributor

func (s *Server) Stop() {
	zlog.Ins().InfoF("[STOP] Zinx server , name %s", s.Name)

	// Clear other connection information or other information that needs to be cleaned up
	// (将其他需要清理的连接信息或者其他信息 也要一并停止或者清理)
	s.ConnMgr.ClearConn()
	s.exitChan <- struct{}{}
	close(s.exitChan)
}

其实只需要close(s.exitChan),不需要在投递一个struct{}{},重复书写代码

@aceld
Copy link
Owner

aceld commented Dec 14, 2023

不错,有道理,希望自测下,没问题,可以提交个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