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

Function EchoPP

midway/echo.go:88–109  ·  view source on GitHub ↗
(pp *proxyproto.Listener, wg *sync.WaitGroup)

Source from the content-addressed store, hash-verified

86}
87
88func EchoPP(pp *proxyproto.Listener, wg *sync.WaitGroup) {
89 defer wg.Done()
90
91 if pp == nil {
92 log.Println("Exiting pp")
93 return
94 }
95
96 defer pp.Close()
97
98 for {
99 if conn, err := pp.Accept(); err == nil {
100 go processtcp(conn)
101 } else {
102 fmt.Println("err accepting proxy-proto conn")
103 if errors.Is(err, net.ErrClosed) {
104 log.Print(err)
105 return
106 }
107 }
108 }
109}
110
111func processtcp(c net.Conn) {
112 defer c.Close()

Callers 1

mainFunction · 0.92

Calls 3

processtcpFunction · 0.85
AcceptMethod · 0.80
CloseMethod · 0.45

Tested by

no test coverage detected