示例#1
0
文件: server.go 项目: bmatsuo/rex
// ServerConfig returns a ZoneConfig with address information derived from s.
func ServerConfig(s *room.Server) (*ZoneConfig, error) {
	zc := NewZoneConfig(s.Room())
	err := zc.initAddr(s.Addr())
	if err != nil {
		return nil, err
	}
	return zc, nil
}
示例#2
0
文件: main.go 项目: bmatsuo/rex
// RunDiscovery runs the discover server
func RunDiscovery(ctx context.Context, server *room.Server) {
	log.Printf("[INFO] Server running at %s", server.Addr())

	disco, err := roomdisco.NewDiscoverableServer(server)
	if err != nil {
		log.Printf("[FATAL] Discovery failed to start: %v", err)
		return
	}
	defer disco.Close()

	log.Printf("[INFO] Discovery server is running")
	<-ctx.Done()
}