(resp R)
| 237 | } |
| 238 | |
| 239 | func (s *speaker[_, R, _]) tryToDeliverResponse(resp R) { |
| 240 | msgID := resp.GetRpc().GetResponseTo() |
| 241 | s.mu.Lock() |
| 242 | defer s.mu.Unlock() |
| 243 | c, ok := s.responseChans[msgID] |
| 244 | if ok { |
| 245 | c <- resp |
| 246 | // Remove the channel since we delivered a response. This ensures that each response channel |
| 247 | // gets _at most_ one response. Since the channels are buffered with size 1, send will |
| 248 | // never block. |
| 249 | delete(s.responseChans, msgID) |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | // handshake performs the initial CoderVPN protocol handshake over the given conn |
| 254 | func handshake( |
no test coverage detected