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

Function recreateConn_StartServer

tests/gracefulexit_test.go:17–39  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15var recreateConn_Signal *SignalTester
16
17func recreateConn_StartServer() {
18 queue := cellnet.NewEventQueue()
19
20 p := peer.NewGenericPeer("tcp.Acceptor", "server", recreateConn_Address, queue)
21
22 proc.BindProcessorHandler(p, "tcp.ltv", func(ev cellnet.Event) {
23
24 switch msg := ev.Message().(type) {
25 case *TestEchoACK:
26
27 fmt.Printf("server recv %+v\n", msg)
28
29 ev.Session().Send(&TestEchoACK{
30 Msg: msg.Msg,
31 Value: msg.Value,
32 })
33 }
34 })
35
36 p.Start()
37
38 queue.StartLoop()
39}
40
41// 客户端连接上后, 主动断开连接, 确保连接正常关闭
42func runConnClose() {

Callers 1

Calls 8

StartLoopMethod · 0.95
NewEventQueueFunction · 0.92
NewGenericPeerFunction · 0.92
BindProcessorHandlerFunction · 0.92
MessageMethod · 0.65
SendMethod · 0.65
SessionMethod · 0.65
StartMethod · 0.65

Tested by

no test coverage detected