ing
This commit is contained in:
parent
c3cd65f72d
commit
6614bd5489
|
@ -1,13 +1,15 @@
|
|||
package server
|
||||
|
||||
import (
|
||||
crpj "git.loafle.net/commons_go/rpc/protocol/json"
|
||||
crr "git.loafle.net/commons_go/rpc/registry"
|
||||
"git.loafle.net/commons_go/rpc/server"
|
||||
)
|
||||
|
||||
func newRPCServletHandler(rpcInvoker crr.RPCInvoker) server.ServletHandler {
|
||||
func NewRPCServletHandler(rpcInvoker crr.RPCInvoker) server.ServletHandler {
|
||||
sh := &RPCServletHandlers{}
|
||||
sh.RPCInvoker = rpcInvoker
|
||||
sh.RegisterCodec(crpj.Name, crpj.NewServerCodec())
|
||||
|
||||
return sh
|
||||
}
|
||||
|
|
|
@ -1,19 +1,11 @@
|
|||
package server
|
||||
|
||||
import (
|
||||
crpj "git.loafle.net/commons_go/rpc/protocol/json"
|
||||
crr "git.loafle.net/commons_go/rpc/registry"
|
||||
"git.loafle.net/commons_go/server"
|
||||
)
|
||||
|
||||
func New(addr string, serverName string, rpcInvoker crr.RPCInvoker) server.Server {
|
||||
rpcSH := newRPCServletHandler(rpcInvoker)
|
||||
rpcSH.RegisterCodec(crpj.Name, crpj.NewServerCodec())
|
||||
|
||||
socketHandler := newSocketHandler(rpcSH)
|
||||
|
||||
sh := newServerHandler(addr, serverName, socketHandler)
|
||||
s := server.New(sh)
|
||||
func New(serverHandler ServerHandler) server.Server {
|
||||
s := server.New(serverHandler)
|
||||
|
||||
return s
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"git.loafle.net/commons_go/server"
|
||||
)
|
||||
|
||||
func newServerHandler(addr string, serverName string, socketHandler SocketHandler) ServerHandler {
|
||||
func NewServerHandler(addr string, serverName string, socketHandler SocketHandler) ServerHandler {
|
||||
sh := &ServerHandlers{
|
||||
addr: addr,
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
oopc "git.loafle.net/overflow/overflow_probe_container"
|
||||
)
|
||||
|
||||
func newSocketHandler(rpcSH RPCServletHandler) SocketHandler {
|
||||
func NewSocketHandler(rpcSH RPCServletHandler) SocketHandler {
|
||||
rpcRWCSH := crsrs.New()
|
||||
|
||||
sh := &SocketHandlers{
|
||||
|
@ -39,7 +39,7 @@ func (sh *SocketHandlers) Init(serverCTX server.ServerContext) error {
|
|||
}
|
||||
|
||||
func (sh *SocketHandlers) Handshake(socketCTX server.SocketContext, conn net.Conn) (id string) {
|
||||
return "discovery"
|
||||
return "server"
|
||||
}
|
||||
|
||||
func (sh *SocketHandlers) OnConnect(soc server.Socket) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user