MCPcopy Create free account
hub / github.com/celzero/midway / EchoTCP

Function EchoTCP

midway/echo.go:65–86  ·  view source on GitHub ↗
(tcp net.Listener, wg *sync.WaitGroup)

Source from the content-addressed store, hash-verified

63}
64
65func EchoTCP(tcp net.Listener, wg *sync.WaitGroup) {
66 defer wg.Done()
67
68 if tcp == nil {
69 log.Println("Exiting tcp")
70 return
71 }
72
73 defer tcp.Close()
74
75 for {
76 if conn, err := tcp.Accept(); err == nil {
77 go processtcp(conn)
78 } else {
79 fmt.Println("err accepting tcp conn")
80 if errors.Is(err, net.ErrClosed) {
81 log.Print(err)
82 return
83 }
84 }
85 }
86}
87
88func EchoPP(pp *proxyproto.Listener, wg *sync.WaitGroup) {
89 defer wg.Done()

Callers 1

mainFunction · 0.92

Calls 3

processtcpFunction · 0.85
AcceptMethod · 0.80
CloseMethod · 0.45

Tested by

no test coverage detected