package client import ( "io" "git.loafle.net/commons_go/rpc" "git.loafle.net/commons_go/server/ipc" rpcClient "git.loafle.net/overflow/overflow_discovery/client/rpc" ) func NewClientHandler(addr string, registry rpc.Registry) *ClientHandlers { ch := &ClientHandlers{} ch.Addr = addr ch.RPCClient = rpcClient.New(registry) return ch } type ClientHandlers struct { ipc.ClientHandlers RPCClient rpcClient.Client } func (ch *ClientHandlers) OnStart() { // no op } func (ch *ClientHandlers) OnStop() { // no op } func (ch *ClientHandlers) OnHandshake(remoteAddr string, rwc io.ReadWriteCloser) error { return nil } func (ch *ClientHandlers) Handle(rwc io.ReadWriteCloser, stopChan chan struct{}) { ch.RPCClient.Start(rwc) select { case <-stopChan: rwc.Close() return default: } }