container_network/client/client-handler.go

58 lines
1010 B
Go
Raw Normal View History

2018-05-03 09:54:38 +00:00
package client
import (
"sync/atomic"
2018-07-01 04:32:39 +00:00
cssc "git.loafle.net/commons/server-go/socket/client"
2018-05-03 09:54:38 +00:00
occ "git.loafle.net/overflow/container-go/client"
)
type ClientHandler interface {
occ.ClientHandler
}
type ClientHandlers struct {
occ.ClientHandlers
validated atomic.Value
}
2018-07-01 04:32:39 +00:00
func (ch *ClientHandlers) Init(clientCtx cssc.ClientCtx) error {
2018-05-03 09:54:38 +00:00
if err := ch.ClientHandlers.Init(clientCtx); nil != err {
return err
}
return nil
}
2018-07-01 04:32:39 +00:00
func (ch *ClientHandlers) OnStart(clientCtx cssc.ClientCtx) error {
2018-05-03 09:54:38 +00:00
if err := ch.ClientHandlers.OnStart(clientCtx); nil != err {
return err
}
return nil
}
2018-07-01 04:32:39 +00:00
func (ch *ClientHandlers) OnStop(clientCtx cssc.ClientCtx) {
2018-05-03 09:54:38 +00:00
ch.ClientHandlers.OnStop(clientCtx)
}
2018-07-01 04:32:39 +00:00
func (ch *ClientHandlers) Destroy(clientCtx cssc.ClientCtx) {
2018-05-03 09:54:38 +00:00
ch.ClientHandlers.Destroy(clientCtx)
}
func (ch *ClientHandlers) Validate() error {
if nil != ch.validated.Load() {
return nil
}
ch.validated.Store(true)
if err := ch.ClientHandlers.Validate(); nil != err {
return err
}
return nil
}