notifyUDP is called when a new packet arrives. It finds the first handler with a pattern that matches the packet and delivers the packet to it
(conn net.Conn)
| 143 | // notifyUDP is called when a new packet arrives. It finds the first handler |
| 144 | // with a pattern that matches the packet and delivers the packet to it |
| 145 | func (s *mux) notifyUDP(conn net.Conn) { |
| 146 | s.mu.Lock() |
| 147 | defer s.mu.Unlock() |
| 148 | |
| 149 | for _, entry := range s.udpHandlers { |
| 150 | if patternMatches(entry.pattern, conn.LocalAddr()) { |
| 151 | go entry.handler(conn) |
| 152 | return |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | verbosef("nobody listening for udp to %v, dropping!", conn.LocalAddr()) |
| 157 | } |
| 158 | |
| 159 | // udpResponder is the interface for writing back UDP packets |
| 160 | type udpResponder interface { |
no test coverage detected