MCPcopy Index your code
hub / github.com/coder/coder / requestLoop

Method requestLoop

vpn/tunnel.go:103–119  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

101}
102
103func (t *Tunnel) requestLoop() {
104 defer close(t.requestLoopDone)
105 for req := range t.speaker.requests {
106 if req.msg.Rpc != nil && req.msg.Rpc.MsgId != 0 {
107 t.handleRPC(req)
108 if _, ok := req.msg.GetMsg().(*ManagerMessage_Stop); ok {
109 close(t.sendCh)
110 return
111 }
112 continue
113 }
114 // Not a unary RPC. We don't know of any message types that are neither a response nor a
115 // unary RPC from the Manager. This shouldn't ever happen because we checked the protocol
116 // version during the handshake.
117 t.logger.Critical(t.ctx, "unknown request", slog.F("msg", req.msg))
118 }
119}
120
121// handleRPC handles unary RPCs from the manager, sending a reply back to the manager.
122func (t *Tunnel) handleRPC(req *request[*TunnelMessage, *ManagerMessage]) {

Callers 1

NewTunnelFunction · 0.95

Calls 2

handleRPCMethod · 0.95
GetMsgMethod · 0.45

Tested by

no test coverage detected