notifyTCP is called when a new stream is created. It finds the first listener that will accept the given stream. It never blocks.
(req TCPRequest)
| 127 | // notifyTCP is called when a new stream is created. It finds the first listener |
| 128 | // that will accept the given stream. It never blocks. |
| 129 | func (s *mux) notifyTCP(req TCPRequest) { |
| 130 | s.mu.Lock() |
| 131 | defer s.mu.Unlock() |
| 132 | |
| 133 | for _, entry := range s.tcpHandlers { |
| 134 | if patternMatches(entry.pattern, req.LocalAddr()) { |
| 135 | go entry.handler(req) |
| 136 | return |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | verbosef("nobody listening for tcp to %v, dropping", req.LocalAddr()) |
| 141 | } |
| 142 | |
| 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 |
no test coverage detected