MCPcopy
hub / github.com/monasticacademy/httptap / notifyUDP

Method notifyUDP

mux.go:145–157  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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
145func (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
160type udpResponder interface {

Callers 1

MainFunction · 0.95

Calls 3

patternMatchesFunction · 0.85
verbosefFunction · 0.70
LocalAddrMethod · 0.65

Tested by

no test coverage detected