()
| 9 | ) |
| 10 | |
| 11 | func clientSyncRPC() { |
| 12 | |
| 13 | queue := cellnet.NewEventQueue() |
| 14 | |
| 15 | p := peer.NewGenericPeer("tcp.Connector", "async rpc", peerAddress, queue) |
| 16 | |
| 17 | // 创建一个消息同步接收器 |
| 18 | rv := proc.NewSyncReceiver(p) |
| 19 | |
| 20 | proc.BindProcessorHandler(p, "tcp.ltv", rv.EventCallback()) |
| 21 | |
| 22 | p.Start() |
| 23 | |
| 24 | queue.StartLoop() |
| 25 | |
| 26 | // 等连接上时 |
| 27 | rv.WaitMessage("cellnet.SessionConnected") |
| 28 | |
| 29 | // 同步RPC |
| 30 | rpc.CallSync(p, &TestEchoACK{ |
| 31 | Msg: "hello", |
| 32 | Value: 1234, |
| 33 | }, time.Second) |
| 34 | } |
no test coverage detected