|
|
@ -1,4 +1,4 @@
|
|
|
|
package server
|
|
|
|
package sim
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"context"
|
|
|
@ -12,7 +12,6 @@ import (
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/gorilla/websocket"
|
|
|
|
"github.com/gorilla/websocket"
|
|
|
|
"github.com/jordanorelli/astro-domu/internal/errors"
|
|
|
|
"github.com/jordanorelli/astro-domu/internal/errors"
|
|
|
|
"github.com/jordanorelli/astro-domu/internal/server/sim"
|
|
|
|
|
|
|
|
"github.com/jordanorelli/astro-domu/internal/wire"
|
|
|
|
"github.com/jordanorelli/astro-domu/internal/wire"
|
|
|
|
"github.com/jordanorelli/blammo"
|
|
|
|
"github.com/jordanorelli/blammo"
|
|
|
|
)
|
|
|
|
)
|
|
|
@ -20,7 +19,7 @@ import (
|
|
|
|
type Server struct {
|
|
|
|
type Server struct {
|
|
|
|
*blammo.Log
|
|
|
|
*blammo.Log
|
|
|
|
http *http.Server
|
|
|
|
http *http.Server
|
|
|
|
world *sim.World
|
|
|
|
world *World
|
|
|
|
|
|
|
|
|
|
|
|
sync.Mutex
|
|
|
|
sync.Mutex
|
|
|
|
lastSessionID int
|
|
|
|
lastSessionID int
|
|
|
@ -42,7 +41,7 @@ func (s *Server) Start(host string, port int) error {
|
|
|
|
s.Log = blammo.NewLog("astro", options...).Child("server")
|
|
|
|
s.Log = blammo.NewLog("astro", options...).Child("server")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
s.world = sim.NewWorld(s.Log.Child("world"))
|
|
|
|
s.world = NewWorld(s.Log.Child("world"))
|
|
|
|
go s.world.Run(3)
|
|
|
|
go s.world.Run(3)
|
|
|
|
|
|
|
|
|
|
|
|
addr := fmt.Sprintf("%s:%d", host, port)
|
|
|
|
addr := fmt.Sprintf("%s:%d", host, port)
|