增加stop命令

This commit is contained in:
duanhf2012
2020-04-01 16:35:13 +08:00
parent 27ff65726a
commit 9c7a7644ee
8 changed files with 56 additions and 29 deletions

View File

@@ -108,6 +108,7 @@ func (slf *Service) Run() {
if bStop == true {
if atomic.AddInt32(&slf.gorouterNum,-1)<=0 {
slf.startStatus = false
slf.Release()
slf.OnRelease()
}
break
@@ -120,8 +121,7 @@ func (slf *Service) GetName() string{
return slf.name
}
func (slf *Service) OnRelease(){
func (slf *Service) Release(){
defer func() {
if r := recover(); r != nil {
buf := make([]byte, 40960)
@@ -134,6 +134,9 @@ func (slf *Service) OnRelease(){
slf.this.OnRelease()
}
func (slf *Service) OnRelease(){
}
func (slf *Service) OnInit() error {
return nil
}