位置stream.go
1stream结构体
type stream struct {
mutex sync.Mutex//互斥锁,mutex.Lock()表示加锁,mutex.Unlock()解锁
ctx context.Context
ctxCancel context.CancelFunc
streamID protocol.StreamID//streamID
onData func()
//onReset is a callback that should send a RST_STREAM
onReset func(protocol.StreamID, protocol.ByteCount)//发送RST_STREAM的回调
readPosInFrame int
writeOffset protocol.ByteCount
readOffset protocol.ByteCount
//Once set, the errors must not be changed!
err error
// cancelled is set when Cancel() is called
cancelled utils.AtomicBool
// finishedReading is set once we read a frame with a FinBit一旦我们用FinBit读了一帧,finishedReading就开始了
finishedReading utils.AtomicBool
// finisedWriting is set once Close() is called
finishedWriting utils.AtomicBool
// resetLocally is set if Reset() is called
resetLocally utils.AtomicBool
// resetRemotely is set if RegisterRemoteError() is called
resetRemotely utils.AtomicBool
frameQueue *streamFrameSorter
readChan chan struct{}
readDeadline time.Time
dataForWriting []byte//写入的数据量
finSent utils.AtomicBool
rstSent utils.AtomicBool
writeChan chan struct{}
writeDeadline time.Time
flowControlManager flowcontrol.FlowControlManager
}