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

Function EchoUDP

midway/echo.go:25–40  ·  view source on GitHub ↗
(c net.PacketConn, wg *sync.WaitGroup)

Source from the content-addressed store, hash-verified

23)
24
25func EchoUDP(c net.PacketConn, wg *sync.WaitGroup) {
26 defer wg.Done()
27
28 if c == nil {
29 log.Println("Exiting udp")
30 return
31 }
32
33 udpwg := &sync.WaitGroup{}
34 udpwg.Add(udproutines)
35 for i := 0; i < udproutines; i++ {
36 // c => packet-conn, and so multiple goroutines can read without issue
37 go processudp(c, udpwg)
38 }
39 udpwg.Wait()
40}
41
42func processudp(c net.PacketConn, uwg *sync.WaitGroup) {
43 defer uwg.Done()

Callers 1

mainFunction · 0.92

Calls 1

processudpFunction · 0.85

Tested by

no test coverage detected