// 重连逻辑, 留给上层重写实现 func (this *NetworkConnector) NetworkReconnect() { f := func() { zwflog.LogDebug("start to reconnect ...") this.NetworkConnectTo(this.remoteAddr) } time.AfterFunc(reconnectDuration*time.Second, f) }
func (this *Server) waitToExit() { c := make(chan os.Signal, 1) signal.Notify(c, os.Interrupt, os.Kill) s := <-c // block until a signal is received zwflog.LogDebug("server receive signal%d, and will exit!", s) this.closeServer() }