forked from External/grumble
Add a running state to the server object
This commit is contained in:
parent
f25751d1aa
commit
8ff0a15bcf
1 changed files with 4 additions and 0 deletions
|
|
@ -47,6 +47,7 @@ type Server struct {
|
||||||
address string
|
address string
|
||||||
port int
|
port int
|
||||||
udpconn *net.UDPConn
|
udpconn *net.UDPConn
|
||||||
|
running bool
|
||||||
|
|
||||||
incoming chan *Message
|
incoming chan *Message
|
||||||
udpsend chan *Message
|
udpsend chan *Message
|
||||||
|
|
@ -100,6 +101,7 @@ func NewServer(id int64, addr string, port int) (s *Server, err os.Error) {
|
||||||
s.Id = id
|
s.Id = id
|
||||||
s.address = addr
|
s.address = addr
|
||||||
s.port = port
|
s.port = port
|
||||||
|
s.running = false
|
||||||
|
|
||||||
s.clients = make(map[uint32]*Client)
|
s.clients = make(map[uint32]*Client)
|
||||||
s.Users = make(map[uint32]*User)
|
s.Users = make(map[uint32]*User)
|
||||||
|
|
@ -995,6 +997,8 @@ func (s *Server) ListenAndMurmur() {
|
||||||
// Launch the event handler goroutine
|
// Launch the event handler goroutine
|
||||||
go s.handler()
|
go s.handler()
|
||||||
|
|
||||||
|
s.running = true
|
||||||
|
|
||||||
// Setup our UDP listener and spawn our reader and writer goroutines
|
// Setup our UDP listener and spawn our reader and writer goroutines
|
||||||
s.SetupUDP()
|
s.SetupUDP()
|
||||||
go s.ListenUDP()
|
go s.ListenUDP()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue