MCPcopy
hub / github.com/cloudflare/cloudflared / wait

Method wait

stream/stream.go:65–82  ·  view source on GitHub ↗
(maxWaitForSecondStream time.Duration)

Source from the content-addressed store, hash-verified

63}
64
65func (s *bidirectionalStreamStatus) wait(maxWaitForSecondStream time.Duration) error {
66 <-s.doneChan
67
68 // Only wait for second stream to finish if maxWait is greater than zero
69 if maxWaitForSecondStream > 0 {
70 timer := time.NewTimer(maxWaitForSecondStream)
71 defer timer.Stop()
72
73 select {
74 case <-timer.C:
75 return fmt.Errorf("timeout waiting for second stream to finish")
76 case <-s.doneChan:
77 return nil
78 }
79 }
80
81 return nil
82}
83func (s *bidirectionalStreamStatus) isAnyDone() bool {
84 return atomic.LoadUint32(&s.anyDone) > 0
85}

Callers 6

terminate_by_signalMethod · 0.80
cleanupMethod · 0.80
PipeBidirectionalFunction · 0.80

Calls 2

ErrorfMethod · 0.80
StopMethod · 0.45