zinx icon indicating copy to clipboard operation
zinx copied to clipboard

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

Open trash-boy opened this issue 1 year ago • 1 comments

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{}{},重复书写代码

trash-boy avatar Dec 14 '23 02:12 trash-boy

不错,有道理,希望自测下,没问题,可以提交个PR :)

aceld avatar Dec 14 '23 09:12 aceld