2018-05-03 06:30:23 +00:00
|
|
|
package client
|
|
|
|
|
|
|
|
import (
|
|
|
|
"sync/atomic"
|
|
|
|
|
2018-05-11 05:30:42 +00:00
|
|
|
csc "git.loafle.net/commons/server-go/client"
|
2018-05-03 06:30:23 +00:00
|
|
|
occ "git.loafle.net/overflow/container-go/client"
|
|
|
|
)
|
|
|
|
|
|
|
|
type ClientHandler interface {
|
|
|
|
occ.ClientHandler
|
|
|
|
}
|
|
|
|
|
|
|
|
type ClientHandlers struct {
|
|
|
|
occ.ClientHandlers
|
|
|
|
|
|
|
|
validated atomic.Value
|
|
|
|
}
|
|
|
|
|
2018-05-11 05:30:42 +00:00
|
|
|
func (ch *ClientHandlers) Init(clientCtx csc.ClientCtx) error {
|
2018-05-03 06:30:23 +00:00
|
|
|
if err := ch.ClientHandlers.Init(clientCtx); nil != err {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2018-05-11 05:30:42 +00:00
|
|
|
func (ch *ClientHandlers) OnStart(clientCtx csc.ClientCtx) error {
|
2018-05-03 06:30:23 +00:00
|
|
|
if err := ch.ClientHandlers.OnStart(clientCtx); nil != err {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2018-05-11 05:30:42 +00:00
|
|
|
func (ch *ClientHandlers) OnStop(clientCtx csc.ClientCtx) {
|
2018-05-03 06:30:23 +00:00
|
|
|
|
|
|
|
ch.ClientHandlers.OnStop(clientCtx)
|
|
|
|
}
|
|
|
|
|
2018-05-11 05:30:42 +00:00
|
|
|
func (ch *ClientHandlers) Destroy(clientCtx csc.ClientCtx) {
|
2018-05-03 06:30:23 +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
|
|
|
|
}
|