(c net.PacketConn, wg *sync.WaitGroup)
| 23 | ) |
| 24 | |
| 25 | func 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 | |
| 42 | func processudp(c net.PacketConn, uwg *sync.WaitGroup) { |
| 43 | defer uwg.Done() |