QuitService->BaseService

This commit is contained in:
Jae Kwon
2016-10-28 12:06:40 -07:00
committed by Ethan Buchman
parent 8374785c1d
commit 7998ba668a
5 changed files with 22 additions and 18 deletions

View File

@ -15,7 +15,7 @@ import (
// var maxNumberConnections = 2
type SocketServer struct {
QuitService
BaseService
proto string
addr string
@ -39,13 +39,13 @@ func NewSocketServer(protoAddr string, app types.Application) (Service, error) {
app: app,
conns: make(map[int]net.Conn),
}
s.QuitService = *NewQuitService(nil, "TMSPServer", s)
s.BaseService = *NewBaseService(nil, "TMSPServer", s)
_, err := s.Start() // Just start it
return s, err
}
func (s *SocketServer) OnStart() error {
s.QuitService.OnStart()
s.BaseService.OnStart()
ln, err := net.Listen(s.proto, s.addr)
if err != nil {
return err
@ -56,7 +56,7 @@ func (s *SocketServer) OnStart() error {
}
func (s *SocketServer) OnStop() {
s.QuitService.OnStop()
s.BaseService.OnStop()
s.listener.Close()
s.connsMtx.Lock()