StreamManager handles PTY output buffering with ACK-based flow control
| 31 | |
| 32 | // StreamManager handles PTY output buffering with ACK-based flow control |
| 33 | type StreamManager struct { |
| 34 | lock sync.Mutex |
| 35 | drainCond *sync.Cond |
| 36 | |
| 37 | streamId string |
| 38 | |
| 39 | // this is the data read from the attached reader |
| 40 | buf *CirBuf |
| 41 | terminalEvent *streamTerminalEvent |
| 42 | eofPos int64 // fixed position when EOF/error occurs (-1 if not yet) |
| 43 | |
| 44 | reader io.Reader |
| 45 | |
| 46 | cwndSize int |
| 47 | rwndSize int |
| 48 | // invariant: if connected is true, dataSender is non-nil |
| 49 | connected bool |
| 50 | dataSender DataSender |
| 51 | |
| 52 | // unacked state (reset on disconnect) |
| 53 | sentNotAcked int64 |
| 54 | terminalEventSent bool |
| 55 | |
| 56 | // track max acked to handle out-of-order ACKs (reset on disconnect) |
| 57 | maxAckedSeq int64 |
| 58 | maxAckedRwnd int64 |
| 59 | |
| 60 | // terminal state - once true, stream is complete |
| 61 | terminalEventAcked bool |
| 62 | closed bool |
| 63 | } |
| 64 | |
| 65 | func MakeStreamManager() *StreamManager { |
| 66 | return MakeStreamManagerWithSizes(CwndSize, CirBufSize) |
nothing calls this directly
no outgoing calls
no test coverage detected