MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / InitRPCServer

Method InitRPCServer

rpc/server.go:71–93  ·  view source on GitHub ↗

InitRPCServer load the private key, init the crypto transfer layer and register RPC services. IF ANY ERROR returned, please raise a FATAL.

(
	addr string,
	privateKeyPath string,
	masterKey []byte,
)

Source from the content-addressed store, hash-verified

69// services.
70// IF ANY ERROR returned, please raise a FATAL.
71func (s *Server) InitRPCServer(
72 addr string,
73 privateKeyPath string,
74 masterKey []byte,
75) (err error) {
76 //route.InitResolver()
77
78 err = kms.InitLocalKeyPair(privateKeyPath, masterKey)
79 if err != nil {
80 err = errors.Wrap(err, "init local key pair failed")
81 return
82 }
83
84 l, err := net.Listen("tcp", addr)
85 if err != nil {
86 err = errors.Wrap(err, "create crypto listener failed")
87 return
88 }
89
90 s.SetListener(l)
91
92 return
93}
94
95// SetListener set the service loop listener, used by func Serve main loop.
96func (s *Server) SetListener(l net.Listener) {

Callers 15

TestMultiChainFunction · 0.95
TestChainFunction · 0.80
initNodeFunction · 0.80
setupMuxParallelFunction · 0.80
initNodeChainBusServiceFunction · 0.80
initNodeFunction · 0.80
createServerFunction · 0.80
createServerFunction · 0.80
createDirectServerFunction · 0.80
setupServerFunction · 0.80

Calls 2

SetListenerMethod · 0.95
InitLocalKeyPairFunction · 0.92

Tested by 15

TestMultiChainFunction · 0.76
TestChainFunction · 0.64
initNodeFunction · 0.64
setupMuxParallelFunction · 0.64
initNodeChainBusServiceFunction · 0.64
initNodeFunction · 0.64
setupServerFunction · 0.64
TestETLSBugFunction · 0.64
TestEncPingFindNeighborFunction · 0.64
TestCaller_CallNodeFunction · 0.64