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

Method setState

agent/reconnectingpty/reconnectingpty.go:218–229  ·  view source on GitHub ↗

setState sets and broadcasts the provided state if it is greater than the current state and the error if one has not already been set.

(state State, err error)

Source from the content-addressed store, hash-verified

216// setState sets and broadcasts the provided state if it is greater than the
217// current state and the error if one has not already been set.
218func (s *ptyState) setState(state State, err error) {
219 s.cond.L.Lock()
220 defer s.cond.L.Unlock()
221 // Cannot regress states. For example, trying to close after the process is
222 // done should leave us in the done state and not the closing state.
223 if state <= s.state {
224 return
225 }
226 s.error = err
227 s.state = state
228 s.cond.Broadcast()
229}
230
231// waitForState blocks until the state or a greater one is reached.
232func (s *ptyState) waitForState(state State) (State, error) {

Callers 7

chats.test.tsFile · 0.80
newScreenFunction · 0.80
lifecycleMethod · 0.80
CloseMethod · 0.80
newBufferedFunction · 0.80
lifecycleMethod · 0.80
CloseMethod · 0.80

Calls 2

LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected