mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-04 04:37:36 +03:00
remove the SentFin method from the stream
When a FIN is dequeued from the stream by the streamFramer, it is guaranteed to be sent out. There's no need to explicitely signal that to the stream.
This commit is contained in:
parent
71af5758e2
commit
8e8892b064
6 changed files with 19 additions and 30 deletions
13
stream.go
13
stream.go
|
@ -24,7 +24,6 @@ type streamI interface {
|
|||
GetWriteOffset() protocol.ByteCount
|
||||
Finished() bool
|
||||
Cancel(error)
|
||||
SentFin()
|
||||
// methods needed for flow control
|
||||
GetWindowUpdate() protocol.ByteCount
|
||||
UpdateSendWindow(protocol.ByteCount)
|
||||
|
@ -273,6 +272,14 @@ func (s *stream) HasDataForWriting() bool {
|
|||
}
|
||||
|
||||
func (s *stream) GetDataForWriting(maxBytes protocol.ByteCount) ([]byte, bool /* should send FIN */) {
|
||||
data, shouldSendFin := s.getDataForWritingImpl(maxBytes)
|
||||
if shouldSendFin {
|
||||
s.finSent.Set(true)
|
||||
}
|
||||
return data, shouldSendFin
|
||||
}
|
||||
|
||||
func (s *stream) getDataForWritingImpl(maxBytes protocol.ByteCount) ([]byte, bool /* should send FIN */) {
|
||||
s.mutex.Lock()
|
||||
defer s.mutex.Unlock()
|
||||
|
||||
|
@ -317,10 +324,6 @@ func (s *stream) shouldSendReset() bool {
|
|||
return (s.resetLocally.Get() || s.resetRemotely.Get()) && !s.finishedWriteAndSentFin()
|
||||
}
|
||||
|
||||
func (s *stream) SentFin() {
|
||||
s.finSent.Set(true)
|
||||
}
|
||||
|
||||
// AddStreamFrame adds a new stream frame
|
||||
func (s *stream) AddStreamFrame(frame *wire.StreamFrame) error {
|
||||
maxOffset := frame.Offset + frame.DataLen()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue