MCPcopy Create free account
hub / github.com/PatchMon/PatchMon / WaitReady

Method WaitReady

server-source-code/internal/rdpproxy/session.go:325–336  ·  view source on GitHub ↗

WaitReady blocks up to timeout for the initial agent handshake. Returns ErrAgentTimeout if nothing arrives, or the request context error if cancelled.

(ctx context.Context, timeout time.Duration)

Source from the content-addressed store, hash-verified

323// WaitReady blocks up to timeout for the initial agent handshake. Returns
324// ErrAgentTimeout if nothing arrives, or the request context error if cancelled.
325func (s *Session) WaitReady(ctx context.Context, timeout time.Duration) (AgentResult, error) {
326 timer := time.NewTimer(timeout)
327 defer timer.Stop()
328 select {
329 case r := <-s.agentReady:
330 return r, nil
331 case <-timer.C:
332 return AgentResult{}, ErrAgentTimeout
333 case <-ctx.Done():
334 return AgentResult{}, ctx.Err()
335 }
336}
337
338// OnAgentConnected is called when the agent sends rdp_proxy_connected.
339// Signals the handshake channel so ServeCreateTicket can proceed.

Callers 1

WaitAgentReadyMethod · 0.80

Calls 1

StopMethod · 0.45

Tested by

no test coverage detected