MCPcopy
hub / github.com/davyxu/cellnet / rpc_StartServer

Function rpc_StartServer

tests/rpc_test.go:23–46  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

21)
22
23func rpc_StartServer() {
24 queue := cellnet.NewEventQueue()
25
26 rpc_Acceptor = peer.NewGenericPeer("tcp.Acceptor", "server", syncRPC_Address, queue)
27
28 proc.BindProcessorHandler(rpc_Acceptor, "tcp.ltv", func(ev cellnet.Event) {
29 switch msg := ev.Message().(type) {
30 case *TestEchoACK:
31 log.Debugln("server recv rpc ", *msg)
32
33 ev.(interface {
34 Reply(interface{})
35 }).Reply(&TestEchoACK{
36 Msg: msg.Msg,
37 Value: msg.Value,
38 })
39
40 }
41
42 })
43 rpc_Acceptor.Start()
44
45 queue.StartLoop()
46}
47func syncRPC_OnClientEvent(ev cellnet.Event) {
48
49 switch ev.Message().(type) {

Callers 3

TestSyncRPCFunction · 0.85
TestASyncRPCFunction · 0.85
TestTypeRPCFunction · 0.85

Calls 7

StartLoopMethod · 0.95
NewEventQueueFunction · 0.92
NewGenericPeerFunction · 0.92
BindProcessorHandlerFunction · 0.92
MessageMethod · 0.65
ReplyMethod · 0.65
StartMethod · 0.65

Tested by

no test coverage detected