Cleaned up disused signal chan from Server
This commit is contained in:
parent
d4d1089627
commit
747269aed0
11
rosella.go
11
rosella.go
@ -14,7 +14,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Server struct {
|
type Server struct {
|
||||||
signalChan chan int
|
|
||||||
eventChan chan Event
|
eventChan chan Event
|
||||||
running bool
|
running bool
|
||||||
|
|
||||||
@ -46,7 +45,6 @@ type Event struct {
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
signalStop int = iota
|
signalStop int = iota
|
||||||
signalDisconnect
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -71,8 +69,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func NewServer() (*Server, error) {
|
func NewServer() (*Server, error) {
|
||||||
return &Server{signalChan: make(chan int),
|
return &Server{eventChan: make(chan Event),
|
||||||
eventChan: make(chan Event),
|
|
||||||
name: "rosella",
|
name: "rosella",
|
||||||
clientMap: make(map[string]*Client),
|
clientMap: make(map[string]*Client),
|
||||||
channelMap: make(map[string]*Channel)}, nil
|
channelMap: make(map[string]*Channel)}, nil
|
||||||
@ -99,12 +96,6 @@ func (s *Server) HandleConnection(conn net.Conn) {
|
|||||||
func (s *Server) serverThread() {
|
func (s *Server) serverThread() {
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case s := <-s.signalChan:
|
|
||||||
if s == signalStop {
|
|
||||||
//TODO
|
|
||||||
//Disconnect all clients then return
|
|
||||||
return
|
|
||||||
}
|
|
||||||
case e := <-s.eventChan:
|
case e := <-s.eventChan:
|
||||||
s.handleEvent(e)
|
s.handleEvent(e)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user