2017-12-05 05:20:42 +00:00
|
|
|
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"
|
|
|
|
)
|
|
|
|
|
2017-12-05 05:27:56 +00:00
|
|
|
func New(addr string, serverName string, rpcInvoker crr.RPCInvoker) server.Server {
|
2017-12-05 05:20:42 +00:00
|
|
|
rpcSH := newRPCServletHandler(rpcInvoker)
|
|
|
|
rpcSH.RegisterCodec(crpj.Name, crpj.NewServerCodec())
|
|
|
|
|
|
|
|
socketHandler := newSocketHandler(rpcSH)
|
|
|
|
|
2017-12-05 05:27:56 +00:00
|
|
|
sh := newServerHandler(addr, serverName, socketHandler)
|
2017-12-05 05:20:42 +00:00
|
|
|
s := server.New(sh)
|
|
|
|
|
|
|
|
return s
|
|
|
|
}
|