MCPcopy Create free account
hub / github.com/coder/coder / tryToDeliverResponse

Method tryToDeliverResponse

vpn/speaker.go:239–251  ·  view source on GitHub ↗
(resp R)

Source from the content-addressed store, hash-verified

237}
238
239func (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
254func handshake(

Callers 1

recvFromSerdesMethod · 0.95

Calls 4

GetResponseToMethod · 0.80
GetRpcMethod · 0.65
LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected