Serve runs the server (运行服务)
()
| 468 | |
| 469 | // Serve runs the server (运行服务) |
| 470 | func (s *Server) Serve() { |
| 471 | s.Start() |
| 472 | // Block, otherwise the listener's goroutine will exit when the main Go exits (阻塞,否则主Go退出, listenner的go将会退出) |
| 473 | c := make(chan os.Signal, 1) |
| 474 | // Listen for specified signals: ctrl+c or kill signal (监听指定信号 ctrl+c kill信号) |
| 475 | signal.Notify(c, syscall.SIGINT, syscall.SIGTERM) |
| 476 | sig := <-c |
| 477 | zlog.Ins().InfoF("[SERVE] Zinx server , name %s, Serve Interrupt, signal = %v", s.Name, sig) |
| 478 | } |
| 479 | |
| 480 | func (s *Server) AddRouter(msgID uint32, router ziface.IRouter) { |
| 481 | if s.RouterSlicesMode { |