This commit is contained in:
crusader
2017-11-23 18:34:07 +09:00
parent 2f67baeb46
commit 3037d18a5f
8 changed files with 78 additions and 8 deletions

View File

@@ -7,6 +7,7 @@ import (
"git.loafle.net/commons_go/logging"
"git.loafle.net/overflow/overflow_discovery/discovery"
"git.loafle.net/overflow/overflow_discovery/rpc/notify"
crs "git.loafle.net/commons_go/rpc/server"
"git.loafle.net/commons_go/server"
@@ -43,10 +44,18 @@ func (sh *ServerHandlers) OnConnect(conn net.Conn) (net.Conn, error) {
if conn, err = sh.ServerHandlers.OnConnect(conn); nil != err {
return nil, err
}
return newConn(conn, "jsonrpc"), nil
nConn := newConn(conn, "jsonrpc")
notify.NotifyInit(nConn)
return nConn, nil
}
func (sh *ServerHandlers) Handle(conn net.Conn, stopChan <-chan struct{}, doneChan chan<- struct{}) {
defer func() {
notify.NotifyDestroy()
}()
dConn := conn.(Conn)
contentType := dConn.GetContentType()
codec, err := sh.rpcSH.GetCodec(contentType)
@@ -74,6 +83,7 @@ func (sh *ServerHandlers) Handle(conn net.Conn, stopChan <-chan struct{}, doneCh
}
func (sh *ServerHandlers) OnStop() {
discovery.DiscoveryDestroy()
}